@@ -54,6 +54,7 @@ extend-ignore = [
54
54
" F811" , # TODO: ella fix after pflake8 version update
55
55
]
56
56
57
+ # TODO: This will be removed in favor of the section below.
57
58
[tool .isort ]
58
59
profile = " black"
59
60
color_output = false
@@ -69,81 +70,115 @@ skip_glob = [
69
70
# correctly handles first-party imports in subdirectories.
70
71
]
71
72
73
+ [tool .ruff .pylint ]
74
+ max-args = 8 # Relaxed from default of 5
75
+ max-branches = 15 # Relaxed from default of 12
76
+
72
77
[tool .ruff ]
73
- target-version = " py38"
74
- line-length = 140
75
- exclude = [
76
- # If any files should not be checked, add them here:
77
- " setup.py" , # These should be deprecated and will eventually replaced with pyproject.toml-based configuration.
78
- ]
79
- ignore = [
80
- # If any rules should be ignored, add them here:
81
- " ANN101" , # Missing type annotation for `self` in method
82
- " ANN102" , # Missing type annotation for `cls` in class method
83
- " PT004" , # Add leading underscore to fixtures that do not return anything
84
- ]
78
+ target-version = " py310"
85
79
select = [
86
- " A" , # flake8-builtins
87
- " ANN" , # flake8-annotations
88
- " ARG" , # flake8-unused-arguments
89
- " B" , # flake8-bugbear
90
- " BLE" , # flake8-blind-except
91
- " C4" , # flake8-comprehensions
92
- " C90" , # mccabe
93
- " COM" , # flake8-commas
94
- " D" , # pydocstyle/flake8-docstrings
95
- " DTZ" , # flake8-datetimezs
96
- " E" , # pycodestyle (error)
97
- " EM" , # flake8-errmsg
98
- " ERA" , # eradicate
80
+ # For rules reference, see https://docs.astral.sh/ruff/rules/
81
+ " A" , # flake8-builtins
82
+ " ANN" , # flake8-annotations
83
+ " ARG" , # flake8-unused-arguments
84
+ " ASYNC" , # flake8-async
85
+ " B" , # flake8-bugbear
86
+ " FBT" , # flake8-boolean-trap
87
+ " BLE" , # Blind except
88
+ " C4" , # flake8-comprehensions
89
+ " C90" , # mccabe (complexity)
90
+ " COM" , # flake8-commas
91
+ " CPY" , # missing copyright notice
92
+ # "D", # pydocstyle # TODO: Re-enable when adding docstrings
93
+ " DTZ" , # flake8-datetimez
94
+ " E" , # pycodestyle (errors)
95
+ " ERA" , # flake8-eradicate (commented out code)
96
+ " EXE" , # flake8-executable
99
97
" F" , # Pyflakes
100
98
" FA" , # flake8-future-annotations
101
- " FBT" , # flake8-boolean-trap
102
- " G" , # flake8-logging-format
99
+ " FIX" , # flake8-fixme
100
+ " FLY" , # flynt
101
+ " FURB" , # Refurb
103
102
" I" , # isort
104
103
" ICN" , # flake8-import-conventions
105
104
" INP" , # flake8-no-pep420
105
+ " INT" , # flake8-gettext
106
106
" ISC" , # flake8-implicit-str-concat
107
+ " ICN" , # flake8-import-conventions
108
+ " LOG" , # flake8-logging
107
109
" N" , # pep8-naming
108
- " PERF " , # perflint
109
- " PGH " , # pygrep-hooks
110
+ " PD " , # pandas-vet
111
+ " PERF " , # Perflint
110
112
" PIE" , # flake8-pie
111
- " PLC" , # pylint (convention)
112
- " PLE" , # pylint (error)
113
- " PLR" , # pylint (refactor)
114
- " PLW" , # pylint (warning)
113
+ " PGH" , # pygrep-hooks
114
+ " PL" , # Pylint
115
115
" PT" , # flake8-pytest-style
116
116
" PTH" , # flake8-use-pathlib
117
+ " PYI" , # flake8-pyi
117
118
" Q" , # flake8-quotes
118
119
" RET" , # flake8-return
119
120
" RSE" , # flake8-raise
120
- " RUF" , # ruff
121
- " S" , # flake8-bandit
121
+ " RUF" , # Ruff-specific rules
122
122
" SIM" , # flake8-simplify
123
- " T10" , # flake8-debugger
124
- " T20" , # flake8-print
125
- " TCH" , # flake8-type-checking
126
- " TID" , # flake8-tidy-imports
127
- " UP" , # pyupgrade
128
- " W" , # pycodestyle (warning)
129
- " YTT" , # flake8-2020
130
123
" SLF" , # flake8-self
124
+ " SLOT" , # flake8-slots
125
+ " T10" , # debugger calls
126
+ # "T20", # flake8-print # TODO: Re-enable once we have logging
127
+ " TCH" , # flake8-type-checking
128
+ " TD" , # flake8-todos
129
+ " TID" , # flake8-tidy-imports
130
+ " TRY" , # tryceratops
131
+ " TRY002" , # Disallow raising vanilla Exception. Create or use a custom exception instead.
132
+ " TRY003" , # Disallow vanilla string passing. Prefer kwargs to the exception constructur.
133
+ " UP" , # pyupgrade
134
+ " W" , # pycodestyle (warnings)
135
+ " YTT" , # flake8-2020
131
136
]
132
137
133
- [tool .ruff .per-file-ignores ]
134
- "__init__.py" = [
135
- " F401" , # Permit unused imports in `__init__.py` files
138
+ ignore = [
139
+ # For rules reference, see https://docs.astral.sh/ruff/rules/
140
+
141
+ # These we don't agree with or don't want to prioritize to enforce:
142
+ " ANN003" , # kwargs missing type annotations
143
+ " ANN101" , # Type annotations for 'self' args
144
+ " ANN102" , # Type annotations for 'cls' args
145
+ " COM812" , # Because it conflicts with ruff auto-format
146
+ " EM" , # flake8-errmsgs (may reconsider later)
147
+ " DJ" , # Django linting
148
+ " G" , # flake8-logging-format
149
+ " ISC001" , # Conflicts with ruff auto-format
150
+ " NPY" , # NumPy-specific rules
151
+ " PIE790" , # Allow unnecssary 'pass' (sometimes useful for readability)
152
+ " PERF203" , # exception handling in loop
153
+ " S" , # flake8-bandit (noisy, security related)
154
+ " SIM910" , # Allow "None" as second argument to Dict.get(). "Explicit is better than implicit."
155
+ " TD002" , # Require author for TODOs
156
+ " TRIO" , # flake8-trio (opinionated, noisy)
157
+ " INP001" , # Dir 'examples' is part of an implicit namespace package. Add an __init__.py.
158
+
159
+ # TODO: Consider re-enabling these before release:
160
+ " A003" , # Class attribute 'type' is shadowing a Python builtin
161
+ " BLE001" , # Do not catch blind exception: Exception
162
+ " ERA001" , # Remove commented-out code
163
+ " FIX002" , # Allow "TODO:" until release (then switch to requiring links via TDO003)
164
+ " PLW0603" , # Using the global statement to update _cache is discouraged
165
+ " TD003" , # Require links for TODOs # TODO: Re-enable when we disable FIX002
166
+
167
+ " UP007" , # Allow legacy `Union[a, b]` and `Optional[a]` for Pydantic, until we drop Python 3.9 (Pydantic doesn't like it)
168
+ ]
169
+ fixable = [" ALL" ]
170
+ unfixable = [
171
+ " ERA001" , # Commented-out code (avoid silent loss of code)
172
+ " T201" , # print() calls (avoid silent loss of code / log messages)
136
173
]
137
174
138
- [tool .ruff .flake8-annotations ]
139
- allow-star-arg-any = true
140
- mypy-init-return = true
141
- suppress-dummy-args = true
142
-
143
- [tool .ruff .flake8-pytest-style ]
144
- parametrize-values-type = " tuple"
175
+ line-length = 140
176
+ extend-exclude = [" docs" , " test" , " tests" ]
177
+ dummy-variable-rgx = " ^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
145
178
146
179
[tool .ruff .isort ]
180
+ force-sort-within-sections = false
181
+ lines-after-imports = 2
147
182
known-first-party = [
148
183
" airbyte" ,
149
184
" airbyte_cdk" ,
@@ -152,12 +187,38 @@ known-first-party = [
152
187
" connector_ops" ,
153
188
" pipelines" ,
154
189
]
155
- # No longer required with Python >=3.8
156
- # required-imports = ["from __future__ import annotations"]
190
+ known-local-folder = [" airbyte" ]
191
+ required-imports = [" from __future__ import annotations" ]
192
+ known-third-party = []
193
+ section-order = [
194
+ " future" ,
195
+ " standard-library" ,
196
+ " third-party" ,
197
+ " first-party" ,
198
+ " local-folder" ,
199
+ ]
200
+
201
+ [tool .ruff .mccabe ]
202
+ max-complexity = 24
203
+
204
+ [tool .ruff .pycodestyle ]
205
+ ignore-overlong-task-comments = true
157
206
158
207
[tool .ruff .pydocstyle ]
159
208
convention = " google"
160
209
210
+ [tool .ruff .flake8-annotations ]
211
+ allow-star-arg-any = false
212
+ ignore-fully-untyped = false
213
+
214
+ [tool .ruff .format ]
215
+ quote-style = " double"
216
+ indent-style = " space"
217
+ skip-magic-trailing-comma = false
218
+ line-ending = " auto"
219
+ preview = false
220
+ docstring-code-format = true
221
+
161
222
[tool .mypy ]
162
223
platform = " linux"
163
224
exclude = " (build|integration_tests|unit_tests|generated)"
0 commit comments