Skip to content

Commit 350810a

Browse files
committed
Enhanced ruff rules, test->tests
1 parent 84031de commit 350810a

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ select = [
7878
ignore = [
7979
"RUF002", # hyphen checks
8080
"RUF005", # unpacking over concatenation (no point in that rule IMO)
81-
"SIM118", # Needed b/c iter(batch) != iter(batch.keys()). See https://github.com/thu-ml/tianshou/issues/922
8281
"SIM108", # if - else is fine
8382
"E501", # line too long. black does a good enough job
8483
"E741", # variable names like "l". this isn't a huge problem
8584
"B008", # do not perform function calls in argument defaults. we do this sometimes
85+
"B009", # don't replace getattr with attr access
8686
"B011", # assert false. we don't use python -O
8787
"B028", # we don't need explicit stacklevel for warnings
8888
"D100",
@@ -128,7 +128,20 @@ ignore = [
128128
"F403", "F405", # star imports
129129
"C401", # generators
130130
"C901", # complexity analysis
131-
131+
"RET504", # assignment before return can be useful for debugging
132+
"SIM103", # forbids multiple returns
133+
"SIM110", # requires use of any(...) instead of for-loop
134+
"G001", # forbids str.format in log statements
135+
"E722", # forbids unspecific except clause
136+
"SIM105", # forbids empty/general except clause
137+
"SIM113", # wants to enforce use of enumerate
138+
"E712", # forbids equality comparison with True/False
139+
"UP007", # forbids some uses of Union
140+
"TID252", # forbids relative imports
141+
"B904", # forces use of raise from other_exception
142+
"RUF012", # forbids mutable attributes as ClassVar
143+
"SIM117", # forbids nested with statements
144+
"C400", # wants to unnecessarily force use of list comprehension
132145
]
133146
unfixable = [
134147
"F841", # unused variable. ruff keeps the call, but mostly we want to get rid of it all
@@ -165,7 +178,7 @@ docstring-code-format = true
165178
PYDEVD_DISABLE_FILE_VALIDATION="1"
166179
# keep relevant parts in sync with pre-commit
167180
[tool.poe.tasks] # https://github.com/nat-n/poethepoet
168-
test = "pytest test --cov={{cookiecutter.package_name}} --cov-report=xml --cov-report=term-missing --durations=0 -v --color=yes"
181+
test = "pytest tests --cov={{cookiecutter.package_name}} --cov-report=xml --cov-report=term-missing --durations=0 -v --color=yes"
169182
_black_check = "black --check ."
170183
_ruff_check = "ruff check ."
171184
_ruff_check_nb = "nbqa ruff check docs"

{{cookiecutter.project_name}}/test/{{cookiecutter.project_name}}/conftest.py renamed to {{cookiecutter.project_name}}/tests/{{cookiecutter.project_name}}/conftest.py

File renamed without changes.

{{cookiecutter.project_name}}/test/{{cookiecutter.project_name}}/test_lazy_fixture_demonstration.py renamed to {{cookiecutter.project_name}}/tests/{{cookiecutter.project_name}}/test_lazy_fixture_demonstration.py

File renamed without changes.

{{cookiecutter.project_name}}/test/{{cookiecutter.project_name}}/test_sample_class.py renamed to {{cookiecutter.project_name}}/tests/{{cookiecutter.project_name}}/test_sample_class.py

File renamed without changes.

0 commit comments

Comments
 (0)