@@ -62,89 +62,121 @@ pytest-asyncio = "^0.23.8"
6262lovely-pytest-docker = " ^0.3.1"
6363
6464[tool .poetry .group .dev .dependencies ]
65- black = " ^24.8.0"
66- pylint = " ^3.2.6"
6765bandit = " ^1.7.9"
68- flake8-pyproject = " ^1.2.3"
69- isort = " ^5.13.2"
66+ ruff = " ^0.14.1"
7067
7168[tool .bandit ]
7269exclude_dirs = [" .venv" ," tests" ]
7370skips = [" B104" ]
7471
75- [tool .flake8 ]
76- ignore = [ " F401 " , " E402 " , " Q000 " , " E203 " , " W503 " ]
72+ [tool .ruff ]
73+ # Exclude a variety of commonly ignored directories.
7774exclude = [
78- " .venv" ,
79- " ./venv" ,
75+ " .bzr" ,
76+ " .direnv" ,
77+ " .eggs" ,
8078 " .git" ,
81- " .history" ,
79+ " .git-rewrite" ,
80+ " .hg" ,
81+ " .mypy_cache" ,
82+ " .nox" ,
83+ " .pants.d" ,
84+ " .pytype" ,
85+ " .ruff_cache" ,
86+ " .svn" ,
87+ " .tox" ,
88+ " .venv" ,
89+ " __pypackages__" ,
90+ " _build" ,
91+ " buck-out" ,
92+ " build" ,
93+ " dist" ,
94+ " node_modules" ,
95+ " venv" ,
96+ " migrations" ,
8297 " devops" ,
83- " *migrations* " ,
98+ " .history " ,
8499]
85- per-file-ignores = [
86- " __init__.py:F401" ,
87- " *.py:B902"
100+
101+ # Same as Black.
102+ line-length = 120
103+ indent-width = 4
104+
105+ # Assume Python 3.12
106+ target-version = " py312"
107+
108+ [tool .ruff .lint ]
109+ # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
110+ select = [
111+ " E4" , # pycodestyle errors
112+ " E7" , # pycodestyle errors
113+ " E9" , # pycodestyle errors
114+ " F" , # pyflakes
115+ " W" , # pycodestyle warnings
116+ " B" , # flake8-bugbear
117+ " C4" , # flake8-comprehensions
118+ " UP" , # pyupgrade
119+ " ARG" , # unused-function-argument
120+ " D" , # pydocstyle
121+ " I" , # isort
122+ " N" , # pep8-naming
123+ " Q" , # flake8-quotes
124+ " S" , # flake8-bandit
125+ " T" , # flake8-type-checking
126+ " TCH" , # flake8-type-checking
127+ " TID" , # flake8-tidy-imports
88128]
89- max-line-length = 120
90- docstring-min-length =10
91- count = true
92129
93- [ tool . zimports ]
94- black-line-length = 120
95- keep-unused-type-checking = true
130+ # Allow fix for all enabled rules (when `--fix`) is provided.
131+ fixable = [ " ALL " ]
132+ unfixable = []
96133
97- [tool .black ]
98- target-version = [" py310" , " py311" , " py312" ]
99- line-length = 120
100- include = ' \.pyi?$'
101- extend-exclude = '''
102- /(
103- # The following are specific to Black, you probably don't want those.
104- migrations
105- | devops
106- | .history
107- )/
108- '''
109-
110- [tool .isort ]
111- atomic = true
112- profile = " black"
113- line_length = 120
114- skip_gitignore = true
115- skip_glob = [" migrations" , " devops" ]
116-
117- [tool .pylint .main ]
118- fail-under = 10
119- max-line-length = 120
120- ignore = [ " migrations" , " devops" , " tests" ]
121- ignore-patterns = [" ^\\ .#" ]
122- ignored-modules = [" flask_sqlalchemy" , " sqlalchemy" , " SQLAlchemy" , " alembic" , " scoped_session" ]
123- ignored-classes = " scoped_session"
124- ignore-long-lines = " ^\\ s*(# )?<?https?://\\ S+>?$"
125- extension-pkg-whitelist = " pydantic"
126- notes = [" FIXME" ," XXX" ," TODO" ]
127- overgeneral-exceptions = [" builtins.BaseException" , " builtins.Exception" ]
128- confidence = [" HIGH" , " CONTROL_FLOW" , " INFERENCE" , " INFERENCE_FAILURE" , " UNDEFINED" ]
129- disable = " C0209,C0301,W0511,W0613,W0703,W1514,W1203,R0801,R0902,R0903,R0911,R0401,R1705,R1718,W3101"
130- argument-naming-style = " snake_case"
131- attr-naming-style = " snake_case"
132- class-attribute-naming-style = " any"
133- class-const-naming-style = " UPPER_CASE"
134- class-naming-style = " PascalCase"
135- const-naming-style = " UPPER_CASE"
136- function-naming-style = " snake_case"
137- inlinevar-naming-style = " any"
138- method-naming-style = " snake_case"
139- module-naming-style = " any"
140- variable-naming-style = " snake_case"
141- docstring-min-length = -1
142- good-names = [" i" , " j" , " k" , " ex" , " Run" , " _" ]
143- bad-names = [" foo" , " bar" , " baz" , " toto" , " tutu" , " tata" ]
144- defining-attr-methods = [" __init__" , " __new__" , " setUp" , " asyncSetUp" , " __post_init__" ]
145- exclude-protected = [" _asdict" , " _fields" , " _replace" , " _source" , " _make" , " os._exit" ]
146- valid-classmethod-first-arg = [" cls" ]
147- valid-metaclass-classmethod-first-arg = [" mcs" ]
134+ # Allow unused variables when underscore-prefixed.
135+ dummy-variable-rgx = " ^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
136+
137+ [tool .ruff .lint .per-file-ignores ]
138+ # Tests can use magic values, assertions, and relative imports
139+ "tests/**/*.py" = [" PLR2004" , " S101" , " TID252" , " ARG001" , " B006" , " B008" , " S311" , " T201" ]
140+ # Allow magic values in tests
141+ "**/test_*.py" = [" PLR2004" , " S101" , " TID252" , " ARG001" , " B006" , " B008" , " S311" , " T201" ]
142+ # Allow magic values in conftest.py
143+ "conftest.py" = [" PLR2004" , " S101" , " TID252" , " ARG001" , " B006" , " B008" , " S311" , " T201" ]
144+ # Allow magic values in migrations
145+ "migrations/**/*.py" = [" PLR2004" , " S101" , " TID252" ]
146+ # Allow magic values in devops
147+ "devops/**/*.py" = [" PLR2004" , " S101" , " TID252" ]
148+ # Allow unused imports in __init__.py and ignore N999 (invalid module name)
149+ "__init__.py" = [" F401" , " N999" ]
150+
151+ [tool .ruff .lint .isort ]
152+ known-first-party = [" pay_api" ]
153+
154+ [tool .ruff .lint .flake8-quotes ]
155+ docstring-quotes = " double"
156+
157+ [tool .ruff .lint .pydocstyle ]
158+ convention = " google"
159+
160+ [tool .ruff .format ]
161+ # Like Black, use double quotes for strings.
162+ quote-style = " double"
163+
164+ # Like Black, indent with spaces, rather than tabs.
165+ indent-style = " space"
166+
167+ # Like Black, respect magic trailing commas.
168+ skip-magic-trailing-comma = false
169+
170+ # Like Black, automatically detect the appropriate line ending.
171+ line-ending = " auto"
172+
173+ # Enable auto-formatting of code examples in docstrings. Markdown,
174+ # reStructuredText code/literal blocks and doctests are all supported.
175+ docstring-code-format = false
176+
177+ # Set the line length limit used when formatting code snippets in
178+ # docstrings.
179+ docstring-code-line-length = " dynamic"
148180
149181[tool .pytest .ini_options ]
150182asyncio_mode = " auto"
0 commit comments