A set of code style tool settings to enforce them in other projects.
All code in the repo is open source and completely free. I don't need anything from you.
Just please put a star ⭐ if it was helpful to you. This motivates me to further develop this and other OpenSource projects.
First of all, I made this repository for myself. I'm tired of bringing tool settings into consistency code styles in different projects.
If you are also tired 😊, then use this repository as an example and modify it for yourself.
Follow these steps:
- Clone the repo to yourself or fork, then edit. Make it public or create a token, so that
nitpick
can download the settings. - The styles are in the
styleguide-configstyles
directory. Check them out and edit them for yourself. Documentationnitpick
by styles is here. - In your other projects:
- Install the
nitpick
library. I do it withpoetry
, including in thedev-dependencies
section, for example:
[tool.poetry.dev-dependencies] nitpick = "^0.32.0" pre-commit = "^2.20.0" isort = "^5.10.1" black = "^22.8.0" mypy = "0.931" wemake-python-styleguide = "^0.16.1" bandit = "^1.7.4"
- Add a
tool.nitpick
section topyproject.toml
:
[tool.nitpick] # Specify the address of your repo. If the repo is private, then specify with the token created in step 1. # The token can be passed through an environment variable so as not to shine in the code, see the documentation: # https://nitpick.readthedocs.io/en/latest/configuration.html#remote-style style = [ "https://gitlab.com/vkolupaev/styleguide-config/-/raw/main/styles/nitpick-style.toml", ] # For the duration of the active style setting, I recommend specifying `never`. Then delete. # Documentation on caching settings: https://nitpick.readthedocs.io/en/latest/configuration.html#remote-style cache = "never"
- Use the Command-line interface (CLI)
nitpick
to check and match against uniform settings.- CLI Documentation.
- Example:
nitpick check # check everything nitpick fix # fix everything nitpick check setup.cfg # check only the specified file nitpick fix setup.cfg # fix only the specified file
- Install the
If you are a Team Lead and you manage several projects, and you do not conduct code review 100% PullRequests (for example, delegate some of these tasks), then you can embed checking configuration files into the CI pipeline for compliance with the standard.
To do this, consult with your DevOps Engineer.
There are two options:
- Create an Issue and describe the situation:
- Please feel free to write to me. My contacts are listed below 👇.
Copyright 2022 Viacheslav Kolupaev.