Created
May 6, 2024 17:03
-
-
Save mariocesar/41128325ef281138bf5b144f443a18d7 to your computer and use it in GitHub Desktop.
My ruff toml configuration with useful defaults and rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exclude = ["docs/*", "*/migrations/*", ".git/*"] | |
line-length = 100 | |
indent-width = 4 | |
target-version = "py311" | |
[lint] | |
select = [ | |
"E", # pycodestyle errors | |
"W", # pycodestyle warnings | |
"N", # pep8-naming | |
"F", # flake8 errors | |
"S", # Bandig | |
"SIM", # Simplify | |
"I", # isort | |
"B", # bugbear | |
"C", # comprehensions | |
"PL", # pylint error | |
"FBT", # Avoid boolean traps | |
"UP", # pyupgrade | |
"T10", # Avoid debuggers | |
"T20", # Avoid print statements | |
"DJ", # Django | |
"ICN", # Import conventions | |
"PT", # Pytest style | |
"ERA", # Error return annotations | |
"TD", # Correct use of TODO comments | |
"PIE", # Unnecesary code | |
"PTH", # Best use of pathlib | |
"RET", # Best use of return | |
"INP", # Avoid implicit namespace package | |
] | |
ignore = [ | |
"PLR2004", # Ignore use of magic values | |
"PLR0915", # Too many statements | |
"TD002", # missing-todo-author | |
"TD003", # missing-todo-link | |
] | |
fixable = ["ALL"] | |
unfixable = [] | |
[lint.per-file-ignores] | |
"src/*/settings/*.py" = ["F403", "F405"] | |
"src/**/migrations/0001_initial.py" = ["E501"] | |
"**/test_*.py" = ["S101"] | |
[lint.isort] | |
lines-after-imports = 2 | |
case-sensitive = true | |
order-by-type = true | |
force-sort-within-sections = true | |
combine-as-imports = true | |
force-to-top = ["pytest"] | |
relative-imports-order = "closest-to-furthest" | |
section-order = [ | |
"future", | |
"standard-library", | |
"main-library", | |
"third-party", | |
"first-party", | |
"local-folder", | |
] | |
[lint.isort.sections] | |
"main-library" = ["django", "pydantic"] | |
[format] | |
quote-style = "double" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment