feat: add pre-commit hooks for local CI checks
- Black (auto-fix formatting on commit) - Flake8 (block on syntax errors and undefined names) - Bandit (security scan, non-blocking to match CI) - Tests (run on pre-push only) - Apply Black formatting fixes caught by the new hooks
This commit is contained in:
+12
-6
@@ -137,10 +137,12 @@ class GalleryDiagnostics:
|
||||
self.logger.info(f" [NOTE] Prompts in database: {prompt_count}")
|
||||
|
||||
# Check if generated_images table exists
|
||||
cursor = conn.execute("""
|
||||
cursor = conn.execute(
|
||||
"""
|
||||
SELECT name FROM sqlite_master
|
||||
WHERE type='table' AND name='generated_images'
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
has_images_table = cursor.fetchone() is not None
|
||||
self.logger.info(f" [IMG] Images table exists: {has_images_table}")
|
||||
@@ -174,10 +176,12 @@ class GalleryDiagnostics:
|
||||
conn.row_factory = sqlite3.Row
|
||||
|
||||
# Check if table exists
|
||||
cursor = conn.execute("""
|
||||
cursor = conn.execute(
|
||||
"""
|
||||
SELECT name FROM sqlite_master
|
||||
WHERE type='table' AND name='generated_images'
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
if not cursor.fetchone():
|
||||
return {
|
||||
@@ -191,13 +195,15 @@ class GalleryDiagnostics:
|
||||
self.logger.info(f" [STATS] Images in database: {image_count}")
|
||||
|
||||
# Get recent images
|
||||
cursor = conn.execute("""
|
||||
cursor = conn.execute(
|
||||
"""
|
||||
SELECT gi.*, p.text
|
||||
FROM generated_images gi
|
||||
LEFT JOIN prompts p ON gi.prompt_id = p.id
|
||||
ORDER BY gi.generation_time DESC
|
||||
LIMIT 5
|
||||
""")
|
||||
"""
|
||||
)
|
||||
recent_images = [dict(row) for row in cursor.fetchall()]
|
||||
|
||||
self.logger.info(f" [TIME] Recent images: {len(recent_images)}")
|
||||
|
||||
Reference in New Issue
Block a user