@@ -84,13 +84,113 @@ fix = true
8484src = [" src" ]
8585unsafe-fixes = true
8686target-version = " py39"
87+ exclude = [
88+ " src/galileo/resources" ,
89+ ]
8790
8891[tool .ruff .format ]
8992skip-magic-trailing-comma = true
9093
9194[tool .ruff .lint ]
92- select = [" E4" , " E7" , " E9" , " F" , " I" , " UP" , " ASYNC" ]
93- ignore = []
95+ select = [
96+ # Pyflakes (basic errors)
97+ " F" ,
98+ # Pycodestyle (style errors)
99+ " E4" , " E7" , " E9" , " W6" ,
100+ # Import sorting
101+ " I" ,
102+ # Pyupgrade (Python version upgrades)
103+ " UP" ,
104+ # Async-related checks
105+ " ASYNC" ,
106+ # Flake8-bugbear (common bugs)
107+ " B" ,
108+ # Flake8-comprehensions (list/set/dict comprehension issues)
109+ " C4" ,
110+ # Flake8-pie (unnecessary code patterns)
111+ " PIE" ,
112+ # Flake8-simplify (code simplification)
113+ " SIM" ,
114+ # Pylint-like rules (selective)
115+ " PLC" , " PLE" , " PLW" ,
116+ # Ruff-specific rules
117+ " RUF" ,
118+ # Flake8-bandit (security issues)
119+ " S" ,
120+ # Flake8-blind-except (bare except clauses)
121+ " BLE" ,
122+ # Flake8-boolean-trap (boolean trap antipattern)
123+ " FBT" ,
124+ # Flake8-unused-arguments
125+ " ARG" ,
126+ # Flake8-pytest-style
127+ " PT" ,
128+ # Flake8-return (return statement issues)
129+ " RET" ,
130+ # Flake8-implicit-str-concat
131+ " ISC" ,
132+ # Type checking related (important for bug catching)
133+ " ANN001" , " ANN201" , " ANN202" , " ANN205" , " ANN206" ,
134+ ]
135+ ignore = [
136+ # Ignore overly strict rules (aligned with popular frameworks)
137+ " S101" , # Use of assert (needed for tests)
138+ " PLR0913" , # Too many arguments
139+ " PLR2004" , # Magic value used in comparison
140+ " B008" , # Do not perform function calls in argument defaults
141+ " FBT001" , # Boolean positional arg in function definition
142+ " FBT002" , # Boolean default arg in function definition
143+ " S603" , # subprocess call: check for execution of untrusted input
144+ " S607" , # Starting a process with a partial executable path
145+ " PLR0911" , # Too many return statements
146+ " PLR0912" , # Too many branches
147+ " PLR0915" , # Too many statements
148+ " PLW2901" , # Redefined loop variable
149+ # Type annotation related (balance strictness)
150+ " ANN101" , # Missing type annotation for `self` (unnecessary)
151+ " ANN102" , # Missing type annotation for `cls` (unnecessary)
152+ " ANN002" , # Missing type annotation for `*args` (impractical to enforce)
153+ " ANN003" , # Missing type annotation for `**kwargs` (impractical to enforce)
154+ " ANN401" , # Dynamically typed expressions (Any) are disallowed
155+ # Unused arguments (often legitimate in wrappers, callbacks, etc.)
156+ " ARG001" , # Unused function argument
157+ " ARG002" , # Unused method argument
158+ " ARG005" , # Unused lambda argument (common in callbacks)
159+ # Exception handling (often too strict)
160+ " BLE001" , # Do not catch blind exception (sometimes necessary)
161+ " B904" , # Use raise ... from err (not always needed)
162+ # Style preferences (overly pedantic)
163+ " SIM102" , # Use single if statement (readability preference)
164+ " PLC0206" , # Extracting value from dictionary without calling .items()
165+ " PLW0127" , # Self-assignment of variable (sometimes needed)
166+ # Additional common ignores from popular frameworks
167+ " S311" , # Standard pseudo-random generators (false positive for backoff/timing)
168+ " S324" , # Insecure hash functions (sometimes needed for non-crypto)
169+ " PLR0914" , # Too many local variables
170+ ]
171+
172+ [tool .ruff .lint .per-file-ignores ]
173+ # Ignore most linting rules for test files (focus on functionality, not style)
174+ "tests/**/*.py" = [
175+ # Type annotations (not critical for tests)
176+ " ANN" , # All annotation rules
177+ # Complexity (tests can be complex)
178+ " PLR" , # All pylint refactor rules (complexity, etc.)
179+ # Security (tests often need assertions, subprocess, etc.)
180+ " S" , # All bandit security rules
181+ # Style preferences (less important in tests)
182+ " FBT" , # Boolean trap rules
183+ " ARG" , # Unused argument rules
184+ " RET" , # Return statement rules
185+ " SIM" , # Simplify rules
186+ " C4" , # Comprehension rules
187+ " PIE" , # Unnecessary code patterns
188+ " ISC" , # Implicit string concatenation
189+ # Common test patterns
190+ " B008" , # Function calls in argument defaults
191+ " B017" , # Do not assert blind exception (needed for pytest.raises)
192+ " PT" , # Pytest style rules (can be overly strict)
193+ ]
94194
95195[tool .ruff .lint .isort ]
96196known-first-party = [" galileo_core" ]
@@ -108,12 +208,41 @@ wrap-descriptions = 120
108208
109209[tool .mypy ]
110210mypy_path = [" src" ]
211+ # Type checking strictness (balanced for production use)
111212disallow_untyped_defs = true
112- disable_error_code = [" import-untyped" ]
213+ disallow_incomplete_defs = true
214+ disallow_untyped_decorators = false # Often problematic with third-party decorators
215+ disallow_untyped_calls = false # Set to false to avoid issues with external libraries
216+ # Error detection
217+ warn_redundant_casts = true
218+ warn_unused_ignores = true
219+ warn_return_any = false # Too noisy with external APIs
220+ warn_unreachable = true
221+ # Import handling
113222ignore_missing_imports = true
114- no_implicit_optional = false
115223follow_imports = " skip"
224+ # Optional handling
225+ no_implicit_optional = true # Good practice for modern Python
226+ strict_optional = true
227+ # Error codes (balanced approach)
228+ disable_error_code = [
229+ " import-untyped" ,
230+ " misc" , # Disable misc warnings (like untyped decorators we can't control)
231+ ]
232+ enable_error_code = [" truthy-bool" , " redundant-expr" , " unused-awaitable" ]
233+ # Plugins
116234plugins = [" pydantic.mypy" ]
235+ # Additional strictness (keep what catches real bugs)
236+ check_untyped_defs = true
237+ strict_equality = true
238+ extra_checks = true
239+ # Performance and compatibility
240+ show_error_codes = true
241+ pretty = true
242+ show_column_numbers = true
243+ # Incremental mode for better performance on individual files
244+ incremental = true
245+ sqlite_cache = true
117246
118247# Release.
119248
0 commit comments