From c528b0f86610b0dce732024fd24d5093a50a6cee Mon Sep 17 00:00:00 2001 From: syeopite Date: Fri, 6 Jun 2025 18:43:08 -0700 Subject: [PATCH] Add CI job to check typos --- .ameba.yml | 4 ++++ .github/workflows/ci.yml | 9 +++++++++ .typos.toml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 .typos.toml diff --git a/.ameba.yml b/.ameba.yml index 36d7c48f..efca983e 100644 --- a/.ameba.yml +++ b/.ameba.yml @@ -20,6 +20,10 @@ Lint/ShadowingOuterLocalVar: Excluded: - src/invidious/helpers/tokens.cr +# CI has a separate job to check for typos +Lint/Typos: + Enabled: false + Lint/NotNil: Enabled: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d6a930a..3efdaf7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,3 +165,12 @@ jobs: - name: Run Ameba linter run: bin/ameba + + lint_spell: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Spell Check Repo + uses: crate-ci/typos@v1.33.1 diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 00000000..a6c8271e --- /dev/null +++ b/.typos.toml @@ -0,0 +1,30 @@ +[default] + extend-ignore-re = [ + # Exclude various hard-coded YouTube IDs + "\\b[0-9A-z+/\\-_]{100,}((=|%3D){1,2})?\\b", + "\\b4qm.*(%3D{1,2})?\\b", + "UC[A-z0-9\\-]*\\b", + "EgI[A-z0-9\\-]{7}(%3D{1,2})", + + # Ignore gsub regex + "gsub\\(?/.*/,?", + + # TEST_IDs constant def + "TEST_IDS *= *\\{.*\\}", + + # Ignore two-letter region strings + "(\\b|\")[a-zA-Z]{2}(\\b|\")," + ] + +[default.extend-identifiers] + clen = "clen" + +[files] + extend-exclude = [ + "/assets/js/videojs-youtube-annotations.min.js", + "/assets/videojs/**/*", + "/assets/fonts/ionicons.svg", + "/mocks/**/*.json", + "locales/*.json", + "CHANGELOG_legacy.md", + ]