TypoChecker is a tool for scanning source code files for common typographical errors. The tool checks through text-based files in a given repository to identify and suggest corrections for any matches found.
- Automatic typo detection: Scan through files in a repository for known typos.
- Support for multiple file types: It checks various source code and text file extensions.
- Colorized output: Provides color-coded feedback for easier identification of typos.
- Customization: Allows you to exclude certain files or skip specific typos.
To install the TypoChecker gem, you can install it directly using gem install
.
Run the following command in your terminal to install the gem globally:
gem install typo_checker
Once installed, you can use TypoChecker in your Ruby project to scan a directory (or the current directory by default) for typos.
# typo_checker scan /path/repo
typo_checker scan . # current repo
typo_checker scan . --excludes node_modules .git # or typo_checker scan . -e node_modules .git
typo_checker scan . --excludes node_modules .git --skips rspec defs # or typo_checker scan . -e node_modules .git -s rspec defs
When a typo is found, the tool prints out the following information in a colorized format:
- File path and line number in light blue.
- Incorrect word in red.
- Suggested correction in green.
Example output:
Typo found in /path/to/file.rb:10:15: myFuncton -> myFunction
TypoChecker supports the following file types by default:
- .rb (Ruby)
- .txt (Text)
- .md (Markdown)
- .html (HTML)
- .css (CSS)
- .js (JavaScript)
- .py (Python)
- .java (Java)
- .php (PHP)
- .go (Go)
- .swift (Swift)
- .ts (TypeScript)
- .scala (Scala)
- .c (C)
- .cpp (C++)
- .csharp (C#)
- .h (C Header)
- .lua (Lua)
- .pl (Perl)
- .rs (Rust)
- .kt (Kotlin)
- .sh, .bash, .bat (Shell Scripts)
- .json (JSON)
- .yaml (YAML)
- .xml (XML)
- .scss (Sass/SCSS)
- .tsv (Tab-separated values)
- .ps1 (PowerShell)
- .clj (Clojure)
- .elixir (Elixir)
- .f# (F#)
- .vhdl, .verilog (Hardware description languages)
- .ada (Ada)
- .ml (OCaml)
- .lisp (Lisp)
- .prolog (Prolog)
- .tcl (Tcl)
- .rexx (Rexx)
- .awk (AWK)
- .sed (Sed)
- .coffee (CoffeeScript)
- .groovy (Groovy)
- .dart (Dart)
- .haxe (Haxe)
- .zig (Zig)
- .nim (Nim)
- .crystal (Crystal)
- .reason (Reason)
- .ocaml (OCaml)
- .forth (Forth)
- .v (V)
- .xhtml (XHTML)
- .julia (Julia)
- .racket (Racket)
- .scheme (Scheme)
- .rust (Rust)
- .graphql (GraphQL)
We welcome contributions to this project! To contribute:
- Fork the repository.
- Create a new feature branch (git checkout -b your-feature).
- Commit your changes (git commit -am 'Add some feature').
- Push the changes to your fork (git push origin your-feature).
- Open a pull request.
- Tran Dang Duc Dat (datpmt)
The gem is available as open source under the terms of the MIT License.