diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml new file mode 100644 index 00000000..78bb3234 --- /dev/null +++ b/.github/workflows/linter.yaml @@ -0,0 +1,34 @@ +--- +name: Lint Code Base + +on: + push: + branches-ignore: [master, main] + # Remove the line above to run when pushing to master + pull_request: + branches: [master, main] + +jobs: + build: + name: Lint Code Base + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: Lint Code Base + uses: github/super-linter/slim@v4 + env: + VALIDATE_ALL_CODEBASE: true + FILTER_REGEX_EXCLUDE: ./cpp/arduino/avr/* + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VALIDATE_CPP: true + VALIDATE_MARKDOWN: true + VALIDATE_YAML: true + LINTER_RULES_PATH: / + MARKDOWN_CONFIG_FILE: /.markdown-lint.json diff --git a/.markdown-lint.json b/.markdown-lint.json new file mode 100644 index 00000000..5488151a --- /dev/null +++ b/.markdown-lint.json @@ -0,0 +1,20 @@ +{ + "blanks-around-fences": false, + "blanks-around-headings": false, + "blanks-around-lists": false, + "commands-show-output": false, + "first-line-h1": false, + "header-increment": false, + "line_length": { + "line_length": 600 + }, + "no-bare-urls": false, + "no-duplicate-heading": false, + "no-multiple-blanks": { + "maximum": 2 + }, + "single-h1": false, + "ul-indent": { + "indent": 4 + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 96594786..2fdbffad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `--min-free-space=N` command-line argument to fail if free space is below required value - Add `_BV()` macro. - Support for `dtostrf()` +- Added a CI workflow to lint the code base - Added a CI workflow to check for spelling errors ### Changed @@ -202,7 +203,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `GodmodeState` now uses timestamped PinHistory for Analog and Digital ### Fixed -* `ArduinoQueue` no longer leaks memory +- `ArduinoQueue` no longer leaks memory ## [0.1.21] - 2019-02-07 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e0a691e7..e8ac9750 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,8 +11,8 @@ ArduinoCI uses a very standard GitHub workflow. Pull requests will trigger a Travis CI job. The following two commands will be expected to pass (so you may want to run them locally before opening the pull request): - * `bundle exec rubocop -D .` - code style tests - * `bundle exec rspec` - functional tests +* `bundle exec rubocop -D .` - code style tests +* `bundle exec rspec` - functional tests If you do not already have a working ruby development environment set up, run the following commands: diff --git a/CPPLINT.cfg b/CPPLINT.cfg new file mode 100644 index 00000000..52dc44e4 --- /dev/null +++ b/CPPLINT.cfg @@ -0,0 +1,3 @@ +set noparent +filter=-build/header_guard, -build/include, -build/include_order, -build/include_subdir, -build/include_what_you_use, -build/namespaces, -legal/copyright, -readability/alt_tokens, -readability/braces, -readability/casting, -readability/fn_size, -readability/inheritance, -readability/todo, -runtime/arrays, -runtime/explicit, -runtime/int, -runtime/printf, -runtime/references, -whitespace +linelength=120 diff --git a/README.md b/README.md index 528f3d99..d8c84294 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,8 @@ gem 'arduino_ci', path: '/path/to/development/dir/for/arduino_ci' ### Installing the Dependencies Fulfilling the `arduino_ci` library dependency is as easy as running either of these two commands: -``` + +```console $ bundle install # adds packages to global library (may require admin rights) $ bundle install --path vendor/bundle # adds packages to local library ``` @@ -128,7 +129,6 @@ $ bundle install --path vendor/bundle # adds packages to local library This will create a `Gemfile.lock` in your project directory, which you may optionally check into source control. A broader introduction to ruby dependencies is outside the scope of this document. - ### Running `arduino_ci.rb` To Test Your Library With that installed, just the following shell command each time you want the tests to execute: diff --git a/REFERENCE.md b/REFERENCE.md index c248abd1..1253e914 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -314,7 +314,6 @@ bundle exec arduino_ci.rb Note the use of subshell to execute `bundle exec arduino_library_location.rb`. This command simply returns the directory in which Arduino Libraries are (or should be) installed. - # Mocks of Arduino Hardware Functions Unless your library peforms something general (e.g. a mathematical or string function, a data structure like Queue, etc), you may need to ensure that your code interacts properly with the Arduino hardware. There are a series of mocks to assist in this. diff --git a/SampleProjects/DoSomething/test/README.md b/SampleProjects/DoSomething/test/README.md index 1c958086..b34d6c4e 100644 --- a/SampleProjects/DoSomething/test/README.md +++ b/SampleProjects/DoSomething/test/README.md @@ -4,6 +4,6 @@ These files are designed to test the testing framework (the Ruby gem) itself, li ## Naming convention -Files in this directory are given names that either contains "bad" (if it is expected to fail) or "good" (if it is expected to pass). This provides a signal to `rspec` for how the code is expected to perform (see `spec/cpp_library_spec.rb`). +Files in this directory are given names that either contains "bad" (if it is expected to fail) or "good" (if it is expected to pass). This provides a signal to `rspec` for how the code is expected to perform (see `spec/cpp_library_spec.rb`). When writing your own tests you should not follow this ("bad" and "good") naming convention. You should write all your tests expecting them to pass (relying on this `DoSomething` test to ensure that failures are actually noticed!). diff --git a/cpp/arduino/avr/CPPLINT.cfg b/cpp/arduino/avr/CPPLINT.cfg new file mode 100644 index 00000000..9bf134a9 --- /dev/null +++ b/cpp/arduino/avr/CPPLINT.cfg @@ -0,0 +1,3 @@ +# The files in this directory have been copied from Arduino. +# This file configures cpplint to ignore all files in this directory. +exclude_files=.*