Pre-commit¶
Pre-commit is great tool for catching bugs early and ensuring consistency across developers.
Msort can be used as part of a pre-commit workflow.
Steps¶
Install pre-commit
$ pip install pre-commit
Create a
.pre-commit-config.yamlfile
$ touch .pre-commit-config.yaml
Paste in the msort hook
- repo: https://github.com/isaacksdata/msort
rev: v0.1.8
hooks:
- id: msort
args: []
Initiate pre-commit
$ pre-commit init
Common amendments¶
- exclusion criteria
Files can be excluded using the
--skip-patternsoption
- repo: https://github.com/isaacksdata/msort
rev: v0.1.8
hooks:
- id: msort
args: ["--skip-patterns=test_", "--skip-patterns=_test.py"]
- personalised configurations
Msort in pre-commit can be configured by the user through CLI arguments or through a config file - see Configurations
- repo: https://github.com/isaacksdata/msort
rev: v0.1.8
hooks:
- id: msort
args: ["--config-path=./pyproject.toml"]