-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.toml
More file actions
118 lines (97 loc) · 3.5 KB
/
ruff.toml
File metadata and controls
118 lines (97 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# from ruff doc: https://docs.astral.sh/ruff/configuration/
# if using vscode/codium, please add the following to your settings.json
# "ruff.configurationPreference": "filesystemFirst",
line-length = 88
indent-width = 4
# Assume Python 3.12
target-version = "py312"
extend-exclude = [
".git",
"__pycache__",
"docs/source/conf.py",
"src/martpy/utils/config.py",
"**/*.ipynb",
"tests/*"
]
[lint]
# https://docs.astral.sh/ruff/rules/
select = [
"W", # warnings
"F", # pyflakes
"E4", # pycodestyle
"E7", # pycodestyle:
"E9", # pycodestyle:
"E501", # pycodestyle:
"E303", # pycodestyle: too many blank lines
"E305", # pycodestyle: two blank lines between func
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear, B950
"C4", # flake8-comprehensions
# "I", # isort
"ICN", # flake8-import-conventions
"NPY", # NumPy specific rules
"PIE", # flake8-pie
"SIM", # flake8-simplify
"YTT", # flake8-2020
# "C901", # McCabe complexity
# "DOC", # pydoclint
# "EM", # flake8-errmsg
# "EXE", # flake8-executable // remove shebangs
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib
# "RET", # flake8-return
# "UP", # pyupgrade
# # "RUF", # Ruff-specific
]
ignore = [
"E401", # multiple import in one line
"W293", # blank line with whitespace
"E203", # whitespace before ':' https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
"E226", # missing space before arithmetic
"E221", # mutliple space before operator; ok, this may be not pythonnic but so much convenient with vim
"E227", # missing white space around operatro
"E231", # missing whitespace after , => in slice, not so good
"E721", # isinstance and not type ==
"W291", # trailing whitespace
"E501" # line too long, deal with it later, just use ruler in texteditor
]
# Allow fix for all enabled rules (when `--fix`) is provided.
# fixable = ["ALL"]
# 3. Avoid trying to fix flake8-bugbear (`B`) violations.
unfixable = ["B"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# allow comment too long
pycodestyle.ignore-overlong-task-comments = true
task-tags = ["memo"]
preview = true
# 4. Ignore `E402` (import violations) in all `__init__.py` files, and in selected subdirectories.
[lint.per-file-ignores]
"__init__.py" = ["E402", "F403", "F401"]
"**/{tests,docs,tools}/*" = ["E402"]
[lint.flake8-quotes]
docstring-quotes = "double"
[format]
line-ending = "lf"
# Like Black, use double quotes for strings.
# quote-style = "double" # "single"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
# https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#trailing-commas
skip-magic-trailing-comma = false
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false
# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
[lint.isort]
# Use a single line after each import block.
lines-after-imports = 2