Skip to content

hhru/pystolint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔫 pystolint 🔫

Yet another python linter?

No. It's just a runner for ruff + mypy with these settings

Why?

I'm fed up with:

  1. Having to copy settings for every single project. (at least until "parent pyproject.toml" is not invented)
  2. Not being able to apply checks only to git diffs, which makes it hard to add linters to large projects
  3. Not being able to deprecate certain things and preventing them in new code.

Install

Simple:

  • pip install pystolint

or

Dev:

  1. Clone repo
git clone [email protected]:hhru/pystolint.git ~/projects/pystolint
cd ~/projects/pystolint
python -m venv .venv
source .venv/bin/activate
pip install -e .
  1. Create global shortcut (/usr/local/bin/pys):
  #!/path/to/your/pystolint/.venv/bin/python
  import sys
  from pystolint.main import main

  if __name__ == '__main__':
    sys.exit(main())
  1. Make executable:
chmod +x /usr/local/bin/pys

Usage

Check code:

pys check .
pys check path1 path2
pys check --diff

Format code:

pys format .
pys format path1 path2

Tools

You can use specific tool for checking/formatting:

pys check --tool mypy .

This will run mypy only. Be aware that mypy requires pydantic as a project dependency by default. You can disable this requirement by editing tool.mypy.plugins in pyproject.toml or add extra 'pydantic' to pystolint dependency.

Settings

Can be specified from cli or pyproject.toml. Cli settings have bigger priority

example toml:

[tool.pystolint]
base_toml_path = "/path/to/shared/config.toml"
base_branch_name = "develop"

cli:

  • --base_toml_path - path or link for replace pystolint default settings
  • --base_branch_name - branch name from which to get diff (default is master)
  • --config - specify path to local toml configs (default is pyproject.toml in current dir)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages