@@ -28,7 +28,6 @@ packages = [
2828 { include = " docs" , format = " sdist" },
2929 { include = " .bumpversion.cfg" , format = " sdist" },
3030 { include = " .editorconfig" , format = " sdist" },
31- { include = " .flake8" , format = " sdist" },
3231 { include = " .readthedocs.yaml" , format = " sdist" },
3332 { include = " poetry.lock" , format = " sdist" },
3433 { include = " tox.ini" , format = " sdist" },
@@ -56,28 +55,15 @@ pytest-cov = "^4.1"
5655pytest-describe = " ^2.1"
5756pytest-timeout = " ^2.1"
5857tox = [
59- { version = " >=4.5 ,<5" , python = " >=3.8" },
58+ { version = " >=4.12 ,<5" , python = " >=3.8" },
6059 { version = " >=3.28,<4" , python = " <3.8" }
6160]
6261
6362[tool .poetry .group .lint ]
6463optional = true
6564
6665[tool .poetry .group .lint .dependencies ]
67- black = " 23.3.0"
68- flake8 = [
69- { version = " >=5,<7" , python = " >=3.8.1" },
70- { version = " >=5,<6" , python = " <3.8.1" }
71- ]
72- flake8-bandit = " ^4.1"
73- flake8-bugbear = [
74- { version = " 23.5.9" , python = " >=3.8.1" },
75- { version = " 23.3.12" , python = " <3.8.1" },
76- ]
77- isort = [
78- { version = " ^5.12" , python = " >=3.8" },
79- { version = " ^5.11" , python = " <3.8" }
80- ]
66+ ruff = " >=0.2,<0.3"
8167mypy = " 1.3.0"
8268bump2version = " >=1.0,<2"
8369
@@ -91,11 +77,147 @@ sphinx = [
9177]
9278sphinx_rtd_theme = " >=1,<2"
9379
94- [tool .bandit ]
95- exclude_dirs = [" tests" ]
80+ [tool .ruff ]
81+ line-length = 88
82+ target-version = " py37"
83+
84+ [tool .ruff .lint ]
85+ 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 cyclomatic complexity
93+ " COM" , # flake8-commas
94+ " D" , # pydocstyle
95+ " DTZ" , # flake8-datetimez
96+ " E" , # pycodestyle
97+ " EM" , # flake8-errmsg
98+ " ERA" , # eradicate
99+ " EXE" , # flake8-executable
100+ " F" , # Pyflakes
101+ " FBT" , # flake8-boolean-trap
102+ " G" , # flake8-logging-format
103+ " I" , # isort
104+ " ICN" , # flake8-import-conventions
105+ " INP" , # flake8-no-pep420
106+ " INT" , # flake8-gettext
107+ " ISC" , # flake8-implicit-str-concat
108+ " N" , # pep8-naming
109+ " PGH" , # pygrep-hooks
110+ " PIE" , # flake8-pie
111+ " PL" , # Pylint
112+ " PT" , # flake8-pytest-style
113+ " PTH" , # flake8-use-pathlib
114+ " PYI" , # flake8-pyi
115+ " Q" , # flake8-quotes
116+ " RET" , # flake8-return
117+ " RSE" , # flake8-raise
118+ " RUF" , # Ruff-specific rules
119+ " S" , # flake8-bandit
120+ " SLF" , # flake8-self
121+ " SIM" , # flake8-simplify
122+ " T10" , # flake8-debugger
123+ " T20" , # flake8-print
124+ " TCH" , # flake8-type-checking
125+ " TID" , # flake8-tidy-imports
126+ " TRY" , # tryceratops
127+ " UP" , # pyupgrade
128+ " W" , # pycodestyle
129+ " YTT" , # flake8-2020
130+ ]
131+ ignore = [
132+ " ANN101" , " ANN102" , # no type annotation for self and cls needed
133+ " ANN401" , # allow explicit Any
134+ " COM812" , # allow trailing commas for auto-formatting
135+ " D105" , " D107" , # no docstring needed for magic methods
136+ " D203" , # no blank line before class docstring
137+ " D213" , # multi-line docstrings should not start at second line
138+ " D400" , " D415" , # first line in docstring does not need to be a sentence
139+ " D401" , # do not always require imperative mood in first line
140+ " FBT001" , " FBT002" , " FBT003" , # allow boolean parameters
141+ " ISC001" , # allow string literal concatenation for auto-formatting
142+ " PGH003" , # type ignores do not need to be specific
143+ " PLR2004" , # allow some "magic" values
144+ " PYI034" , # do not check return value of new method
145+ " TID252" , # allow relative imports
146+ " UP006" , " UP007" , # use old type annotations (for now)
147+ " TRY003" , # allow specific messages outside the exception class
148+ ]
149+
150+ [tool .ruff .lint .per-file-ignores ]
151+ "*/__init__.py" = [
152+ " I001" , # imports do not need to be sorted
153+ ]
154+ "src/graphql/execution/*" = [
155+ " BLE001" , # allow catching blind exception
156+ ]
157+ "src/graphql/language/ast.py" = [
158+ " D101" , # do not require docstrings
159+ ]
160+ "src/graphql/language/parser.py" = [
161+ " RSE102" , # raised exception may need to be called
162+ ]
163+ "src/graphql/type/introspection.py" = [
164+ " ANN001" , " ANN003" , " ANN204" , " ANN205" , # allow missing type annotations
165+ " N803" , # allow JavaScript style arguments
166+ ]
167+ "src/graphql/utilities/get_introspection_query.py" = [
168+ " D101" , # allow missing class docstrings
169+ " N815" , # allow JavaScript style class attributes
170+ ]
171+ "src/graphql/utilities/type_info.py" = [
172+ " D102" , # allow missing method docstrings
173+ ]
174+ "src/graphql/validation/rules/*" = [
175+ " D102" , # allow missing method docstrings
176+ ]
177+ "src/graphql/validation/validation_context.py" = [
178+ " D102" , # allow missing method docstrings
179+ ]
180+ "tests/*" = [
181+ " ANN001" , " ANN002" , " ANN003" , # allow missing type annotations
182+ " ANN201" , " ANN202" , " ANN204" , " ANN205" , # allow missing type annotations
183+ " B011" , # allow always failing assertions
184+ " B904" , # allow raising exceptions without context
185+ " C901" , # allow complex functions
186+ " D100" , " D101" , " D102" , " D103" , # allow missing docstrings
187+ " EM101" , " EM102" , # allow passing literal strings to exceptions
188+ " N802" , " N803" , " N806" , " N815" , " N816" , # allow JavaScript style names
189+ " PLR0915" , # allow many statements
190+ " PT015" , # allow always failing assertions
191+ " RUF012" , # allow mutable class attributes
192+ " S101" , # allow assertions
193+ " S301" , # allow pickling
194+ " TRY002" , " TRY301" , # less strict handling of exceptions
195+ ]
196+ "tests/star_wars_schema.py" = [
197+ " A002" , # allow shadowin builtins
198+ " ERA001" , # allow commented-out code
199+ ]
200+ "tests/test_docs.py" = [
201+ " S102" , # allow use of exec
202+ ]
203+
204+
205+ [tool .ruff .lint .flake8-quotes ]
206+ inline-quotes = " double"
96207
97- [tool .black ]
98- target-version = [" py37" , " py38" , " py39" , " py310" , " py311" ]
208+ [tool .ruff .lint .mccabe ]
209+ max-complexity = 50
210+
211+ [tool .ruff .lint .pylint ]
212+ max-args = 15
213+ max-branches = 50
214+ max-returns = 25
215+ max-statements = 125
216+
217+ [tool .ruff .format ]
218+ indent-style = " space"
219+ quote-style = " double"
220+ skip-magic-trailing-comma = false
99221
100222[tool .coverage .run ]
101223branch = true
@@ -116,7 +238,6 @@ exclude_lines = [
116238 " except ImportError:" ,
117239 " # Python <" ,
118240 " raise NotImplementedError" ,
119- ' raise TypeError\(f?"Unexpected' ,
120241 " assert False," ,
121242 ' \s+next\($' ,
122243 " if MYPY:" ,
@@ -126,13 +247,6 @@ exclude_lines = [
126247]
127248ignore_errors = true
128249
129- [tool .isort ]
130- src_paths = [" src" , " tests" ]
131- skip_glob = [" src/**/__init__.py" ]
132- profile = " black"
133- force_single_line = false
134- lines_after_imports = 2
135-
136250[tool .mypy ]
137251python_version = " 3.11"
138252check_untyped_defs = true
0 commit comments