@@ -67,17 +67,43 @@ filterwarnings = [
6767 " ignore:.*metadata to be logged in the data array, it is necessary to install the orsopy package.:UserWarning" ,
6868]
6969
70- [tool .bandit ]
71- # Excluding tests because bandit doesn't like `assert`.
72- exclude_dirs = [" docs/conf.py" , " tests" ]
70+ [tool .ruff ]
71+ line-length = 88
72+ extend-include = [" *.ipynb" ]
73+ extend-exclude = [
74+ " .*" , " __pycache__" , " build" , " dist" , " install" ,
75+ ]
76+
77+ [tool .ruff .lint ]
78+ # See https://docs.astral.sh/ruff/rules/
79+ select = [" B" , " C4" , " DTZ" , " E" , " F" , " G" , " I" , " PERF" , " PGH" , " PT" , " PYI" , " RUF" , " S" , " T20" , " UP" , " W" ]
80+ ignore = [
81+ # Conflict with ruff format, see
82+ # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
83+ " COM812" , " COM819" , " D206" , " D300" , " E111" , " E114" , " E117" , " ISC001" , " ISC002" , " Q000" , " Q001" , " Q002" , " Q003" , " W191" ,
84+ ]
85+ fixable = [" I001" , " B010" ]
86+ isort.known-first-party = [" essreflectometry" ]
87+ pydocstyle.convention = " numpy"
7388
74- [tool .black ]
75- skip-string-normalization = true
89+ [tool .ruff .lint .per-file-ignores ]
90+ # those files have an increased risk of relying on import order
91+ "__init__.py" = [" I" ]
92+ "tests/*" = [
93+ " S101" , # asserts are fine in tests
94+ " B018" , # 'useless expressions' are ok because some tests just check for exceptions
95+ ]
96+ "*.ipynb" = [
97+ " E501" , # longer lines are sometimes more readable
98+ " F403" , # *-imports used with domain types
99+ " F405" , # linter may fail to find names because of *-imports
100+ " I" , # we don't collect imports at the top
101+ " S101" , # asserts are used for demonstration and are safe in notebooks
102+ " T201" , # printing is ok for demonstration purposes
103+ ]
76104
77- [tool .isort ]
78- skip_gitignore = true
79- profile = " black"
80- known_first_party = [" essreflectometry" ]
105+ [tool .ruff .format ]
106+ quote-style = " preserve"
81107
82108[tool .mypy ]
83109strict = true
@@ -87,5 +113,4 @@ enable_error_code = [
87113 " redundant-expr" ,
88114 " truthy-bool" ,
89115]
90- show_error_codes = true
91116warn_unreachable = true
0 commit comments