codelaw-rules-spell 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. codelaw_rules_spell/LICENSE +23 -0
  2. codelaw_rules_spell/NOTICE +45 -0
  3. codelaw_rules_spell/README.md +69 -0
  4. codelaw_rules_spell/codelaw-pack.toml +6 -0
  5. codelaw_rules_spell/corpus.toml +11 -0
  6. codelaw_rules_spell/data/spell/locale.json +1 -0
  7. codelaw_rules_spell/data/spell/typos.json +1 -0
  8. codelaw_rules_spell/data/spell/words.json +1 -0
  9. codelaw_rules_spell/licenses/SCOWL-Copyright.txt +248 -0
  10. codelaw_rules_spell/licenses/VarCon-Copyright.txt +57 -0
  11. codelaw_rules_spell/licenses/software-terms-MIT.txt +21 -0
  12. codelaw_rules_spell/presets/spell/recommended.toml +6 -0
  13. codelaw_rules_spell/presets/spell/strict.toml +7 -0
  14. codelaw_rules_spell/rules/spell/inconsistent-term.cases.md +74 -0
  15. codelaw_rules_spell/rules/spell/inconsistent-term.md +260 -0
  16. codelaw_rules_spell/rules/spell/known-typo-identifier.cases.md +103 -0
  17. codelaw_rules_spell/rules/spell/known-typo-identifier.md +134 -0
  18. codelaw_rules_spell/rules/spell/known-typo-key.cases.md +46 -0
  19. codelaw_rules_spell/rules/spell/known-typo-key.md +111 -0
  20. codelaw_rules_spell/rules/spell/known-typo.cases.md +133 -0
  21. codelaw_rules_spell/rules/spell/known-typo.md +207 -0
  22. codelaw_rules_spell/rules/spell/locale-variant.cases.md +50 -0
  23. codelaw_rules_spell/rules/spell/locale-variant.md +203 -0
  24. codelaw_rules_spell/rules/spell/suspicious-word.cases.md +24 -0
  25. codelaw_rules_spell/rules/spell/suspicious-word.md +41 -0
  26. codelaw_rules_spell/rules/spell/unknown-word.cases.md +37 -0
  27. codelaw_rules_spell/rules/spell/unknown-word.md +203 -0
  28. codelaw_rules_spell-0.3.0.dist-info/METADATA +79 -0
  29. codelaw_rules_spell-0.3.0.dist-info/RECORD +31 -0
  30. codelaw_rules_spell-0.3.0.dist-info/WHEEL +4 -0
  31. codelaw_rules_spell-0.3.0.dist-info/licenses/LICENSE +23 -0
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arpit Arya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ SPDX-License-Identifier: MIT
@@ -0,0 +1,45 @@
1
+ @codelaw/rules-spell / codelaw-rules-spell
2
+
3
+ The rules are codelaw's own (SR-SPELL). No code, word list, option or message
4
+ is taken from another spell checker, and no word comes from a published list
5
+ of common misspellings (SR-SPELL decision 6).
6
+
7
+ data/spell/ is generated by codelaw's scripts/spell-data.py from the three
8
+ sources below, and from no other (L11 §3, D-42, D-43 and D-44):
9
+
10
+ - typos.json holds variants of words, not the sources' lists: single-edit
11
+ misspellings of SCOWL's most common words, with the word each comes from;
12
+ - words.json is a dictionary: the words of SCOWL's English, American and
13
+ British lists of size 60 and below, in lower case, with the letters of the
14
+ software-terms list;
15
+ - locale.json holds VarCon's one-to-one American and British spelling pairs.
16
+
17
+ SCOWL (Spell Checker Oriented Word Lists), release 2020.12.07
18
+ (http://wordlist.aspell.net/, scowl-2020.12.07.tar.gz,
19
+ SHA-256 5587667caa20c4891390c2d42dbb4d5c4c3f41bee77af1457ece3ba23fb859cc) —
20
+ Copyright 2000-2018 by Kevin Atkinson, with the notices of the works it draws
21
+ on (12dicts, ENABLE, the Moby Words, Brian Kelk's word list, WordNet, the UK
22
+ Advanced Cryptics Dictionary — Copyright (c) J Ross Beresford 1993-1999 — and
23
+ VarCon, with the Ispell copyright of Geoff Kuenning). Permission to use, copy,
24
+ modify, distribute and sell is granted provided the copyright notices appear;
25
+ the full text, as published, is in licenses/SCOWL-Copyright.txt. The source
26
+ words are SCOWL's English, American and British word lists of size 20 and
27
+ below; the lists up to size 80, and its name, abbreviation and contraction
28
+ lists, decide what is a word.
29
+
30
+ @cspell/dict-software-terms 5.4.8 (https://github.com/streetsidesoftware/cspell-dicts,
31
+ dict-software-terms-5.4.8.tgz, SHA-256
32
+ 4ea4907a9d9a066d53efbd964b44a8712c34014b5e6c7a5cf605a6ff2d0f11a1) — the word
33
+ list dict/softwareTerms.txt.gz only, used to decide what is a word —
34
+ Copyright (c) 2017-2025 Street Side Software, released under the MIT License;
35
+ a copy is in licenses/software-terms-MIT.txt. Its corrections file
36
+ (cspell-corrections.yaml) is not read.
37
+
38
+ VarCon, release 2020.12.07 (http://wordlist.aspell.net/varcon.html,
39
+ varcon-2020.12.07.tar.gz, SHA-256
40
+ 3b0720c5718008f37c02658a83d51d5598dd86531f0a2206d410c854006cb184) —
41
+ Copyright 2000-2019 by Kevin Atkinson, Copyright 2016 by Benjamin Titze, and
42
+ the Ispell copyright of Geoff Kuenning (1993). Permission to use, copy,
43
+ modify, distribute and sell is granted provided the copyright notices
44
+ appear; the full text, as published in its README, is in
45
+ licenses/VarCon-Copyright.txt. Only varcon.txt is read.
@@ -0,0 +1,69 @@
1
+ # @codelaw/rules-spell
2
+
3
+ codelaw's spell checker — one of the first-party rule packs
4
+ ([SR-RULE-PACKS](../../records/0101_rule-packs.md)), on npm and PyPI
5
+ (`codelaw-rules-spell`). It reads the prose of every L3 language from the tree
6
+ the engine parsed: comments and docstrings, prose strings, Markdown and HTML
7
+ text, the string values of JSON, YAML and TOML, and the names a file
8
+ declares — identifiers, keys, classes and ids. It is codelaw's own
9
+ code and codelaw's own word data, generated from SCOWL
10
+ ([SR-SPELL](../../records/0116_spell.md)); it does not wrap CSpell.
11
+
12
+ `codelaw init` never adds it: a team installs it on purpose.
13
+
14
+ ```toml
15
+ # codelaw.toml
16
+ extends = ["codelaw:spell/recommended"]
17
+ preview = true # every rule is `preview` until a corpus run promotes it
18
+ ```
19
+
20
+ ```sh
21
+ npm i -D @codelaw/rules-spell # or
22
+ pip install codelaw-rules-spell
23
+ ```
24
+
25
+ ## Presets
26
+
27
+ <!-- docs-sync:presets -->
28
+
29
+ | preset | rules | ported from |
30
+ |---|---|---|
31
+ | `spell/recommended` | 3 | codelaw's own: known typos from a list generated from SCOWL, fixed unattended |
32
+ | `spell/strict` | 6 | `spell/recommended` plus the dictionary check, one spelling per word across the project and the `[spell] words` check |
33
+
34
+ <!-- /docs-sync:presets -->
35
+
36
+ ## Rules
37
+
38
+ <!-- docs-sync:rules -->
39
+
40
+ | rule | fix | flags |
41
+ |---|---|---|
42
+ | `spell/known-typo` | auto | a word on the known-typo list in a comment, a doc, a prose string or Markdown |
43
+ | `spell/known-typo-identifier` | auto | a known typo in a JS, TS or Python name where it is declared; renamed only when the name is provably file-local |
44
+ | `spell/known-typo-key` | manual | a known typo in a JSON, YAML or TOML key, a CSS or SCSS class, id or custom property, or an HTML `id` |
45
+ | `spell/unknown-word` | suggest | a word of prose in no word list; the nearest dictionary word as the edit, up to three named (`spell/strict`) |
46
+ | `spell/locale-variant` | auto | the other locale's spelling (`colour` under `en-US`), while `[spell] locale` is set (in no preset) |
47
+ | `spell/inconsistent-term` | suggest | one word spelled two ways across the project (`canceled` / `cancelled`); the spelling the project uses most as the edit (`spell/strict`, a project rule) |
48
+ | `spell/suspicious-word` | manual | a `[spell] words` entry that is a known typo or one edit from a common word (`spell/strict`) |
49
+
50
+ <!-- /docs-sync:rules -->
51
+
52
+ ## Config
53
+
54
+ ```toml
55
+ # codelaw.toml (the root config only)
56
+ [spell]
57
+ locale = "en-US" # or "en-GB"; spell/locale-variant reports the other one
58
+ words = ["kubectl", "Acme"] # accepted by every spell/* rule; spell/suspicious-word checks them
59
+
60
+ [rules]
61
+ "spell/locale-variant" = "warn"
62
+ ```
63
+
64
+ ## The word data
65
+
66
+ `data/spell/` is written by `scripts/spell-data.py` and committed; the same
67
+ sources write the same bytes: `typos.json` (188,138 generated known typos),
68
+ `words.json` (92,758 words: SCOWL's US and British English to size 60, and the
69
+ software terms) and `locale.json` (VarCon's one-to-one US and British pairs). Sources and their notices: [`NOTICE`](NOTICE).
@@ -0,0 +1,6 @@
1
+ name = "@codelaw/rules-spell"
2
+ version = "0.3.0"
3
+ min_codelaw = "0.2.0"
4
+ languages = ["javascript", "jsx", "typescript", "tsx", "python", "json", "yaml", "toml", "markdown", "css", "scss", "html"]
5
+ presets = ["spell/recommended", "spell/strict"]
6
+ description = "codelaw's spell checker: known typos fixed unattended, in every L3 language; word data generated from SCOWL (SR-SPELL)"
@@ -0,0 +1,11 @@
1
+ # `codelaw test --corpus` finding counts (SR-RULE-AUTHORING decision 4).
2
+ # Rewrite with --update-snapshot, and review the change.
3
+
4
+ [findings]
5
+ "spell/inconsistent-term" = 107
6
+ "spell/known-typo" = 125
7
+ "spell/known-typo-identifier" = 3
8
+ "spell/known-typo-key" = 1
9
+ "spell/locale-variant" = 0
10
+ "spell/suspicious-word" = 0
11
+ "spell/unknown-word" = 8948