Skip to content

Add Workflow For Fixing Typos And Fix Existing Typos#707

Open
O957 wants to merge 2 commits into
fbi-cde:masterfrom
O957:o957_add_workflow_for_spell_checking_and_fix_typos
Open

Add Workflow For Fixing Typos And Fix Existing Typos#707
O957 wants to merge 2 commits into
fbi-cde:masterfrom
O957:o957_add_workflow_for_spell_checking_and_fix_typos

Conversation

@O957

@O957 O957 commented Nov 16, 2025

Copy link
Copy Markdown

This PR:

  • Fixes multiple spelling errors found in crime-data-api.
  • Adds a workflow called fix-typos.yaml to ./.github/workflows that runs in pulls requests and checks for common spelling mistakes.
  • Adds the pre-commit hook for typos in the .pre-commit-config.yaml file, along with a workflow file for pre-commit to run in PRs1.
  • Adds a configuration file (_typos.yaml), which can be used for false positives, for the typos workflow.

Context: Most individuals would prefer their repositories to be free of mispellings. One tool that I found works well for this is crate-ci's repository typos (written in Rust), which can be employed either as a pre-commit hook, which shows the mispellings before commits are pushed, or as a GitHub workflow, which displays the found mispellings in a PR. Sometimes there are false positives; these are classified in the _typos.toml configuration file under "[default.extend-words]". I've added the pre-commit hook version (along with the workflow file for pre-commit to run in PRs) and workflow version (see fix-typos.yaml in .github/workflows) of typos (which would not require pre-commit) for you to select between; I have also added the configuration file _typos.toml. There were several false positives which I excluded via the configuration file. My personal preference would be to use the pre-commit version, but I understand if you want this repository to be free of pre-commit, so I've added the workflow fix-typos.yaml.

Example Error Found Using Typos In Pre-Commit (Locally) Screenshot 2025-11-16 at 01 21 49
Full Errors Found After Removing False Positives In Pre-Commit
typos....................................................................Failed
- hook id: typos
- exit code: 2

error: `nimber` should be `number`
  --> api_support_notes.md:98:20
   |
98 | records, the total nimber of pages might be less or more than the
   |                    ^^^^^^
   |
error: `Formater` should be `Formatter`
  --> crime_data/common/marshmallow_schemas.py:17:13
   |
17 | class SchemaFormater(object):
   |             ^^^^^^^^
   |
error: `Formater` should be `Formatter`
  --> crime_data/common/marshmallow_schemas.py:587:47
    |
587 | class NibrsVictimSchema(ma.ModelSchema, SchemaFormater):
    |                                               ^^^^^^^^
    |
error: `Formater` should be `Formatter`
  --> crime_data/common/marshmallow_schemas.py:608:49
    |
608 | class NibrsArresteeSchema(ma.ModelSchema, SchemaFormater):
    |                                                 ^^^^^^^^
    |
error: `Formater` should be `Formatter`
  --> crime_data/common/marshmallow_schemas.py:636:49
    |
636 | class NibrsOffenderSchema(ma.ModelSchema, SchemaFormater):
    |                                                 ^^^^^^^^
    |
error: `Distrubution` should be `Distribution`
  --> crime_data/common/cdemodels.py:2156:47
     |
2156 |     A method to find Leoka Assault Assignment Distrubution
     |                                               ^^^^^^^^^^^^
     |
error: `Distrubution` should be `Distribution`
  --> crime_data/common/cdemodels.py:2176:56
     |
2176 |     Represents Regional Level Leoka Assault Assignment Distrubution
     |                                                        ^^^^^^^^^^^^
     |
error: `Distrubution` should be `Distribution`
  --> crime_data/common/cdemodels.py:2205:57
     |
2205 |     """Represents State Level LLeoka Assault Assignment Distrubution"""
     |                                                         ^^^^^^^^^^^^
     |
error: `Distrubution` should be `Distribution`
  --> crime_data/common/cdemodels.py:2232:57
     |
2232 |     """Represents Agency Level Leoka Assault Assignment Distrubution"""
     |                                                         ^^^^^^^^^^^^
     |
error: `Distrubution` should be `Distribution`
  --> crime_data/common/cdemodels.py:2297:57
     |
2297 |     """Represents State Level LLeoka Assault Assignment Distrubution"""
     |                                                         ^^^^^^^^^^^^
     |
error: `Distrubution` should be `Distribution`
  --> crime_data/common/cdemodels.py:2319:57
     |
2319 |     """Represents Agency Level Leoka Assault Assignment Distrubution"""
     |                                                         ^^^^^^^^^^^^
     |
error: `occured` should be `occurred`
  --> crime_data/templates/500.html:9:27
  |
9 |     <p>A server error has occured.</p>
  |                           ^^^^^^^
  |
error: `appropiate` should be `appropriate`
  --> crime_data/common/base.py:335:22
    |
335 |         # or use the appropiate escape function from your db driver
    |                      ^^^^^^^^^^
    |
error: `Marshmalow` should be `Marshmallow`
  --> crime_data/common/base.py:463:49
    |
463 |         `parsed` is automatically filled by the Marshmalow schema.
    |                                                 ^^^^^^^^^^
    |
error: `relatiopnship` should be `relationship`
  --> crime_data/resources/nibrs_counts.py:66:68
   |
66 |             creator = munger.UIComponentCreator(query.all(),'nibrs_relatiopnship','')
   |                                                                    ^^^^^^^^^^^^^
   |
Example Typos Configuration File
[default]
extend-ignore-identifiers-re = [
    "AttributeID.*Supress.*",
]

[default.extend-identifiers]
AttributeIDSupressMenu = "AttributeIDSupressMenu"

[default.extend-words]
# words that should not be corrected
ND = "ND"
GAM = "GAM"
OT = "OT"
BA = "BA"
HOM = "HOM"
ser = "ser"
comparitor = "comparitor"
AFE = "AFE"
ANC = "ANC"


[files]
extend-exclude = [
    ".gitignore",
    ".pre-commit-config.yaml",
    "*.sql",
    "*.json",
    "*.csv",
    "*.html"
]

Note

Thank you for making and maintaining this repository!

Footnotes

  1. Remember to run pre-commit install before doing pre-commit run --all-files for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant