From 6dbdb26b35a886265f154811373a18707c9a64ac Mon Sep 17 00:00:00 2001 From: Fedor Ivanov Date: Wed, 6 Nov 2024 15:59:09 +0300 Subject: [PATCH] refactor: cspell configuration (#11146) * fix: cspell ignore weird IPFS url * fix: cspell ignore filecoin f410f addresses * chore: write ignore in single line * feat: configure everything in `cspell.json` * refactor: remove unnecessary cspell ignores * refactor: cspell run command in actions and devcontainer * chore: enable editor support * chore: add comment * fix: cspell action options * feat: run for all files --- .devcontainer/bin/bs | 2 +- .github/workflows/config.yml | 6 ++---- .../block_scout_web/views/nft_helper_test.exs | 1 + ...31151_drop_logs_address_hash_foreign_key.exs | 1 - ...ers_and_transactions_address_foreign_key.exs | 1 - ...20230817061317_drop_address_foreign_keys.exs | 1 - ...821120625_drop_rest_address_foreign_keys.exs | 1 - ...urrent_token_balances_tokens_foreign_key.exs | 1 - ...9_drop_token_balances_tokens_foreign_key.exs | 1 - cspell.json | 17 ++++++++++++++++- 10 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.devcontainer/bin/bs b/.devcontainer/bin/bs index da9790bb47..5a6e9a5121 100755 --- a/.devcontainer/bin/bs +++ b/.devcontainer/bin/bs @@ -146,7 +146,7 @@ recompile() { # Define the spellcheck subroutine spellcheck() { - cspell --config cspell.json "**/*.ex*" "**/*.eex" "**/*.js" --gitignore | less + cspell | less } # Define the dialyzer subroutine diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml index 830d9c42ac..85c1efdcb2 100644 --- a/.github/workflows/config.yml +++ b/.github/workflows/config.yml @@ -366,10 +366,8 @@ jobs: - name: Run cspell uses: streetsidesoftware/cspell-action@v6 with: - files: | - **/*.ex* - **/*.eex - **/*.js" + use_cspell_files: true + incremental_files_only: false eslint: name: ESLint diff --git a/apps/block_scout_web/test/block_scout_web/views/nft_helper_test.exs b/apps/block_scout_web/test/block_scout_web/views/nft_helper_test.exs index 41f3ebbe02..3312ae4fe1 100644 --- a/apps/block_scout_web/test/block_scout_web/views/nft_helper_test.exs +++ b/apps/block_scout_web/test/block_scout_web/views/nft_helper_test.exs @@ -12,6 +12,7 @@ defmodule BlockScoutWeb.NFTHelperTest do end test "transforms ipfs link like ipfs://ipfs" do + # cspell:disable-next-line url = "ipfs://ipfs/Qmbgk4Ps5kiVdeYCHufMFgqzWLFuovFRtenY5P8m9vr9XW/animation.mp4" assert "https://ipfs.io/ipfs/Qmbgk4Ps5kiVdeYCHufMFgqzWLFuovFRtenY5P8m9vr9XW/animation.mp4" == diff --git a/apps/explorer/priv/repo/migrations/20230815131151_drop_logs_address_hash_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230815131151_drop_logs_address_hash_foreign_key.exs index e847cb14d7..350c8a3a85 100644 --- a/apps/explorer/priv/repo/migrations/20230815131151_drop_logs_address_hash_foreign_key.exs +++ b/apps/explorer/priv/repo/migrations/20230815131151_drop_logs_address_hash_foreign_key.exs @@ -1,4 +1,3 @@ -# cspell:ignore fkey defmodule Explorer.Repo.Migrations.DropLogsAddressHashForeignKey do use Ecto.Migration diff --git a/apps/explorer/priv/repo/migrations/20230816061723_drop_token_transfers_and_transactions_address_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230816061723_drop_token_transfers_and_transactions_address_foreign_key.exs index 1cfe0a5fb3..f5a1ef465f 100644 --- a/apps/explorer/priv/repo/migrations/20230816061723_drop_token_transfers_and_transactions_address_foreign_key.exs +++ b/apps/explorer/priv/repo/migrations/20230816061723_drop_token_transfers_and_transactions_address_foreign_key.exs @@ -1,4 +1,3 @@ -# cspell:ignore fkey defmodule Explorer.Repo.Migrations.DropTokenTransfersAndTransactionsAddressForeignKey do use Ecto.Migration diff --git a/apps/explorer/priv/repo/migrations/20230817061317_drop_address_foreign_keys.exs b/apps/explorer/priv/repo/migrations/20230817061317_drop_address_foreign_keys.exs index f10c301b76..275e7172aa 100644 --- a/apps/explorer/priv/repo/migrations/20230817061317_drop_address_foreign_keys.exs +++ b/apps/explorer/priv/repo/migrations/20230817061317_drop_address_foreign_keys.exs @@ -1,4 +1,3 @@ -# cspell:ignore fkey defmodule Explorer.Repo.Migrations.DropAddressForeignKeys do use Ecto.Migration diff --git a/apps/explorer/priv/repo/migrations/20230821120625_drop_rest_address_foreign_keys.exs b/apps/explorer/priv/repo/migrations/20230821120625_drop_rest_address_foreign_keys.exs index 36cdd2353f..05d0afa05c 100644 --- a/apps/explorer/priv/repo/migrations/20230821120625_drop_rest_address_foreign_keys.exs +++ b/apps/explorer/priv/repo/migrations/20230821120625_drop_rest_address_foreign_keys.exs @@ -1,4 +1,3 @@ -# cspell:ignore fkey defmodule Explorer.Repo.Migrations.DropRestAddressForeignKeys do use Ecto.Migration diff --git a/apps/explorer/priv/repo/migrations/20230831122819_drop_current_token_balances_tokens_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230831122819_drop_current_token_balances_tokens_foreign_key.exs index 3befa9600c..49f45e654f 100644 --- a/apps/explorer/priv/repo/migrations/20230831122819_drop_current_token_balances_tokens_foreign_key.exs +++ b/apps/explorer/priv/repo/migrations/20230831122819_drop_current_token_balances_tokens_foreign_key.exs @@ -1,4 +1,3 @@ -# cspell:ignore fkey defmodule Explorer.Repo.Migrations.DropCurrentTokenBalancesTokensForeignKey do use Ecto.Migration diff --git a/apps/explorer/priv/repo/migrations/20230905085809_drop_token_balances_tokens_foreign_key.exs b/apps/explorer/priv/repo/migrations/20230905085809_drop_token_balances_tokens_foreign_key.exs index 265933ff4c..6af0d319b4 100644 --- a/apps/explorer/priv/repo/migrations/20230905085809_drop_token_balances_tokens_foreign_key.exs +++ b/apps/explorer/priv/repo/migrations/20230905085809_drop_token_balances_tokens_foreign_key.exs @@ -1,4 +1,3 @@ -# cspell:ignore fkey defmodule Explorer.Repo.Migrations.DropTokenBalancesTokensForeignKey do use Ecto.Migration diff --git a/cspell.json b/cspell.json index 55cd21f2d1..67dec66b99 100644 --- a/cspell.json +++ b/cspell.json @@ -1,13 +1,28 @@ // cSpell Settings { + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", // Version of the setting file. Always 0.2 "version": "0.2", // language - current active spelling language "language": "en", + // enabled - enable code editor suggestions + "enabled": true, + // files - glob patterns of files to be checked + "files": [ + "**/*.ex*", + "**/*.eex", + "**/*.js" + ], + // useGitignore - use .gitignore to exclude files from checking + "useGitignore": true, // words - list of words to be always considered correct "ignorePaths": [ "apps/block_scout_web/assets/js/lib/ace/src-min/*.js" ], + "ignoreRegExpList": [ + // Ignore filecoin f410f-like native addresses + "f410f[a-z2-7]{39}" + ], "words": [ "aave", "absname", @@ -653,5 +668,5 @@ "dotenv", "html-eex", "makefile" - ] + ], }