diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 00000000..a8e6f177 --- /dev/null +++ b/.codespellignore @@ -0,0 +1,3 @@ +aci +ba +flem diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..e3d4b7c7 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,3 @@ +[codespell] +skip = ./cpp/arduino/avr/* +ignore-words=.codespellignore \ No newline at end of file diff --git a/.github/workflows/spelling.yaml b/.github/workflows/spelling.yaml new file mode 100644 index 00000000..ad182e4d --- /dev/null +++ b/.github/workflows/spelling.yaml @@ -0,0 +1,26 @@ +# This is the name of the workflow, visible on GitHub UI +name: Check Spelling + +on: + push: + branches-ignore: [master, main] + # Remove the line above to run when pushing to master + pull_request: + branches: [master, main] + +jobs: + build: + name: Check Spelling + 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: Check Spelling + uses: codespell-project/actions-codespell@master + with: + check_filenames: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f9f9bd3..96594786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - Allow use of watchdog timer in application code (though it doesn't do anything) - Show output from successful compile -- `--min-free-space=N` command-line argument to fail if free space is below requred value +- `--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 check for spelling errors ### Changed - We now compile a shared library to be used for each test. @@ -39,7 +40,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Better indications of which example sketch is being compiled as part of testing ### Changed -- Topmost installtion instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. +- Topmost installation instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. - Stream::readStreamUntil() no longer returns delimiter ### Removed @@ -100,7 +101,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [1.0.0] - 2020-11-29 ### Added - Special handling of attempts to run the `arduino_ci.rb` CI script against the ruby library instead of an actual Arduino project -- Explicit checks for attemping to test `arduino_ci` itself as if it were a library, resolving a minor annoyance to this developer. +- Explicit checks for attempting to test `arduino_ci` itself as if it were a library, resolving a minor annoyance to this developer. - Code coverage tooling - Explicit check and warning for library directory names that do not match our guess of what the library should/would be called - Symlink tests for `Host` @@ -207,7 +208,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.21] - 2019-02-07 ### Added - Proper `ostream operator <<` for `nullptr` -- Proper comparison operations fro `nullptr` +- Proper comparison operations for `nullptr` ### Changed - `Compare.h` heavily refactored to use a smallish macro @@ -235,7 +236,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Assertions on `nullptr` -- The defintion of `nullptr` +- The definition of `nullptr` ## [0.1.18] - 2019-01-29 @@ -298,7 +299,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Checking for (empty) set of platforms to build now precedes the check for examples to build; this avoids assuming that all libraries will have an example and dumping the file set when none are found ### Fixed -- Spaces in the names of project directores no longer cause unit test binaries to fail execution +- Spaces in the names of project directories no longer cause unit test binaries to fail execution - Configuration file overrides with `nil`s (or empty arrays) now properly override their base configuration @@ -429,7 +430,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Replaced pipes with `Open3.capture3` to avoid deadlocks when commands have too much output - `ci_config.rb` now returns empty arrays (instead of nil) for undefined config keys -- `pgmspace.h` explictly includes `` +- `pgmspace.h` explicitly includes `` - `__FlashStringHelper` should now be properly mocked for compilation - `WString.h` bool operator now works and is simpler @@ -437,7 +438,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [0.1.5] - 2018-03-05 ### Added - Yaml files can have either `.yml` or `.yaml` extensions -- Yaml files support select/reject critera for paths of unit tests for targeted testing +- Yaml files support select/reject criteria for paths of unit tests for targeted testing - Pins now track history and can report it in Ascii (big- or little-endian) for digital sequences - Pins now accept an array (or string) of input bits for providing pin values across multiple reads - FlashStringHelper (and related macros) compilation mocks @@ -490,7 +491,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - All test files were reporting "not ok" in TAP output. Now they are OK iff all asserts pass. - Directories with a C++ extension in their name could cause problems. Now they are ignored. -- `CppLibrary` had trouble with symlinks. It shoudn't anymore. +- `CppLibrary` had trouble with symlinks. It shouldn't anymore. - `CppLibrary` had trouble with vendor bundles. It might in the future, but I have a better fix ready to go if it's an issue. diff --git a/README.md b/README.md index 3d178110..528f3d99 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ This project has the following dependencies: * `ruby` 2.5 or higher * A compiler like `g++` (on OSX, `clang` works; on Cygwin, use the `mingw-gcc-c++` package) -* `python` (if using a board architecutre that requires it, e.g. ESP32, ESP8266; see [this issue](https://github.com/Arduino-CI/arduino_ci/issues/235#issuecomment-739629243)). Consider `pyserial` as well. +* `python` (if using a board architecture that requires it, e.g. ESP32, ESP8266; see [this issue](https://github.com/Arduino-CI/arduino_ci/issues/235#issuecomment-739629243)). Consider `pyserial` as well. In that environment, you can install by running `gem install arduino_ci`. To update to a latest version, use `gem update arduino_ci`. @@ -51,7 +51,7 @@ Arduino expects all libraries to be in a specific `Arduino/libraries` directory ### Changes to Your Repository -Unit testing binaries created by `arduino_ci` should not be commited to the codebase. To avoid that, add the following to your `.gitignore`: +Unit testing binaries created by `arduino_ci` should not be committed to the codebase. To avoid that, add the following to your `.gitignore`: ```ignore-list # arduino_ci unit test binaries and artifacts diff --git a/REFERENCE.md b/REFERENCE.md index 7a7c8ede..c248abd1 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -2,7 +2,7 @@ All tests are run via the same command: `bundle exec arduino_ci.rb`. -This script is responsible for detecting and runing all unit tests, on every combination of Arduino platform and C++ compiler. This is followed by attempting to detect and build every example on every "default" Arduino platform. +This script is responsible for detecting and running all unit tests, on every combination of Arduino platform and C++ compiler. This is followed by attempting to detect and build every example on every "default" Arduino platform. As a prerequisite, all Arduino "default" platforms are installed if they are not already available. @@ -398,7 +398,7 @@ unittest(pin_read_history) bool bigEndian = true; state->digitalPin[1].fromAscii("Yo", bigEndian); - // digitial history as serial data, big-endian + // digital history as serial data, big-endian bool expectedBits[16] = { 0, 1, 0, 1, 1, 0, 0, 1, // Y 0, 1, 1, 0, 1, 1, 1, 1 // o @@ -515,7 +515,7 @@ For additional complexity, there are some cases where you want to use a pin as a ```C++ int myPin = 3; - // digitial history as serial data, big-endian + // digital history as serial data, big-endian bool bigEndian = true; bool binaryAscii[24] = { 0, 1, 0, 1, 1, 0, 0, 1, // Y diff --git a/SampleProjects/README.md b/SampleProjects/README.md index 1b1dd086..4d8b9f0e 100644 --- a/SampleProjects/README.md +++ b/SampleProjects/README.md @@ -1,15 +1,15 @@ Arduino Sample Projects ======================= -This directory contains projects that are intended solely for testing the various features of this gem -- to test the testing framework itself. The RSpec tests refer specifically to these projects, and as a result _some are explicity designed to fail_. +This directory contains projects that are intended solely for testing the various features of this gem -- to test the testing framework itself. The RSpec tests refer specifically to these projects, and as a result _some are explicitly designed to fail_. > **If you are a first-time `arduino_ci` user an are looking for an example to copy from, see [the `Arduino-CI/Blink` repository](https://github.com/Arduino-CI/Blink) instead.** -* "TestSomething" contains a minimial library, but tests for all the C++ compilation feature-mocks of arduino_ci. -* "DoSomething" is a simple test of the testing framework (arduino_ci) itself to verfy that passes and failures are properly identified and reported. Because of this, it includes test files that are expected to fail -- they are prefixed with "bad-". +* "TestSomething" contains a minimal library, but tests for all the C++ compilation feature-mocks of arduino_ci. +* "DoSomething" is a simple test of the testing framework (arduino_ci) itself to verify that passes and failures are properly identified and reported. Because of this, it includes test files that are expected to fail -- they are prefixed with "bad-". * "OnePointOhDummy" is a non-functional library meant to test file inclusion logic on libraries conforming to the "1.0" specification -* "OnePointFiveMalformed" is a non-functional library meant to test file inclusion logic on libraries that attempt to conform to the ["1.5" specfication](https://arduino.github.io/arduino-cli/latest/library-specification/) but fail to include a `src` directory -* "OnePointFiveDummy" is a non-functional library meant to test file inclusion logic on libraries conforming to the ["1.5" specfication](https://arduino.github.io/arduino-cli/latest/library-specification/) +* "OnePointFiveMalformed" is a non-functional library meant to test file inclusion logic on libraries that attempt to conform to the ["1.5" specification](https://arduino.github.io/arduino-cli/latest/library-specification/) but fail to include a `src` directory +* "OnePointFiveDummy" is a non-functional library meant to test file inclusion logic on libraries conforming to the ["1.5" specification](https://arduino.github.io/arduino-cli/latest/library-specification/) * "DependOnSomething" is a non-functional library meant to test file inclusion logic with dependencies * "ExcludeSomething" is a non-functional library meant to test directory exclusion logic * "NetworkLib" tests the Ethernet library diff --git a/SampleProjects/TestSomething/test/godmode.cpp b/SampleProjects/TestSomething/test/godmode.cpp index 24f60e1d..49a65515 100644 --- a/SampleProjects/TestSomething/test/godmode.cpp +++ b/SampleProjects/TestSomething/test/godmode.cpp @@ -75,7 +75,7 @@ unittest(pin_read_history) { assertEqual(future[5], analogRead(1)); state->digitalPin[1].fromAscii("Yo", true); - // digitial history as serial data, big-endian + // digital history as serial data, big-endian bool binaryAscii[16] = { 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1 diff --git a/SampleProjects/TestSomething/test/pinhistory.cpp b/SampleProjects/TestSomething/test/pinhistory.cpp index 8f1687e2..b5f72f97 100644 --- a/SampleProjects/TestSomething/test/pinhistory.cpp +++ b/SampleProjects/TestSomething/test/pinhistory.cpp @@ -22,7 +22,7 @@ unittest(pin_read_history_bool_to_ascii) { PinHistory phb; // pin history bool phb.fromAscii("Yo", true); - // digitial history as serial data, big-endian + // digital history as serial data, big-endian bool binaryAscii[16] = { 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1}; diff --git a/cpp/arduino/Client.h b/cpp/arduino/Client.h index 759267a4..07ff5ebb 100644 --- a/cpp/arduino/Client.h +++ b/cpp/arduino/Client.h @@ -6,7 +6,7 @@ class Client : public Stream { public: Client() { - // The Stream mock defines a String buffer but never puts anyting in it! + // The Stream mock defines a String buffer but never puts anything in it! if (!mGodmodeDataIn) { mGodmodeDataIn = new String; } diff --git a/cpp/arduino/HardwareSerial.h b/cpp/arduino/HardwareSerial.h index 68c2010c..96c0727f 100644 --- a/cpp/arduino/HardwareSerial.h +++ b/cpp/arduino/HardwareSerial.h @@ -3,7 +3,7 @@ //#include #include "ci/StreamTape.h" -// definitions neeeded for Serial.begin's config arg +// definitions needed for Serial.begin's config arg #define SERIAL_5N1 0x00 #define SERIAL_6N1 0x02 #define SERIAL_7N1 0x04 diff --git a/cpp/arduino/MockEventQueue.h b/cpp/arduino/MockEventQueue.h index 31119f32..75156a10 100644 --- a/cpp/arduino/MockEventQueue.h +++ b/cpp/arduino/MockEventQueue.h @@ -60,7 +60,7 @@ class MockEventQueue { return ++mSize; } - // fully specfied event + // fully specified event bool push(const T& v, unsigned long const time) { Event e = {v, time}; return push(e); diff --git a/cpp/arduino/SoftwareSerial.h b/cpp/arduino/SoftwareSerial.h index 6f8870fd..292d77cd 100644 --- a/cpp/arduino/SoftwareSerial.h +++ b/cpp/arduino/SoftwareSerial.h @@ -3,7 +3,7 @@ #include "Stream.h" #include "Godmode.h" -// definitions neeeded for Serial.begin's config arg +// definitions needed for Serial.begin's config arg class SoftwareSerial : public Stream { diff --git a/cpp/arduino/Udp.h b/cpp/arduino/Udp.h index 8352f7f6..c5466528 100644 --- a/cpp/arduino/Udp.h +++ b/cpp/arduino/Udp.h @@ -9,7 +9,7 @@ class UDP : public Stream { public: UDP() { - // The Stream mock defines a String buffer but never puts anyting in it! + // The Stream mock defines a String buffer but never puts anything in it! if (!mGodmodeDataIn) { mGodmodeDataIn = new String; } diff --git a/cpp/arduino/ci/ObservableDataStream.h b/cpp/arduino/ci/ObservableDataStream.h index f6ffb2f6..6f803415 100644 --- a/cpp/arduino/ci/ObservableDataStream.h +++ b/cpp/arduino/ci/ObservableDataStream.h @@ -42,7 +42,7 @@ class DataStreamObserver { onByte(aByte); } - // entry poitn for bit-related handler + // entry point for bit-related handler void handleBit(bool aBit) { onBit(aBit); diff --git a/cpp/arduino/ci/README.md b/cpp/arduino/ci/README.md index 19831d42..7ccb52d1 100644 --- a/cpp/arduino/ci/README.md +++ b/cpp/arduino/ci/README.md @@ -1,5 +1,5 @@ The parent directory is for files that must stand in for their Arduino counterparts -- any `SomeFile` that might be requested as `#include `. -This directory is specificially for support files required by those other files. That's because we don't want to create collisions on filenames for common data structures like Queue. +This directory is specifically for support files required by those other files. That's because we don't want to create collisions on filenames for common data structures like Queue. If there end up being class-level conflicts, it is this developer's stated intention to rename our classes such that `class Float` becomes `class FloatyMcFloatFace`. diff --git a/cpp/arduino/ci/Table.h b/cpp/arduino/ci/Table.h index f5db3916..18c2ba5b 100644 --- a/cpp/arduino/ci/Table.h +++ b/cpp/arduino/ci/Table.h @@ -15,7 +15,7 @@ class ArduinoCITable { Node* mStart; unsigned long mSize; - // to alow const reference signatures, pre-allocate nil values + // to allow const reference signatures, pre-allocate nil values K mNilK; V mNilV; diff --git a/exe/arduino_ci.rb b/exe/arduino_ci.rb index 6b481f13..ebaa1452 100755 --- a/exe/arduino_ci.rb +++ b/exe/arduino_ci.rb @@ -59,7 +59,7 @@ def self.parse(options) puts puts "Additionally, the following environment variables control the script:" puts " - #{VAR_CUSTOM_INIT_SCRIPT} - if set, this script will be run from the Arduino/libraries directory" - puts " prior to any automated library installation or testing (e.g. to install unoffical libraries)" + puts " prior to any automated library installation or testing (e.g. to install unofficial libraries)" puts " - #{VAR_USE_SUBDIR} - if set, the script will install the library from this subdirectory of the cwd" puts " - #{VAR_EXPECT_EXAMPLES} - if set, testing will fail if no example sketches are present" puts " - #{VAR_EXPECT_UNITTESTS} - if set, testing will fail if no unit tests are present" diff --git a/lib/arduino_ci/arduino_downloader.rb b/lib/arduino_ci/arduino_downloader.rb index 2acdf30c..6b4eb24b 100644 --- a/lib/arduino_ci/arduino_downloader.rb +++ b/lib/arduino_ci/arduino_downloader.rb @@ -74,7 +74,7 @@ def self.downloader # The technology that will be used to extract the download # (for logging purposes) # @return [string] - def self.extracter + def self.extractor self.must_implement(__method__) end @@ -150,7 +150,7 @@ def execute if File.exist?(self.class.extracted_file) @output.puts "#{arduino_package} seems to have been extracted already at #{self.class.extracted_file}" elsif File.exist?(package_file) - @output.print "Extracting archive with #{self.class.extracter}" + @output.print "Extracting archive with #{self.class.extractor}" self.class.extract(package_file) @output.puts end diff --git a/lib/arduino_ci/arduino_downloader_linux.rb b/lib/arduino_ci/arduino_downloader_linux.rb index 487273d1..7ca4c0ff 100644 --- a/lib/arduino_ci/arduino_downloader_linux.rb +++ b/lib/arduino_ci/arduino_downloader_linux.rb @@ -26,7 +26,7 @@ def self.existing_executable # Make any preparations or run any checks prior to making changes # @return [string] Error message, or nil if success def prepare - reqs = [self.class.extracter] + reqs = [self.class.extractor] reqs.each do |req| return "#{req} does not appear to be installed!" unless Host.which(req) end @@ -36,14 +36,14 @@ def prepare # The technology that will be used to extract the download # (for logging purposes) # @return [string] - def self.extracter + def self.extractor "tar" end # Extract the package_file to extracted_file # @return [bool] whether successful def self.extract(package_file) - system(extracter, "xf", package_file, extracted_file) + system(extractor, "xf", package_file, extracted_file) end end diff --git a/lib/arduino_ci/arduino_downloader_osx.rb b/lib/arduino_ci/arduino_downloader_osx.rb index 89890599..f4aad08a 100644 --- a/lib/arduino_ci/arduino_downloader_osx.rb +++ b/lib/arduino_ci/arduino_downloader_osx.rb @@ -26,7 +26,7 @@ def self.existing_executable # Make any preparations or run any checks prior to making changes # @return [string] Error message, or nil if success def prepare - reqs = [self.class.extracter] + reqs = [self.class.extractor] reqs.each do |req| return "#{req} does not appear to be installed!" unless Host.which(req) end @@ -36,14 +36,14 @@ def prepare # The technology that will be used to extract the download # (for logging purposes) # @return [string] - def self.extracter + def self.extractor "tar" end # Extract the package_file to extracted_file # @return [bool] whether successful def self.extract(package_file) - system(extracter, "xf", package_file, extracted_file) + system(extractor, "xf", package_file, extracted_file) end end diff --git a/lib/arduino_ci/arduino_downloader_windows.rb b/lib/arduino_ci/arduino_downloader_windows.rb index 9b7d1862..f3b3964b 100644 --- a/lib/arduino_ci/arduino_downloader_windows.rb +++ b/lib/arduino_ci/arduino_downloader_windows.rb @@ -37,7 +37,7 @@ def self.existing_executable # The technology that will be used to extract the download # (for logging purposes) # @return [string] - def self.extracter + def self.extractor "Expand-Archive" end diff --git a/lib/arduino_ci/cpp_library.rb b/lib/arduino_ci/cpp_library.rb index 2446bff2..ed43f72c 100644 --- a/lib/arduino_ci/cpp_library.rb +++ b/lib/arduino_ci/cpp_library.rb @@ -274,7 +274,7 @@ def libasan?(gcc_binary) # Get a list of all CPP source files in a directory and its subdirectories # @param some_dir [Pathname] The directory in which to begin the search - # @param extensions [Array] The set of allowable file extensions + # @param extensions [Array] The set of allowable file extensions # @return [Array] The paths of the found files def code_files_in(some_dir, extensions) raise ArgumentError, 'some_dir is not a Pathname' unless some_dir.is_a? Pathname @@ -290,7 +290,7 @@ def code_files_in(some_dir, extensions) # Get a list of all CPP source files in a directory and its subdirectories # @param some_dir [Pathname] The directory in which to begin the search - # @param extensions [Array] The set of allowable file extensions + # @param extensions [Array] The set of allowable file extensions # @return [Array] The paths of the found files def code_files_in_recursive(some_dir, extensions) raise ArgumentError, 'some_dir is not a Pathname' unless some_dir.is_a? Pathname @@ -352,7 +352,7 @@ def exclude_dir @exclude_dirs.map { |p| Pathname.new(path) + p }.select(&:exist?) end - # The directory where we expect to find unit test defintions provided by the user + # The directory where we expect to find unit test definitions provided by the user # @return [Pathname] def tests_dir Pathname.new(path) + "test" @@ -421,7 +421,7 @@ def arduino_library_src_dirs(aux_libraries) # GCC command line arguments for including aux libraries # - # This function recursively collects the library directores of the dependencies + # This function recursively collects the library directories of the dependencies # # @param aux_libraries [Array] The external Arduino libraries required by this project # @return [Array] The GCC command-line flags necessary to include those libraries diff --git a/spec/arduino_backend_spec.rb b/spec/arduino_backend_spec.rb index fcf4dab1..5b654d5b 100644 --- a/spec/arduino_backend_spec.rb +++ b/spec/arduino_backend_spec.rb @@ -70,7 +70,7 @@ def get_sketch(dir, file) fake_urls = ["http://foo.bar", "http://arduino.ci"] existing_urls = backend.board_manager_urls - # try to ensure maxiumum variability in the test + # try to ensure maximum variability in the test test_url_sets = (existing_urls.empty? ? [fake_urls, []] : [[], fake_urls]) + [existing_urls] test_url_sets.each do |urls| diff --git a/spec/arduino_downloader_spec.rb b/spec/arduino_downloader_spec.rb index 9158b439..6b1498b4 100644 --- a/spec/arduino_downloader_spec.rb +++ b/spec/arduino_downloader_spec.rb @@ -9,7 +9,7 @@ expect{ad.existing_executable}.to raise_error(NotImplementedError) expect{ad.extracted_file}.to raise_error(NotImplementedError) - expect{ad.extracter}.to raise_error(NotImplementedError) + expect{ad.extractor}.to raise_error(NotImplementedError) expect{ad.extract("foo")}.to raise_error(NotImplementedError) end @@ -32,7 +32,7 @@ # expect(ad.force_installed_executable).to be nil expect(ad.downloader).to eq("open-uri") - expect(ad.extracter).to eq("tar") + expect(ad.extractor).to eq("tar") end it "has correct instance properties" do @@ -55,7 +55,7 @@ # expect(ad.force_installed_executable).to be nil expect(ad.downloader).to eq("open-uri") - expect(ad.extracter).to eq("tar") + expect(ad.extractor).to eq("tar") end it "has correct instance properties" do @@ -80,7 +80,7 @@ # expect(ad.force_installed_executable).to be nil expect(ad.downloader).to eq("open-uri") - expect(ad.extracter).to eq("Expand-Archive") + expect(ad.extractor).to eq("Expand-Archive") end it "has correct instance properties" do