-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.toml
More file actions
124 lines (112 loc) · 3.17 KB
/
ruff.toml
File metadata and controls
124 lines (112 loc) · 3.17 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
119
120
121
122
123
# Ruff configuration for MedCortex codebase
# Follows PEP 8 and modern Python industry standards
# Target Python version
target-version = "py311"
# Line length (PEP 8 recommends 79, but 88 is common for modern projects)
line-length = 88
# Exclude patterns
exclude = [
".git",
"__pycache__",
".venv",
"venv",
"env",
".eggs",
"*.egg",
"build",
"dist",
".ruff_cache",
"*.pyc",
".pytest_cache",
]
# Enable specific rule sets
[lint]
# Enable all rule categories
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"PIE", # flake8-pie
"PT", # flake8-pytest-style
"RUF", # Ruff-specific rules
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # eradicate
"PD", # pandas-vet
"PL", # Pylint
"PERF", # Perflint
"TRY", # tryceratops
"FLY", # flynt
"NPY", # NumPy-specific rules
"RSE", # flake8-raise
"RET", # flake8-return
"ICN", # flake8-import-conventions
"DTZ", # flake8-datetimez
"T20", # flake8-print
"ASYNC", # flake8-async
"S", # flake8-bandit
"TID", # flake8-tidy-imports
"Q", # flake8-quotes
"RUF", # Ruff-specific rules
]
# Ignore specific rules
ignore = [
"E501", # Line too long (handled by formatter)
"T201", # Print statements (acceptable for Streamlit apps)
"S101", # Use of assert (acceptable in some contexts)
"S603", # subprocess call (acceptable for CLI tools)
"S607", # Starting a process with a partial executable path (acceptable in some contexts)
"PLR0913", # Too many arguments (acceptable for some functions)
"PLR0912", # Too many branches (acceptable for complex logic)
"PLR0915", # Too many statements (acceptable for complex functions)
"COM812", # Trailing comma missing (handled by formatter)
"ISC001", # Implicitly concatenated string literals (acceptable in some contexts)
"N806", # Variable in function should be lowercase (acceptable for some cases)
]
# Allowed list for specific checks
unfixable = [
"F841", # Unused variable (may be intentional)
]
# Import sorting
[lint.isort]
known-first-party = ["app"]
force-sort-within-sections = true
split-on-trailing-comma = true
# PEP 8 naming conventions
[lint.pep8-naming]
ignore-names = [
"doc_id",
"doc_ids",
"file_obj",
"s3_url",
"cos_client",
"watsonx_*",
]
# Type checking
[lint.flake8-type-checking]
strict = false
# Formatting (Black-compatible)
[format]
# Use double quotes for strings
quote-style = "double"
# Indent with spaces
indent-style = "space"
# Use 4 spaces per indentation level
skip-magic-trailing-comma = false
# Line ending style
line-ending = "auto"
# Specific rule configurations
[lint.per-file-ignores]
# Ignore some rules for __init__.py files
"__init__.py" = ["F401"] # Unused imports (acceptable for __init__.py)
# Allow longer lines in test files
"tests/**/*.py" = ["E501"]
# Allow print statements in main.py (Streamlit app)
"app/main.py" = ["T201"]