@@ -52,6 +52,7 @@ tests = [
5252 " coverage>=6.0" ,
5353 " codecov-cli>=10.2.0" ,
5454 " diff_cover" ,
55+ " ruff" ,
5556]
5657docs = [
5758 " sphinx>=5.0.0" ,
@@ -79,64 +80,91 @@ Repository = "{{ cookiecutter.project_repo }}"
7980Issues = " {{ cookiecutter.project_repo }}/issues"
8081Documentation = " https://{{ cookiecutter.project_slug }}.readthedocs.io/"
8182
82- [tool .black ]
83+ [tool .ruff ]
8384line-length = 80
84- target-version = [' py31*' ]
85- include = ' \.pyi?$'
86- exclude = '''
87- (
88- /(
89- \.eggs
90- | \.git
91- | \.hg
92- | \.mypy_cache
93- | \.tox
94- | \.venv
95- | _build
96- | buck-out
97- | build
98- | dist
99- )/
100- )
101- '''
85+ target-version = py312
86+ unfixable = [ " UP" ]
87+ extend-include = [ " *.ipynb" ]
88+ format = true
89+ format.docstring-code-format = true
90+ format.trailing-comma = " all"
91+ lint.isort.known-first-party =
92+ lint.select = [
93+ " B" , # flake8-bugbear
94+ " BLE" , # flake8-blind-except
95+ " C4" , # flake8-comprehensions
96+ " D" , # pydocstyle
97+ " E" , # Error detected by Pycodestyle
98+ " F" , # Errors detected by Pyflakes
99+ " I" , # isort
100+ " RUF100" , # Report unused noqa directives
101+ " TID" , # flake8-tidy-imports
102+ " UP" , # pyupgrade
103+ " W" , # Warning detected by Pycodestyle
104+ " Q" , # Consistent quotes
105+ " S307" , # eval() detection
106+ " ANN" , # flake8-annotations
107+ ]
108+ lint.ignore = [
109+ " B008" , # Errors from function calls in argument defaults. These are fine when the result is immutable.
110+ " B024" ,
111+ " D100" , # Missing docstring in public module
112+ " D104" , # Missing docstring in public package
113+ " D105" , # __magic__ methods are often self-explanatory, allow missing docstrings
114+ " D107" , # Missing docstring in __init__
115+ # Disable one in each pair of mutually incompatible rules
116+ " D200" ,
117+ " D202" ,
118+ " D203" , # We don’t want a blank line before a class docstring
119+ " D213" , # <> We want docstrings to start immediately after the opening triple quote
120+ " D400" , # first line should end with a period [Bug: doesn’t work with single-line docstrings]
121+ " D401" , # First line should be in imperative mood; try rephrasing
122+ " E131" ,
123+ " E251" ,
124+ " E303" ,
125+ " E501" , # line too long -> we accept long comment lines; formatter gets rid of long code lines
126+ " E521" ,
127+ " E731" , # Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
128+ " E741" , # allow I, O, l as variable names -> I is the identity matrix
129+ " W503" ,
130+ " W504" ,
131+ ]
132+ lint.pydocstyle.convention = " numpy"
133+ lint.quotes.inline-quotes = " single"
102134
103- [tool .isort ]
104- from_first = true
105- line_length = 80
106- multi_line_output = 3
107- include_trailing_comma = true
108- use_parentheses = true
109- known_num =" numpy,pandas"
110- sections = " FUTURE,STDLIB,THIRDPARTY,NUM,FIRSTPARTY,LOCALFOLDER"
111- no_lines_before =" LOCALFOLDER"
112- balanced_wrapping = true
113- force_grid_wrap = 0
114- length_sort = " 1"
115- indent = " "
116- skip = []
135+ [tool .ruff .lint .per-file-ignores ]
136+ "docs/*" = [ " I" ]
137+ "docs/src/conf.py" = [ " D100" ]
138+ "tests/*" = [ " D" ]
139+ "tests/conftest.py" = [ " D101" , " D102" , " D103" , " E402" ]
140+ "*/__init__.py" = [ " D104" , " F401" ]
117141
118- [tool .flake8 ]
119- extend-select = [" CE101" ]
120- ignore = [
121- " D200" , " D202" , " D401" , " D105" ,
122- " W503" , " W504" ,
123- " E731" , " E131" , " E251" , " E303" ,
124- " B024"
142+ [tool .ruff .lint .isort ]
143+ known-first-party = [ " {{ cookiecutter.package_name }}" ]
144+ known-third-party = [ " numpy" , " pandas" ]
145+ sections = [
146+ " FUTURE" ,
147+ " STDLIB" ,
148+ " THIRDPARTY" ,
149+ " NUM" ,
150+ " FIRSTPARTY" ,
151+ " LOCALFOLDER" ,
125152]
126- per-file-ignores = [
127- " docs/src/conf.py:D100" ,
128- " tests/*:D100,D101,D102,D103,D104,D105" ,
129- " tests/conftest.py:D101,D102,D103,E402" ,
130- " */__init__.py:D104,F401"
131- ]
132- max-line-length = 80
133- count = true
153+ no-lines-before = [ " LOCALFOLDER" ]
154+ lines-after-imports = 1
155+ combine-as-imports = true
156+ force-sort-within-sections = true
157+ case-sensitive = false
158+ order-by-type = true
159+ length-sort = true
160+ force-wrap-aliases = true
161+ use-parentheses = true
162+ indent = " "
163+ balanced-wrapping = true
164+ include-trailing-comma = true
165+ multi-line-output = 3
134166exclude = [
135- " .git" ,
136- " __pycache__" ,
137- " build" ,
138167 " docs/_build" ,
139- " dist"
140168]
141169
142170[tool .rstcheck ]
0 commit comments