@@ -93,7 +93,8 @@ typing = [
9393]
9494
9595lint = [
96- " pylint~=3.3.1" ,
96+ " pylint~=3.3.1" ,
97+ " ruff~=0.15.0" ,
9798
9899 # for checking _test.py files
99100 " pytest" ,
@@ -111,6 +112,7 @@ format = [
111112 " flynt~=0.60" ,
112113 " black~=24.8.0" ,
113114 " isort~=5.10.1" ,
115+ " ruff~=0.15.0" ,
114116]
115117
116118doc = [
@@ -131,6 +133,72 @@ skip-string-normalization = true
131133skip-magic-trailing-comma = true
132134exclude = " qualtran/protos/*"
133135
136+ [tool .ruff ]
137+ line-length = 100
138+ target-version = " py311"
139+ exclude = [
140+ " qualtran/protos/*" ,
141+ " *_pb2.py" ,
142+ " *.ipynb" ,
143+ ]
144+
145+ [tool .ruff .lint ]
146+ select = [
147+ " E" , # pycodestyle
148+ " F" , # pyflakes
149+ # "I", # isort (disabled until we switch formatters)
150+ " W" , # pycodestyle warnings
151+ " PL" , # pylint
152+ ]
153+ ignore = [
154+ # From the default ruleset:
155+ " E741" , # ambiguous variable name 'l', 'O', or 'I'
156+ " E743" , # ambiguous function definition
157+ " E731" , # assigning a lambda expression to a variable
158+
159+ # Handled by the formatter
160+ " E501" , # line too long (let ruff format handle this)
161+ " W291" , # trailing whitespace
162+ " W293" , # blank line contains whitespace
163+
164+ # We productively use these
165+ " PLC0415" , # import outside top-level
166+ " PLW2901" , # loop variable overwritten
167+ " PLC0206" , # Extracting value from dictionary without calling .items()
168+ " PLW0406" , # Module import itself
169+
170+ # Pylint 'refactor' rules
171+ " PLR0913" , # Too many arguments
172+ " PLR0912" , # Too many branches
173+ " PLR0915" , # Too many statements
174+ " PLR0914" , # Too many local variables
175+ " PLR2004" , # Magic value used in comparison
176+ " PLR0911" , # Too many return statements
177+ " PLR1704" , # Redefining argument with the local name
178+ " PLR1714" , # Consider merging multiple comparisons
179+ " PLR1730" , # replace if with min, max. Can be enabled.
180+
181+ # Might be enabled at some point
182+ " PLR0402" # Prevalent in the rotation_synthesis submodule.
183+ ]
184+
185+ [tool .ruff .lint .per-file-ignores ]
186+ "__init__.py" = [
187+ # Ruff wants us to redundantly re-export symbols in __init__.py files, but the
188+ # automated fix isn't in the stable release yet.
189+ " F401" , # Unused import
190+ ]
191+
192+
193+ [tool .ruff .lint .isort ]
194+ order-by-type = false
195+ force-to-top = []
196+ split-on-trailing-comma = false
197+
198+ [tool .ruff .format ]
199+ quote-style = " preserve"
200+ skip-magic-trailing-comma = true
201+
134202[tool .isort ]
135203profile = ' black'
136204order_by_type = false
0 commit comments