From 4b2ca6dde74864ec2462abe37aa8f94266eb546b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 9 Nov 2023 21:06:29 -0500 Subject: [PATCH] Add codespell support (config, CI action to detect new typos) + fix some typos (#605) * Add github action to codespell master on push and PRs * Add rudimentary codespell config * Ignore some variable/email * [DATALAD RUNCMD] run codespell throughout fixing typo automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ * [DATALAD RUNCMD] Apply clang-format to fix indentation affected by codespell === Do not change lines below === { "chain": [], "cmd": "clang-format -i src/terminal/TelemetryService.cpp", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- .codespellrc | 5 +++++ .github/workflows/codespell.yml | 22 ++++++++++++++++++++++ .github/workflows/linux_ci.yml | 10 +++++----- .github/workflows/mac_ci.yml | 8 ++++---- cmake/Findsodium.cmake | 2 +- src/base/BackedReader.cpp | 4 ++-- src/base/SocketHandler.cpp | 2 +- src/htm/MultiplexerState.cpp | 2 +- src/terminal/ServerFifoPath.cpp | 4 ++-- src/terminal/TelemetryService.cpp | 8 ++++---- src/terminal/TerminalClientMain.cpp | 2 +- 11 files changed, 48 insertions(+), 21 deletions(-) create mode 100644 .codespellrc create mode 100644 .github/workflows/codespell.yml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..20b9b2ed7 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,5 @@ +[codespell] +skip = .git,*.pdf,*.svg,.codespellrc +check-hidden = true +ignore-regex = \bhenrik@gassmann.onl\b +ignore-words-list = te diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 000000000..7373affc3 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,22 @@ +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.github/workflows/linux_ci.yml b/.github/workflows/linux_ci.yml index bc6bcdf64..411a2eede 100644 --- a/.github/workflows/linux_ci.yml +++ b/.github/workflows/linux_ci.yml @@ -29,7 +29,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} @@ -74,7 +74,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} @@ -119,7 +119,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} @@ -164,7 +164,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} @@ -209,7 +209,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} diff --git a/.github/workflows/mac_ci.yml b/.github/workflows/mac_ci.yml index 83b6f8715..4496a3ba2 100644 --- a/.github/workflows/mac_ci.yml +++ b/.github/workflows/mac_ci.yml @@ -28,7 +28,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} @@ -73,7 +73,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} @@ -117,7 +117,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} @@ -161,7 +161,7 @@ jobs: with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). - # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. + # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. path: | ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ ${{ env.VCPKG_ROOT }} diff --git a/cmake/Findsodium.cmake b/cmake/Findsodium.cmake index dd6ed7679..0528287a1 100644 --- a/cmake/Findsodium.cmake +++ b/cmake/Findsodium.cmake @@ -12,7 +12,7 @@ ######################################################################## # Tries to find the local libsodium installation. # -# On Windows the sodium_DIR enviroment variable is used as a default +# On Windows the sodium_DIR environment variable is used as a default # hint which can be overridden by setting the corresponding cmake variable. # # Once done the following variables will be defined: diff --git a/src/base/BackedReader.cpp b/src/base/BackedReader.cpp index 295a29248..f93b7c432 100644 --- a/src/base/BackedReader.cpp +++ b/src/base/BackedReader.cpp @@ -47,7 +47,7 @@ int BackedReader::read(Packet* packet) { socketHandler->read(socketFd, tmpBuf, 4 - partialMessage.length()); if (bytesRead == 0) { // Connection is closed. Instead of closing the socket, set EPIPE. - // In EternalTCP, the server needs to explictly tell the client that + // In EternalTCP, the server needs to explicitly tell the client that // the session is over. SetErrno(EPIPE); return -1; @@ -73,7 +73,7 @@ int BackedReader::read(Packet* packet) { ssize_t bytesRead = socketHandler->read(socketFd, &s[0], s.length()); if (bytesRead == 0) { // Connection is closed. Instead of closing the socket, set EPIPE. - // In EternalTCP, the server needs to explictly tell the client that + // In EternalTCP, the server needs to explicitly tell the client that // the session is over. SetErrno(EPIPE); return -1; diff --git a/src/base/SocketHandler.cpp b/src/base/SocketHandler.cpp index 8658ddd6d..3e6473aa0 100644 --- a/src/base/SocketHandler.cpp +++ b/src/base/SocketHandler.cpp @@ -20,7 +20,7 @@ void SocketHandler::readAll(int fd, void* buf, size_t count, bool timeout) { ssize_t bytesRead = read(fd, ((char*)buf) + pos, count - pos); if (bytesRead == 0) { // Connection is closed. Instead of closing the socket, set EPIPE. - // In EternalTCP, the server needs to explictly tell the client that + // In EternalTCP, the server needs to explicitly tell the client that // the session is over. SetErrno(EPIPE); bytesRead = -1; diff --git a/src/htm/MultiplexerState.cpp b/src/htm/MultiplexerState.cpp index c98ba3fb6..16fb6858d 100644 --- a/src/htm/MultiplexerState.cpp +++ b/src/htm/MultiplexerState.cpp @@ -86,7 +86,7 @@ string MultiplexerState::toJsonString() { void MultiplexerState::appendData(const string &uid, const string &data) { if (panes.find(uid) == panes.end()) { - STFATAL << "Tried to write to non-existant terminal"; + STFATAL << "Tried to write to non-existent terminal"; } panes[uid]->terminal->appendData(data); } diff --git a/src/terminal/ServerFifoPath.cpp b/src/terminal/ServerFifoPath.cpp index f487e2350..36db43150 100644 --- a/src/terminal/ServerFifoPath.cpp +++ b/src/terminal/ServerFifoPath.cpp @@ -82,7 +82,7 @@ void TryCreateDirectory(string dir, mode_t mode) { CHECK_EQ(::umask(oldMode), 0) << "Unexpected result when restoring umask, which should return the " - "previous overriden value (0)."; + "previous overridden value (0)."; } } // namespace @@ -106,7 +106,7 @@ void ServerFifoPath::createDirectoriesIfRequired() { // // Create subdirectories for ~/.local/share. These may already be created // with different permissions on different machines, so also create an - // etserver subdir to enforce 0700 permssions. + // etserver subdir to enforce 0700 permissions. const string homeDir = GetHome(); TryCreateDirectory(homeDir + "/.local", 0755); TryCreateDirectory(homeDir + "/.local/share", 0755); diff --git a/src/terminal/TelemetryService.cpp b/src/terminal/TelemetryService.cpp index c354b30e7..f9f701f8c 100644 --- a/src/terminal/TelemetryService.cpp +++ b/src/terminal/TelemetryService.cpp @@ -269,10 +269,10 @@ void TelemetryService::logToSentry(el::Level level, const string& message) { void TelemetryService::logToDatadog(const string& logText, el::Level logLevel, const string& filename, const int line) { map messageJson = { - {"message", logText}, {"level", logLevelToString(logLevel)}, - {"Enviroment", environment}, {"Application", "Eternal Terminal"}, - {"Version", ET_VERSION}, {"TelemetryId", telemetryId.str()}, - {"File", filename}, {"Line", to_string(line)}}; + {"message", logText}, {"level", logLevelToString(logLevel)}, + {"Environment", environment}, {"Application", "Eternal Terminal"}, + {"Version", ET_VERSION}, {"TelemetryId", telemetryId.str()}, + {"File", filename}, {"Line", to_string(line)}}; lock_guard lock(logMutex); if (logBuffer.size() > 16 * 1024) { diff --git a/src/terminal/TerminalClientMain.cpp b/src/terminal/TerminalClientMain.cpp index dc7c0677d..dd1cf05f3 100644 --- a/src/terminal/TerminalClientMain.cpp +++ b/src/terminal/TerminalClientMain.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv) { "[OPTION...] [user@]host[:port]\n\n" " Note that 'host' can be a hostname or ipv4 address with or without " "a port\n or an ipv6 address. If the ipv6 address is abbreviated with " - ":: then it must\n be specfied without a port (use -p,--port)."); + ":: then it must\n be specified without a port (use -p,--port)."); options.add_options() // ("h,help", "Print help") //