Plugins and hooks¶
We leverage all the existing
There are different integrations for your workflow.
If you want to keep absolute control over the installed plugins, and prevent wemake-python-styleguide to install its dependencies, you can install a lighter fork, wps-light, which behaves the same but doesn’t depend on any flake8 plugin.
There are a lot of specific plugins that are not included, because they are, well, specific:
Hooks are 3rd-party apps and services
flake8 on different occasions:
pytest-flake8 to run style checks alongside with tests
pre-commit to run
flake8before all commits locally
Note that since the default
pre-commitdoes not have
wemakeplugin, we have to ask
pre-committo run local
flake8that is installed via
wemake. A sample config for
repos: - repo: local hooks: - id: flake8 name: flake8 description: wemake-python-styleguide enforcement entry: flake8 args: ["--config=setup.cfg"] language: python types: [python]
pronto-flake8 to post inline-comments with violations during code-review inside your CI
Directly modify git pre-commit hook without third party app or service.
<your_local_repo>/.git/hooks/pre-commit.sample(git runs this script after one calls
git commit. If this script exits with code 1, commit would fail)
Add the following code before the one checking for whitespace errors.
# Your added code to run wemake-python-styleguide. Add this before # the whitespace error lines flake8 . if [ $? -ne 0 ] then echo "Please fix the ERRORS and commit again." exit 1 fi # If there are whitespace errors, print the offending file names and fail. exec git diff-index --check --cached $against --
Save and rename the file from