Skip to content

Commit

Permalink
Add codespell support (config, CI action to detect new typos) + fix s…
Browse files Browse the repository at this point in the history
…ome 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 ^^^
  • Loading branch information
yarikoptic authored Nov 10, 2023
1 parent 2f8dfdd commit 4b2ca6d
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[codespell]
skip = .git,*.pdf,*.svg,.codespellrc
check-hidden = true
ignore-regex = \[email protected]\b
ignore-words-list = te
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions .github/workflows/linux_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/mac_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion cmake/Findsodium.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/base/BackedReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/base/SocketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/htm/MultiplexerState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/terminal/ServerFifoPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/terminal/TelemetryService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> 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<recursive_mutex> lock(logMutex);
if (logBuffer.size() > 16 * 1024) {
Expand Down
2 changes: 1 addition & 1 deletion src/terminal/TerminalClientMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") //
Expand Down

0 comments on commit 4b2ca6d

Please sign in to comment.