From 8d54873a0a39a2060668d0ce52474b81d6341f51 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 30 May 2021 23:03:13 -0700 Subject: [PATCH 1/2] Add CI workflow to check for commonly misspelled words On every push, pull request, and periodically, use the codespell-project/actions-codespell action to check for commonly misspelled words. In the event of a false positive, the problematic word should be added, in all lowercase, to the ignore-words-list field of ./.codespellrc. Regardless of the case of the word in the false positive, it must be in all lowercase in the ignore list. The ignore list is comma-separated with no spaces. --- .codespellrc | 7 +++++++ .github/workflows/spell-check.yml | 22 ++++++++++++++++++++++ README.md | 1 + 3 files changed, 30 insertions(+) create mode 100644 .codespellrc create mode 100644 .github/workflows/spell-check.yml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..8d12eef4 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,7 @@ +# See: https://github.com/codespell-project/codespell#using-a-config-file +[codespell] +# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: +ignore-words-list = hel +check-filenames = +check-hidden = +skip = ./.git,./test/external diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml new file mode 100644 index 00000000..01bee879 --- /dev/null +++ b/.github/workflows/spell-check.yml @@ -0,0 +1,22 @@ +name: Spell Check + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + pull_request: + schedule: + # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + spellcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Spell check + uses: codespell-project/actions-codespell@master diff --git a/README.md b/README.md index 9dcec8e6..dcfa340a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Unit Tests](https://github.com/arduino/ArduinoCore-API/workflows/Unit%20Tests/badge.svg)](https://github.com/arduino/ArduinoCore-API/actions?workflow=Unit+Tests) [![codecov](https://codecov.io/gh/arduino/ArduinoCore-API/branch/master/graph/badge.svg)](https://codecov.io/gh/arduino/ArduinoCore-API) +[![Spell Check status](https://github.com/arduino/ArduinoCore-API/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino/ArduinoCore-API/actions/workflows/spell-check.yml) This repository hosts the hardware independent layer of Arduino core. From 14defce07cb0935ea12ce342140037d14df513f7 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 30 May 2021 23:40:39 -0700 Subject: [PATCH 2/2] Correct typos in comments and documentation --- .github/workflows/unit-tests.yml | 2 +- README.md | 4 ++-- api/IPAddress.cpp | 2 +- api/Udp.h | 4 ++-- api/deprecated-avr-comp/avr/interrupt.h | 2 +- api/deprecated/Client.h | 2 +- api/deprecated/HardwareSerial.h | 2 +- api/deprecated/IPAddress.h | 2 +- api/deprecated/Print.h | 2 +- api/deprecated/Printable.h | 2 +- api/deprecated/Server.h | 2 +- api/deprecated/Stream.h | 2 +- api/deprecated/Udp.h | 2 +- api/deprecated/WString.h | 2 +- test/src/Stream/test_readBytes.cpp | 4 ++-- test/src/String/test_replace.cpp | 4 ++-- test/src/String/test_trim.cpp | 2 +- 17 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 490c28e5..f72d58b1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -2,7 +2,7 @@ name: Unit Tests on: pull_request: - # Only run workflow if a file in these paths are modified + # Only run workflow if a file in these paths is modified paths: - ".github/workflows/unit-tests.yml" - "test/**" diff --git a/README.md b/README.md index dcfa340a..6dc97369 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository hosts the hardware independent layer of Arduino core. All Arduino official cores are being ported to the new structure so they take advantage of this single repo. Including this repo in your existing Arduino core will allow the language to grow and include new features. -For backwards compatibility, every revision of this repo will increase `ARDUINO_API_VERSION` define. +For backwards compatibility, every revision of this repo will increase the `ARDUINO_API_VERSION` define. Some cores have been ported to the new structure, for example: * megaAVR (https://github.com/arduino/ArduinoCore-megaAVR) @@ -21,7 +21,7 @@ These repositories **don't** contain the needed `api` subfolder; to "complete" t ### Porting tips -In the future, core apis will be updated independently from the core, so all the compatible cores will seamlessly adopt new features. +In the future, core APIs will be updated independently from the core, so all the compatible cores will seamlessly adopt new features. This requires support from all the IDEs, so in the meantime we suggest to release the core by copying a snapshot of this `api` folder. The most elegant and effective solution is to develop the core with `api` symlinked and produce the distributable archive by telling `tar` to follow symlinks. diff --git a/api/IPAddress.cpp b/api/IPAddress.cpp index 5a757545..5cf62d5e 100644 --- a/api/IPAddress.cpp +++ b/api/IPAddress.cpp @@ -66,7 +66,7 @@ bool IPAddress::fromString(const char *address) else if (c == '.') { if (dots == 3) { - // Too much dots (there must be 3 dots) + // Too many dots (there must be 3 dots) return false; } if (acc < 0) { diff --git a/api/Udp.h b/api/Udp.h index 4cfe2ac5..20117a67 100644 --- a/api/Udp.h +++ b/api/Udp.h @@ -48,10 +48,10 @@ class UDP : public Stream { // Sending UDP packets - // Start building up a packet to send to the remote host specific in ip and port + // Start building up a packet to send to the remote host specified in ip and port // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port virtual int beginPacket(IPAddress ip, uint16_t port) =0; - // Start building up a packet to send to the remote host specific in host and port + // Start building up a packet to send to the remote host specified in host and port // Returns 1 if successful, 0 if there was a problem resolving the hostname or port virtual int beginPacket(const char *host, uint16_t port) =0; // Finish off this packet and send it diff --git a/api/deprecated-avr-comp/avr/interrupt.h b/api/deprecated-avr-comp/avr/interrupt.h index 950509dd..a2873cf9 100644 --- a/api/deprecated-avr-comp/avr/interrupt.h +++ b/api/deprecated-avr-comp/avr/interrupt.h @@ -19,5 +19,5 @@ /* Empty file. This file is here to allow compatibility with sketches (made for AVR) - that includes + that include */ diff --git a/api/deprecated/Client.h b/api/deprecated/Client.h index 5f8d4be9..84981c71 100644 --- a/api/deprecated/Client.h +++ b/api/deprecated/Client.h @@ -18,7 +18,7 @@ // including Client.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../Client.h" diff --git a/api/deprecated/HardwareSerial.h b/api/deprecated/HardwareSerial.h index 19d77c78..0ed7d7a6 100644 --- a/api/deprecated/HardwareSerial.h +++ b/api/deprecated/HardwareSerial.h @@ -18,7 +18,7 @@ // including HardwareSerial.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../HardwareSerial.h" diff --git a/api/deprecated/IPAddress.h b/api/deprecated/IPAddress.h index bf7fb7f0..4c03574d 100644 --- a/api/deprecated/IPAddress.h +++ b/api/deprecated/IPAddress.h @@ -18,7 +18,7 @@ // including IPAddress.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../IPAddress.h" diff --git a/api/deprecated/Print.h b/api/deprecated/Print.h index 2ac088d8..a0d1bd14 100644 --- a/api/deprecated/Print.h +++ b/api/deprecated/Print.h @@ -18,7 +18,7 @@ // including Print.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../Print.h" diff --git a/api/deprecated/Printable.h b/api/deprecated/Printable.h index bd721264..b6888c11 100644 --- a/api/deprecated/Printable.h +++ b/api/deprecated/Printable.h @@ -18,7 +18,7 @@ // including Printable.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../Printable.h" diff --git a/api/deprecated/Server.h b/api/deprecated/Server.h index f3b02c16..65b544bb 100644 --- a/api/deprecated/Server.h +++ b/api/deprecated/Server.h @@ -18,7 +18,7 @@ // including Server.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../Server.h" diff --git a/api/deprecated/Stream.h b/api/deprecated/Stream.h index aa5dc8e0..4118ccb7 100644 --- a/api/deprecated/Stream.h +++ b/api/deprecated/Stream.h @@ -18,7 +18,7 @@ // including Stream.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../Stream.h" diff --git a/api/deprecated/Udp.h b/api/deprecated/Udp.h index 56980603..f03a64b4 100644 --- a/api/deprecated/Udp.h +++ b/api/deprecated/Udp.h @@ -18,7 +18,7 @@ // including Udp.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../Udp.h" diff --git a/api/deprecated/WString.h b/api/deprecated/WString.h index 072323e0..1a3a79fc 100644 --- a/api/deprecated/WString.h +++ b/api/deprecated/WString.h @@ -18,7 +18,7 @@ // including WString.h is deprecated, for all future projects use Arduino.h instead -// This include is added for compatibility, it will be remove on the next +// This include is added for compatibility, it will be removed on the next // major release of the API #include "../String.h" diff --git a/test/src/Stream/test_readBytes.cpp b/test/src/Stream/test_readBytes.cpp index 9ffdfe1d..65466cc8 100644 --- a/test/src/Stream/test_readBytes.cpp +++ b/test/src/Stream/test_readBytes.cpp @@ -25,7 +25,7 @@ TEST_CASE ("Testing readBytes(char *buffer, size_t length)", "[Stream-readBytes- REQUIRE(mock.readBytes(buf, sizeof(buf)) == 0); } - WHEN ("the stream contains less data then we want to read") + WHEN ("the stream contains less data than we want to read") { char buf[32] = {0}; char const str[] = "some stream content"; @@ -36,7 +36,7 @@ TEST_CASE ("Testing readBytes(char *buffer, size_t length)", "[Stream-readBytes- REQUIRE(mock.readString() == arduino::String("")); } - WHEN ("the stream contains more data then we want to read") + WHEN ("the stream contains more data than we want to read") { char buf[5] = {0}; mock << "some stream content"; diff --git a/test/src/String/test_replace.cpp b/test/src/String/test_replace.cpp index 62fd5e8f..5d46fafb 100644 --- a/test/src/String/test_replace.cpp +++ b/test/src/String/test_replace.cpp @@ -39,14 +39,14 @@ TEST_CASE ("Testing String::replace(char, char) when string contains elements = REQUIRE(str == "H3ll0 Ardu1n0!"); } -TEST_CASE ("Testing String::replace(String, String) when string does not constain subtr 'find'", "[String-replace-04]") +TEST_CASE ("Testing String::replace(String, String) when string does not contain substr 'find'", "[String-replace-04]") { arduino::String str("Hello Arduino!"); str.replace(arduino::String("Zulu"), arduino::String("11")); REQUIRE(str == "Hello Arduino!"); } -TEST_CASE ("Testing String::replace(String, String) when string constains subtr 'find'", "[String-replace-05]") +TEST_CASE ("Testing String::replace(String, String) when string contains substr 'find'", "[String-replace-05]") { arduino::String str("Hello Arduino!"); str.replace(arduino::String("ll"), arduino::String("11")); diff --git a/test/src/String/test_trim.cpp b/test/src/String/test_trim.cpp index 0328e3fc..539d6568 100644 --- a/test/src/String/test_trim.cpp +++ b/test/src/String/test_trim.cpp @@ -30,7 +30,7 @@ TEST_CASE ("Testing String::trim with space at the end", "[String-trim-02]") REQUIRE(str == "hello"); } -TEST_CASE ("Testing String::trim with space at both beginng and end", "[String-trim-03]") +TEST_CASE ("Testing String::trim with space at both beginning and end", "[String-trim-03]") { arduino::String str(" hello "); str.trim();