forked from ApeWorX/ape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
160 lines (139 loc) · 6.14 KB
/
pyproject.toml
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
[build-system]
requires = ["setuptools>=75.0.0", "wheel", "setuptools_scm[toml]>=5.0"]
[tool.ape]
contracts_folder = "tests/functional/data/contracts/ethereum/local"
[tool.ape.test]
show_internal = true
[tool.mypy]
exclude = ["build/", "dist/", "docs/", "tests/integration/cli/projects/"]
check_untyped_defs = true
plugins = ["pydantic.mypy"]
[tool.setuptools_scm]
# The fallback version is so that CI/CD systems will use a more accurate version.
# Otherwise, you may have issues with plugins' pinning Ape and not using the expected version.
# This version is purposely set to really high minor so that it should always work
# with newer, stricter plugin releases.
# NOTE: This should be bumped with every minor release!
fallback_version = "0.8.999"
write_to = "src/ape/version.py"
[tool.pytest.ini_options]
norecursedirs = "projects"
# NOTE: 'no:ape_test' Prevents the ape plugin from activating on our tests
# And 'pytest_ethereum' is not used and causes issues in some environments.
addopts = """
-p no:pytest_ethereum
-p no:boa_test
"""
python_files = "test_*.py"
testpaths = "tests"
markers = """fuzzing: Run Hypothesis fuzz test suite
pip: tests that rely on pip install operations"""
timeout = 300
[tool.ruff]
target-version = "py39"
line-length = 100
[tool.ruff.lint]
# Select rule categories to enforce
select = [
# Core Python errors and style
"E", # pycodestyle errors
"F", # pyflakes
"W", # pycodestyle warnings
"I", # isort
"B", # flake8-bugbear - common bugs/design issues
"C4", # flake8-comprehensions - simplify comprehensions
"UP", # pyupgrade - modern Python features/idioms
"RET", # flake8-return - cleaner return statements
"SIM", # flake8-simplify - code simplification
"S", # flake8-bandit - security issues
"TCH", # flake8-type-checking - type annotation improvements
"T10", # flake8-debugger - detect debugger calls/imports
"FIX", # flake8-fixme - detect FIXME, TODO, XXX comments
]
# Rules to ignore
ignore = [
"E501",
# Specific bugbear issues
"B904", # Use 'raise from' in except blocks
"B006", # Mutable default arguments
"B007", # Loop control variable not used within loop body
"B012", # Jump statements in finally blocks
"B028", # No explicit stacklevel in warnings
# FIXME/TODO comments - these are intentional markers for future work
"FIX002", # Line contains TODO
"FIX004", # Line contains HACK
# Code structure preferences
"SIM102", # Use a single if statement instead of nested if statements
"SIM105", # Use contextlib.suppress instead of try-except-pass
"SIM108", # Use ternary operator instead of if-else block
"SIM113", # Use enumerate instead of manually incrementing counter
"SIM114", # If branches with identical arm bodies (combine with or)
"SIM115", # Use context manager for opening files
"SIM116", # Use dictionary instead of if-statements
"SIM117", # Multiple with statements
"B018", # Useless expression
# Return statement style
"RET501", # Do not explicitly return None
"RET502", # Implicit return at the end of function able to return non-None value
"RET503", # Missing explicit return at the end of function able to return non-None value
"RET504", # Unnecessary assignment before return
"RET505", # Unnecessary else after return
"RET506", # Unnecessary else after raise
"RET507", # Unnecessary else after continue
"RET508", # Unnecessary else after break
# Security issues (allow common patterns in the codebase)
"S101", # Use of assert (many asserts are used for type checking)
"S102", # Use of exec (needed in some specific places)
"S105", # Hardcoded password string
"S110", # Try-except-pass (common pattern for handling optional features)
"S112", # Try-except-continue
"S113", # Request without timeout
"S202", # Tarfile unsafe members
"S307", # Use of eval
"S311", # Suspicious non-cryptographic random usage
"S603", # Subprocess without shell=True
"S607", # Start process with partial path
# Style/readability issues (improve incrementally)
"C416", # Unnecessary comprehension (rewrite using list/set/dict)
"C408", # Unnecessary dict() call (rewrite as literal)
"C417", # Unnecessary map usage (replace with generator)
"C414", # Unnecessary list/dict call within another function
"C401", # Unnecessary generator (rewrite as comprehension)
"C409", # Unnecessary literal within tuple/list/dict call
"C419", # Unnecessary comprehension in call
"SIM101", # Duplicate isinstance call
"SIM103", # Needless boolean conversion
"SIM110", # Reimplemented builtin
"SIM118", # Use 'key in dict' instead of 'key in dict.keys()'
"SIM401", # Use dict.get instead of if-else block
"SIM910", # Use dict.get(key) instead of dict.get(key, None)
"TC001", # Move application import into type-checking block
"TC003", # Move standard library import into type-checking block
"TC006", # Add quotes to type expression in `typing.cast()`
"UP028", # Replace yield over for loop with yield from
]
[tool.ruff.lint.per-file-ignores]
"**/tests/**/*.py" = [
"D", # Don't require docstrings in tests
"E501", # Line length in tests is less critical
"S101", # Allow assert in tests
"B011", # Allow assert False in tests (common pattern)
]
"**/conftest.py" = [
"F401", # Unused imports in conftest.py are often for fixtures
"F841", # Allow unused variables in conftest (often for fixture side effects)
]
"**/tests/integration/cli/projects/**/*.py" = [
"F841", # These are test files that intentionally create errors
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.isort]
known-first-party = ["ape", "ape_accounts", "ape_console", "ape_ethereum", "ape_geth", "ape_networks", "ape_node", "ape_plugins", "ape_pm", "ape_test"]
[tool.ruff.format]
quote-style = "double"
line-ending = "auto"
indent-style = "space"
docstring-code-format = true
[tool.mdformat]
number = true