Add a code formatting tool chain
- (auto-)format code with:
+ autoflake => * remove unused imports and variables
* remove duplicate dict keys
* expand star imports
+ black => enforce an uncompromising code style
+ isort => enforce a consistent import style
(complying with Google's Python Style Guide)
- implement the nox session "format" that runs all these tools
- add the following file:
+ setup.cfg => holds configurations for the develop tools
This commit is contained in:
parent
6754f04fcd
commit
bb6de05709
4 changed files with 240 additions and 2 deletions
26
setup.cfg
Normal file
26
setup.cfg
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[black]
|
||||
# black's settings are in pyproject.toml => [tool.black]
|
||||
|
||||
|
||||
[isort]
|
||||
atomic = true
|
||||
case_sensitive = true
|
||||
combine_star = true
|
||||
force_alphabetical_sort_within_sections = true
|
||||
lines_after_imports = 2
|
||||
remove_redundant_aliases = true
|
||||
|
||||
# Comply with black's style.
|
||||
# Source: https://github.com/psf/black/blob/master/docs/compatible_configs.md#isort
|
||||
ensure_newline_before_comments = true
|
||||
force_grid_wrap = 0
|
||||
include_trailing_comma = true
|
||||
line_length = 88
|
||||
multi_line_output = 3
|
||||
use_parentheses = true
|
||||
|
||||
# Comply with Google's Python Style Guide.
|
||||
# All imports go on a single line except the ones from the typing module.
|
||||
# Source: https://google.github.io/styleguide/pyguide.html#313-imports-formatting
|
||||
force_single_line = true
|
||||
single_line_exclusions = typing
|
||||
Loading…
Add table
Add a link
Reference in a new issue