Skip to content
This repository was archived by the owner on Jun 13, 2026. It is now read-only.

Commit 20abb71

Browse files
committed
fixing linting
1 parent d3a15a4 commit 20abb71

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
hooks:
1616
- id: ruff
1717
name: Ruff auto-fix
18-
args: [--fix, --select, "F,E,W,I", --ignore, "E501,W293"] # Only critical issues
18+
args: [--fix, --select, "F,E,W,I,TRY", --ignore, "E501,W293,TRY401"] # Include TRY rules, ignore redundant exception in log
1919
- id: ruff-format
2020
name: Ruff formatter
2121

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ The system uses a nested identity format:
8888
## Development Guidelines
8989
- **CRITICAL: Pre-commit hooks are configured for practical development**
9090
- Setup: `uv run scripts/setup.py --dev`
91-
- On commit: Auto-fixes formatting, checks syntax, removes trailing whitespace, runs type checking
91+
- On commit: Auto-fixes formatting, checks syntax, removes trailing whitespace, runs type checking, checks exception handling (TRY rules)
9292
- On push: Runs tests and security scans
9393
- Manual full check: `uv run scripts/check.py --fix`
94-
- Always use ruff for python lint checking
94+
- Always use ruff for python lint checking (includes TRY rules for proper exception handling)
9595
- Always use uv, instead of python, when writing python scripts
9696
- **Type checking with mypy**:
9797
- Runs automatically on every commit via pre-commit hooks

src/database.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ def commit_batch(self):
228228
self.batch_buffer = []
229229
self.last_commit_time = time.time()
230230

231-
except sqlite3.Error as e:
232-
self.logger.exception(f"Failed to commit batch: {e}")
231+
except sqlite3.Error:
232+
self.logger.exception("Failed to commit batch")
233233
raise
234234
else:
235235
# Return the count of committed records
@@ -367,8 +367,8 @@ def get_readings(self, limit: int | None = None) -> list:
367367
columns = [desc[0] for desc in cursor.description]
368368
rows = cursor.fetchall()
369369
return [dict(zip(columns, row, strict=False)) for row in rows]
370-
except Exception as e:
371-
self.logger.exception(f"Failed to get readings: {e}")
370+
except Exception:
371+
self.logger.exception("Failed to get readings")
372372
return []
373373

374374
def get_reading_stats(self) -> dict:
@@ -422,8 +422,8 @@ def get_database_stats(self) -> dict:
422422
"avg_insert_time_ms": 0.0, # Not tracking this
423423
},
424424
}
425-
except Exception as e:
426-
self.logger.exception(f"Failed to get database stats: {e}")
425+
except Exception:
426+
self.logger.exception("Failed to get database stats")
427427
return {
428428
"total_readings": 0,
429429
"anomaly_count": 0,

0 commit comments

Comments
 (0)