{"id":16737510,"url":"https://github.com/robotdana/spellr","last_synced_at":"2025-10-12T09:33:23.246Z","repository":{"id":35099779,"uuid":"171970043","full_name":"robotdana/spellr","owner":"robotdana","description":"Spell check your source code","archived":false,"fork":false,"pushed_at":"2025-01-26T04:51:33.000Z","size":1391,"stargazers_count":37,"open_issues_count":18,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T09:33:22.563Z","etag":null,"topics":["source-code-spell-check","spell-checker","spell-checking","spelling"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robotdana.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-22T01:03:44.000Z","updated_at":"2025-06-24T04:13:23.000Z","dependencies_parsed_at":"2024-06-21T17:54:15.479Z","dependency_job_id":"a63eabcb-c643-402b-a57b-ccf49e9827f4","html_url":"https://github.com/robotdana/spellr","commit_stats":{"total_commits":236,"total_committers":1,"mean_commits":236.0,"dds":0.0,"last_synced_commit":"ecd9f86a2c36cce05276af3aa7a91175346330c0"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/robotdana/spellr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdana%2Fspellr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdana%2Fspellr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdana%2Fspellr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdana%2Fspellr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robotdana","download_url":"https://codeload.github.com/robotdana/spellr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdana%2Fspellr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010936,"owners_count":26084837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["source-code-spell-check","spell-checker","spell-checking","spelling"],"created_at":"2024-10-13T00:26:45.371Z","updated_at":"2025-10-12T09:33:23.225Z","avatar_url":"https://github.com/robotdana.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spellr\n\n[![Build Status](https://travis-ci.com/robotdana/spellr.svg?branch=main)](https://travis-ci.com/robotdana/spellr)\n[![Gem Version](https://badge.fury.io/rb/spellr.svg)](https://rubygems.org/gems/spellr)\n\nSpell check your source code for fun and occasionally finding bugs\n\nThis is inspired by https://github.com/myint/scspell, and uses wordlists from [SCOWL](http://wordlist.aspell.net) and [MDN](http://wiki.developer.mozilla.org/).\n\n## What makes a spell checker a source code spell checker?\n\n1. It tokenizes CamelCase and snake_case and kebab-case and checks these as independent words including CAMELCase with acronyms.\n2. It skips urls\n3. It skips things that heuristically look like base64 or hex strings rather than words. This uses a bayesian classifier and is not magic. Find the balance of false-positive to false-negative that works for you with the `key_heuristic_weight` [configuration](#configuration) option.\n4. It comes with some wordlists for built in commands in some common programming languages, and recognizes hashbangs.\n5. Configure whether you want US, AU, CA, or GB english (or all of them).\n6. It checks directories recursively, obeying .gitignore\n7. It's easy to add terms to wordlists\n8. It's easy to integrate with CI pipelines\n7. It's very configurable\n\n## A brief aside on \"correct\" spelling.\n\nThere's no correct way to spell anything. You can't trust dictionaries, they only react to the way everyone else uses words. Any agreement about certain spellings is a collective hallucination, and is a terrible proxy for attention or intelligence or education or value. Those who get to declare what \"correct\" spelling is, or even what counts as a real word, tend to be those groups that have more social power and it's (sometimes unconsciously) used as a way to maintain that power.\n\nHowever, in a programming context spelling things _consistently_ is useful, where method definitions must match method calls, and comments about these are clearer when also matching. It also makes grepping easier, not that you'd find the word 'grepping' in most dictionaries.\n\n## Installation\n\nThis is tested against ruby 2.6-3.4.\n\n### With Bundler\n\nAdd this line to your application's `Gemfile`:\n\n```ruby\ngem 'spellr', require: false\n```\n\nThen execute:\n\n```bash\n$ bundle install\n```\n\n### With Rubygems\n\n```bash\n$ gem install spellr\n```\n\n### With Docker\n\nexecute this command instead of `spellr`. This is otherwise identical to using the gem version\n\n```bash\n$ docker run -it -v $PWD:/app robotdana/spellr\n```\n\n## Usage\n\nThe main way to interact with `spellr` is through the executable.\n\n```bash\n$ spellr # will run the spell checker\n$ spellr --interactive # will run the spell checker, interactively\n$ spellr --wordlist # will output all words that fail the spell checker in spellr wordlist format\n$ spellr --quiet # will suppress all output\n$ spellr --autocorrect # for if you're feeling lucky\n```\n\nTo check a single file or subset of files, just add paths or globs:\n```bash\n$ spellr --interactive path/to/my/file.txt and/another/file.sh\n$ spellr --wordlist '*.rb' '*_test.js'\n```\n\nThere are some support commands available:\n\n```bash\n$ spellr --dry-run # list files that will be checked\n$ spellr --version # for the current version\n$ spellr --help # for the list of flags available\n```\n\n### First run\n\nFeel free to just `spellr --interactive` and go, but I prefer this process when first adding spellr to a large project.\n\n```bash\n$ spellr --dry-run\n```\n\nLook at the list of files, are there some that shouldn't be checked (generated files etc)? .gitignored files and some binary file extensions are already skipped by default.\n\nAdd any additional files to ignore to a `.spellr.yml` file in your project root directory.\n```yml\nexcludes:\n  - ignore\n  - /generated\n  - \"!files\"\n  - in/*\n  - .gitignore\n  - \"*.format\"\n```\n\nThen output the existing words that fail the default dictionaries.\n```bash\n$ spellr --wordlist \u003e .spellr-wordlists/english.txt\n```\n\nOpen `.spellr-wordlists/english.txt` and remove those lines that look like typos or mistakes, leaving the file in ascii order.\n\nNow it's time to run the interactive spell checker\n\n```bash\n$ spellr --interactive\n```\n\n### Interactive spell checking\n\nTo start an interactive spell checking session:\n```bash\n$ spellr --interactive\n```\n\nYou'll be shown each word that's not found in a dictionary, it's location (path:line:column), along with suggestions, and a prompt.\n```\nfile.rb:1:0 notaword\nDid you mean: [1] notwork, [2] nonword\n[a]dd, [r]eplace, [s]kip, [h]elp, [^C] to exit: [ ]\n```\n\nType `h` for this list of what each letter command does\n```\n[1]...[2] Replace notaword with the numbered suggestion\n[a] Add notaword to a word list\n[r] Replace notaword\n[R] Replace this and all future instances of notaword\n[s] Skip notaword\n[S] Skip this and all future instances of notaword\n[h] Show this help\n[ctrl] + [C] Exit spellr\n\nWhat do you want to do? [ ]\n```\n\n---\n\nIf you type a numeral the word will be replaced with that numbered suggestion\n```\nfile.txt:1:0 notaword\nDid you mean: [1] notwork, [2] nonword\n[a]dd, [r]eplace, [s]kip, [h]elp, [^C] to exit: [2]\nReplaced notaword with nonword\n```\n\n---\n\nIf you type `r` or `R` you'll be shown a prompt with the original word and it prefilled ready for correcting:\n```\nfile.txt:1:0 notaword\nDid you mean: [1] notwork, [2] nonword\n[a]dd, [r]eplace, [s]kip, [h]elp, [^C] to exit: [r]\n\n  [^C] to go back\n  Replace notaword with: notaword\n```\nTo submit your choice and continue with the spell checking click enter. Your replacement word will be immediately spellchecked. To instead go back press Ctrl-C once (pressing it twice will exit the spell checking).\n\nLowercase `r` will correct this particular use of the word, uppercase `R` will also all the future times that word is used.\n\n---\n\nIf you instead type `s` or `S` it will skip this word and continue with the spell checking.\n\nLowercase `s` will skip this particular use of the word, uppercase `S` will also skip future uses of the word.\n\n---\n\nIf you instead type `a` you'll be shown a list of possible wordlists to add to. This list is based on the file path, and is configurable in `.spellr.yml`.\n```\nfile.txt:1:0 notaword\nDid you mean: [1] notwork, [2] nonword\n[a]dd, [r]eplace, [s]kip, [h]elp, [^C] to exit: [a]\n\n  [e] english\n  [^C] to go back\n  Add notaword to which wordlist? [ ]\n```\nType `e` to add this word to the english wordlist and continue on through the spell checking. To instead go back to the prompt press Ctrl-C once (pressing it twice will exit the spell checking).\n\n### Disabling the tokenizer\n\nIf the tokenizer finds a word you don't want to add to the wordlist (perhaps it's an intentional example of a typo, or a non-word string not excluded by the heuristic) then add any kind of comment containing `spellr:disable-line` to the line.\n```ruby\nopen('mispeled_filename.txt') # spellr:disable-line\n```\n\nYou can also disable multiple lines, by surrounding the offending code with `spellr:disable` and `spellr:enable`\n```ruby\n# spellr:disable\nit \"Test typo of the: teh\" do\n  fill_in(field, with: \"teh\")\nend\n# spellr:enable\n```\n\nIf your language supports inline comments you can also surround with `spellr:disable` and `spellr:enable` in the same line:\n```html\n\u003cspan\u003e\u003c!-- spellr:disable --\u003enonsenseword\u003c!-- spellr:enable --\u003e\u003c/span\u003e\n```\n## Configuration\n\nSpellr's configuration is a `.spellr.yml` file in your project root. This is combined with the gem defaults defined [here](https://github.com/robotdana/spellr/blob/main/lib/.spellr.yml).\nThere are top-level keys and per-language keys.\n```yml\nword_minimum_length: 3 # any words shorter than this will be ignored\nkey_minimum_length: 6 # any strings shorter than this won't be considered non-word strings\nkey_heuristic_weight: 5 # higher values mean strings are more likely to be considered words or non-words by the classifier.\nexcludes:\n  - ignore\n  - \"!files\"\n  - in/*\n  - .gitignore\n  - \"*.format\"\nincludes:\n  - limit to\n  - \"files*\"\n  - in/*\n  - .gitignore-esque\n  - \"*.format\"\n```\nThe includes format is documented [here](https://github.com/robotdana/fast_ignore#using-an-includes-list).\n\nAlso within this file are language definitions:\n```yml\nlanguages:\n  english: # this must match exactly the name of the file in .spellr-wordlists/\n    locale: # US, AU, CA, or GB\n      - US\n      - AU\n  ruby:\n    includes:\n      - patterns*\n      - \"*_here.rb\"\n      - limit-which-files\n      - the/wordlist/**/*\n      - /applies_to/\n    key: r # this is the letter used to choose this wordlist when using `spellr --interactive`.\n    hashbangs:\n      - ruby # if the file has no extension and the hashbang/shebang contains ruby\n             # this file will match even if it doesn't otherwise match the includes pattern.\n```\n\nIf you want a file to have a file-specific wordlist:\ne.g. for terms specific to logstash:\n```yml\nlanguages:\n  logstash: # this can be anything\n    includes:\n      - path/to/logstash/file\n```\n\n## Rake\n\nCreate or open a file in the root of your project named `Rakefile`.\nadding the following lines\n```ruby\n# Rakefile\nrequire 'spellr/rake_task'\nSpellr::RakeTask.generate_task\n```\n\nThis will add the `rake spellr` task. To provide arguments like the cli, use square brackets. (ensure you escape the `[]` if you're using zsh)\n`rake 'spellr[--interactive]'`\n\nTo provide default cli arguments, the first argument is the name, and subsequent arguments are the cli arguments.\n```ruby\n# Rakefile\nrequire 'spellr/rake_task'\nSpellr::RakeTask.generate_task(:spellr_quiet, '--quiet')\n\ntask default: :spellr_quiet\n```\nor `rake spellr` will be in interactive mode unless the CI env variable is set.\n```ruby\n# Rakefile\nrequire 'spellr/rake_task'\nspellr_arguments = ENV['CI'] ? [] : ['--interactive']\nSpellr::RakeTask.generate_task(:spellr, **spellr_arguments)\n\ntask default: :spellr\n```\n\n## Travis\n\nTo have this automatically run on travis, add `:spellr` to the default rake task.\n```ruby\n# Rakefile\nrequire 'spellr/rake_task'\nSpellr::RakeTask.generate_task\n\ntask default: :spellr\n```\nor if you already have :default task, add :spellr to the array.\n```ruby\nrequire 'spellr/rake_task'\nSpellr::RakeTask.generate_task\n\ntask default: [:spec, :spellr]\n```\nor etc.\n\nAlso follow the travis documentation to have travis run rake:\n```yml\n# .travis.yml\nsudo: false\nlanguage: ruby\ncache: bundler\nrvm:\n  - 3.0\nbefore_install: gem install bundler\n```\n\n## Ignoring the configured patterns\n\nSometimes you'll want to spell check something that would usually be ignored,\ne.g. `.git/COMMIT_EDITMSG` even though `spellr` ignores the `.git` directory.\n\nFor this you can use the `--suppress-file-rules` command line argument.\n```bash\n$ spellr --suppress-file-rules .git/COMMIT_EDITMSG\n```\n\n**Note: This still ignores files outside of the current directory**\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/robotdana/spellr.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\nWordlists packaged with this gem have their own licenses, see them in https://github.com/robotdana/spellr/tree/main/wordlists\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotdana%2Fspellr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobotdana%2Fspellr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotdana%2Fspellr/lists"}