Skip to content

Commit f1fa189

Browse files
authored
chore: update ruff rule names (#345)
1 parent b74d734 commit f1fa189

8 files changed

Lines changed: 81 additions & 54 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: v0.14.3-1-gaf0192ee
2+
_commit: v0.14.3-4-gd19b7518
33
_src_path: .
44
command_line_interface: none
55
conda_channel: wpk-nist

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ repos:
131131
alias: ruff
132132
args: [--fix, --show-fixes]
133133
types_or: &ruff_types [python, pyi, jupyter, markdown]
134+
- id: ruff-check
135+
alias: ruff-check-config
136+
name: ruff check config
137+
args: [--fix, --show-fixes]
138+
types_or: [file]
139+
files: ^pyproject\.toml$|^\.?ruff\.toml$
134140
- id: ruff-format
135141
exclude: *exclude_template
136142
alias: ruff

copier.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ year:
102102
# * Copier options
103103
_exclude:
104104
- ".github/workflows/update-cruft.yml"
105+
- "ruff.toml"
105106

106107
_templates_suffix: ""
107108

hooks/post_gen_project.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,11 @@ def remove_update_copier() -> None:
1111
path.unlink(missing_ok=True)
1212

1313

14+
def remove_ruff_toml() -> None:
15+
"""Remove unused ruff.toml file"""
16+
Path("ruff.toml").unlink(missing_ok=True)
17+
18+
1419
if __name__ == "__main__":
1520
remove_update_copier()
21+
remove_ruff_toml()

pyproject.toml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,13 @@ extend-include = [
115115
extend-exclude = [
116116
".numba_cache",
117117
".venv",
118-
"{{cookiecutter.*}}",
118+
# '**/\{\{cookiecutter.project_slug\}\}/**',
119119
"dist-conda",
120120
]
121+
force-exclude = true
121122
fix = true
122123
# unsafe-fixes = true
124+
cache-dir = ".ruff_cache"
123125

124126
[tool.ruff.format]
125127
docstring-code-format = true
@@ -132,32 +134,32 @@ select = [
132134
]
133135
# fixable = [ "ALL" ]
134136
unfixable = [
135-
"PLR6104",
137+
"non-augmented-assignment",
136138
"ERA",
137139
"T",
138140
]
139141
ignore = [
140-
"ANN401", # - Any ok sometimes
141-
"COM", # - flake8-commas, formatter should take care of this?
142-
"CPY", # - Don't require copyright
143-
"D104",
144-
"D105", # - Missing magic method docstring
145-
"D107", # - Missing docstring in __init__
146-
"D203", # - 1 blank line required before class docstring
147-
"D205", # - blank line after summary
148-
"D212", # - Multi-line docstring summary should start at the first line
149-
"D400", # - First line should end with a period
150-
"D401", # - First line of docstring should be in imperative mood: "{first_line}"
151-
"DOC201", # - Missing return from documentation
152-
"DOC501", # - Missing raises from documentation
153-
"E501", # - line too long - let formatter fix this
154-
"E731", # - do not assign a lambda expression, use a def
155-
"FBT", # - bools are ok
156-
"PLC0415", # - import should be at top level (leads to issues with imports in func?)
157-
"S404", # - Want to use subprocess sometimes
158-
"S603", # - subprocess-without-shell-equals-true
159-
"S607", # - start-process-with-partial-path
160-
"TID252", # - Allow relative imports
142+
"any-type", # - Any ok sometimes
143+
"COM", # - flake8-commas, formatter should take care of this?
144+
"CPY", # - Don't require copyright
145+
"undocumented-public-package",
146+
"undocumented-magic-method", # - Missing magic method docstring
147+
"undocumented-public-init", # - Missing docstring in __init__
148+
"incorrect-blank-line-before-class", # - 1 blank line required before class docstring
149+
"missing-blank-line-after-summary", # - blank line after summary
150+
"multi-line-summary-first-line", # - Multi-line docstring summary should start at the first line
151+
"missing-trailing-period", # - First line should end with a period
152+
"non-imperative-mood", # - First line of docstring should be in imperative mood: "{first_line}"
153+
"docstring-missing-returns", # - Missing return from documentation
154+
"docstring-missing-exception", # - Missing raises from documentation
155+
"line-too-long", # - line too long - let formatter fix this
156+
"lambda-assignment", # - do not assign a lambda expression, use a def
157+
"FBT", # - bools are ok
158+
"import-outside-top-level", # - import should be at top level (leads to issues with imports in func?)
159+
"suspicious-subprocess-import", # - Want to use subprocess sometimes
160+
"subprocess-without-shell-equals-true", # - subprocess-without-shell-equals-true
161+
"start-process-with-partial-path", # - start-process-with-partial-path
162+
"relative-imports", # - Allow relative imports
161163
]
162164
isort.known-first-party = [
163165
"cookiecutter_nist_python",
@@ -174,10 +176,10 @@ ruff.strictly-empty-init-modules = false
174176
"PD", # - not using pandas?
175177
]
176178
"tests/**" = [
177-
"D", # - Don't need to document tests
178-
"S101", # - Assert is fine with tests
179-
"LOG015",
180-
"S404",
179+
"D",
180+
"assert",
181+
"root-logger-call",
182+
"suspicious-subprocess-import",
181183
]
182184

183185
# * Checks ---------------------------------------------------------------------

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ repos:
114114
alias: ruff
115115
args: [--fix, --show-fixes]
116116
types_or: &ruff_types [python, pyi, jupyter, markdown]
117+
- id: ruff-check
118+
alias: ruff-check-config
119+
name: ruff check config
120+
args: [--fix, --show-fixes]
121+
types_or: [file]
122+
files: ^pyproject\.toml$|^\.?ruff\.toml$
117123
- id: ruff-format
118124
alias: ruff
119125
types_or: *ruff_types

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -182,31 +182,31 @@ select = [
182182
]
183183
# fixable = [ "ALL" ]
184184
unfixable = [
185-
"PLR6104",
185+
"non-augmented-assignment",
186186
"ERA",
187187
"T",
188188
]
189189
ignore = [
190-
"ANN401", # - Any ok sometimes
191-
"COM", # - flake8-commas, formatter should take care of this?
192-
"CPY", # - Don't require copyright
193-
"D105", # - Missing magic method docstring
194-
"D107", # - Missing docstring in __init__
195-
"D203", # - 1 blank line required before class docstring
196-
"D205", # - blank line after summary
197-
"D212", # - Multi-line docstring summary should start at the first line
198-
"D400", # - First line should end with a period
199-
"D401", # - First line of docstring should be in imperative mood: "{first_line}"
200-
"DOC201", # - Missing return from documentation
201-
"DOC501", # - Missing raises from documentation
202-
"E501", # - line too long - let formatter fix this
203-
"E731", # - do not assign a lambda expression, use a def
204-
"FBT", # - bools are ok
205-
"PLC0415", # - import should be at top level (leads to issues with imports in func?)
206-
"S404", # - Want to use subprocess sometimes
207-
"S603", # - subprocess-without-shell-equals-true
208-
"S607", # - start-process-with-partial-path
209-
"TID252", # - Allow relative imports
190+
"any-type", # - Any ok sometimes
191+
"COM", # - flake8-commas, formatter should take care of this?
192+
"CPY", # - Don't require copyright
193+
"undocumented-magic-method", # - Missing magic method docstring
194+
"undocumented-public-init", # - Missing docstring in __init__
195+
"incorrect-blank-line-before-class", # - 1 blank line required before class docstring
196+
"missing-blank-line-after-summary", # - blank line after summary
197+
"multi-line-summary-first-line", # - Multi-line docstring summary should start at the first line
198+
"missing-trailing-period", # - First line should end with a period
199+
"non-imperative-mood", # - First line of docstring should be in imperative mood: "{first_line}"
200+
"docstring-missing-returns", # - Missing return from documentation
201+
"docstring-missing-exception", # - Missing raises from documentation
202+
"line-too-long", # - line too long - let formatter fix this
203+
"lambda-assignment", # - do not assign a lambda expression, use a def
204+
"FBT", # - bools are ok
205+
"import-outside-top-level", # - import should be at top level (leads to issues with imports in func?)
206+
"suspicious-subprocess-import", # - Want to use subprocess sometimes
207+
"subprocess-without-shell-equals-true", # - subprocess-without-shell-equals-true
208+
"start-process-with-partial-path", # - start-process-with-partial-path
209+
"relative-imports", # - Allow relative imports
210210
]
211211
isort.known-first-party = [
212212
"{{ cookiecutter.project_slug }}",
@@ -223,14 +223,14 @@ ruff.strictly-empty-init-modules = false
223223
"PD", # - not using pandas?
224224
]
225225
"tests/**" = [
226-
"D", # - Don't need to document tests
227-
"S101", # - Assert is fine with tests
226+
"D", # - Don't need to document tests
227+
"assert", # - Assert is fine with tests
228228
]
229229
{%- if cookiecutter.use_jupyter %}
230230
"examples/**" = [
231-
# "B018", # - Don't remove useless expressions in notebooks
232-
# "D100", # - undocumented-public-module
233-
# "INP001",
231+
# "useless-expression", # - Don't remove useless expressions in notebooks
232+
# "undocumented-public-module", # - undocumented-public-module
233+
# "implicit-namespace-package",
234234
]
235235
{%- endif %}
236236

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file is not copied over.
2+
# It is only here to make ruff happy when called directly.
3+
4+
include = []
5+
exclude = ["**"]
6+
cache-dir = "../.ruff_cache"

0 commit comments

Comments
 (0)