-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.toml
More file actions
101 lines (91 loc) · 3.07 KB
/
Copy pathruff.toml
File metadata and controls
101 lines (91 loc) · 3.07 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
# Ruff configuration for AuditAgent
# https://docs.astral.sh/ruff/
# Exclude common directories
exclude = [
".venv",
"env",
".git",
"__pycache__",
"build",
"dist",
"*.egg-info",
".pytest_cache",
".ruff_cache",
]
# Set line length to match Black's default
line-length = 88
# Target Python 3.8+
target-version = "py38"
[lint]
# Enable specific rule sets
# F = Pyflakes (errors)
# E/W = pycodestyle (errors and warnings)
# I = isort (import sorting)
# N = pep8-naming
# UP = pyupgrade (upgrade syntax for newer Python)
# S = flake8-bandit (security)
# B = flake8-bugbear (likely bugs and design problems)
# A = flake8-builtins (check for python builtins being used as variables)
# C4 = flake8-comprehensions
# T20 = flake8-print (disallow print statements)
# ERA = eradicate (commented-out code)
select = [
"F", # Pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"S", # bandit (security)
"B", # bugbear
"A", # builtins
"C4", # comprehensions
"ERA", # eradicate
]
# Ignore specific rules
ignore = [
"E501", # Line too long (handled by formatter)
"S101", # Use of assert detected (needed for tests)
"S311", # Standard pseudo-random generators are not suitable for security/cryptographic purposes
"B008", # Do not perform function calls in argument defaults (common pattern in Typer CLI apps)
"A002", # Argument shadowing a built-in (format is common parameter name)
"N805", # First argument should be named self (cls is correct for Pydantic validators)
"ERA001", # Commented-out code (useful for examples and documentation)
"B904", # raise ... from err (simplicity over explicit chaining for CLI tool)
]
# Allow autofix for specific rules
fixable = ["ALL"]
unfixable = []
[lint.per-file-ignores]
# Test files can use assert and have longer lines
"tests/**/*.py" = ["S101", "S106", "S108", "S105", "F841"]
# Examples can have print statements and hard-coded passwords for demonstration
"examples/**/*.py" = ["T20", "S106"]
# CLI can have print statements
"audit_agent/cli.py" = ["T201"]
# Credentials module needs AutoAddPolicy for SSH key testing
"audit_agent/core/credentials.py" = ["S507"]
# Base device module - exception handling patterns are intentional
"audit_agent/devices/base.py" = ["S110"]
# Linux iptables - exception handling patterns are intentional
"audit_agent/devices/linux_iptables.py" = ["S110"]
# Enforcement engine - unused variables in comprehensions are expected
"audit_agent/enforcement/engine.py" = ["B007"]
[lint.isort]
# Use single line imports for better git diffs
force-single-line = false
# Organize imports similar to Black
combine-as-imports = true
known-first-party = ["audit_agent"]
[lint.mccabe]
# Max complexity
max-complexity = 10
[format]
# Use double quotes for strings
quote-style = "double"
# Use spaces for indentation
indent-style = "space"
# Respect magic trailing comma
skip-magic-trailing-comma = false
# Format docstrings
docstring-code-format = true