-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added black as code formatter #530
Changes from 4 commits
8500925
d86803c
8228880
6937a30
cdc75fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ jobs: | |
run: pip install cookiecutter | ||
|
||
- name: Bootstrap the project | ||
run: make | ||
run: make test |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ deps: | |
dev-deps: deps | ||
pip-compile --extra=dev --output-file=dev-requirements.txt pyproject.toml | ||
|
||
frmt: | ||
cd src && isort . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А разве isort не нужны какие-то параметры, чтобы он форматировал импорты без подтверждения от пользователя? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Не нужно |
||
cd src && black . | ||
|
||
lint: | ||
dotenv-linter src/app/.env.ci | ||
flake8 src | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,8 @@ dev = [ | |
"pytest-mock", | ||
"pytest-randomly", | ||
|
||
"black", | ||
|
||
"dotenv-linter", | ||
|
||
"freezegun", | ||
|
@@ -42,6 +44,7 @@ dev = [ | |
"jedi", | ||
"flake8-absolute-import", | ||
"flake8-aaa", | ||
"flake8-black", | ||
"flake8-bugbear", | ||
"flake8-cognitive-complexity", | ||
"flake8-commas", | ||
|
@@ -74,6 +77,7 @@ dev = [ | |
|
||
[tool.flake8] | ||
max-line-length = 160 | ||
inline-quotes = "\"" | ||
ignore = [ | ||
"DJ05", # URLs include() should set a namespace | ||
"E501", # Line too long | ||
|
@@ -82,6 +86,8 @@ ignore = [ | |
"PT001", # Use @pytest.fixture() over @pytest.fixture | ||
"SIM102", # Use a single if-statement instead of nested if-statements | ||
"SIM113", # Use enumerate instead of manually incrementing a counter | ||
"E203", # whitespace before ':', disabled for black purposes https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#slices | ||
"C812", # Missing trailing comma, disabled for black purposes https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#the-magic-trailing-comma | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Скажи, а остаётся ли какой-нибудь смысл в наличии flake8-commas теперь? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Интересный вопрос. Пару месяцев назад я думал, что еще нужен, тк были еще проверки C818 C819 Сейчас решил перечитать доки и оказывается, что flake8-commas устарел PyCQA/flake8-commas#69, причем в пользу black PyCQA/flake8-commas#63. Удалю эту батарейку |
||
] | ||
exclude = [ | ||
"static", | ||
|
@@ -98,3 +104,15 @@ line_length = 160 | |
extra_standard_library = ["pytest"] | ||
known_django = ["django", "restframework"] | ||
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "DJANGO", "FIRSTPARTY", "LOCALFOLDER"] | ||
use_parentheses = true | ||
include_trailing_comma = true | ||
multi_line_output = 3 | ||
|
||
|
||
[tool.black] | ||
exclude = ''' | ||
/( | ||
| migrations | ||
)/ | ||
''' | ||
line_length = 160 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
from app.admin.model_admin import ModelAdmin | ||
|
||
__all__ = [ | ||
'admin', | ||
'ModelAdmin', | ||
"admin", | ||
"ModelAdmin", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А не лучше ли здесь будет написать
fmt
вместоfrmt
, по аналогии сgofmt
?