Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Write your own linting rules using regular expressions.

License

NotificationsYou must be signed in to change notification settings

codingjoe/relint

Repository files navigation

/(re)lint/

reLint

Regular Expression Linter

Write your own linting rules using regular expressions.

PyPi VersionTest CoverageGitHub License

Installation

python3 -m pip install relint# or, if you have super advanced linting expressionspython3 -m pip install "relint[regex]"

Usage

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

pre-commit

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

Stars

Watchers

Forks

Sponsor this project

  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp