Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork12
Write your own linting rules using regular expressions.
License
codingjoe/relint
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Regular Expression Linter
Write your own linting rules using regular expressions.
python3 -m pip install relint# or, if you have super advanced linting expressionspython3 -m pip install "relint[regex]"
You can write your own regular rules in a YAML file, like so:
-name:No ToDopattern:'(?i)todo'# case insensitive flaghint:Get it done right away!filePattern:.*\.(py|js)error:false
Thename
attribute is the name of your linter, thepattern
can beany regular expression. The linter does lint entire files, thereforeyour expressions can match multiple lines and include newlines.
You can narrow down the file types your linter should be working with,by providing the optionalfilePattern
attribute. The default is.*
.
The optionalerror
attribute allows you to only show a warning but notexit with a bad (non-zero) exit code. The default istrue
.
The following command will lint all files in the current directory:
relint -c .relint.yml FILE FILE2 ...
The default configuration file name is.relint.yml
within your workingdirectory, but you can provide any YAML or JSON file.
If you prefer linting changed files (cached on git) you can use theoption--diff [-d]
or--git-diff [-g]
:
git diff --unified=0| relint my_file.py --diff
You can automate the linting process by adding apre-commit hook to your project. Add thefollowing entry to your.pre-commit-config.yaml
:
-repo:https://github.com/codingjoe/relintrev:1.4.0hooks: -id:relintargs:[-W]# optional, if you want to fail on warnings during commit
About
Write your own linting rules using regular expressions.
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.