mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
2.8 KiB
2.8 KiB
Comment Cleanup Summary
Removed Problematic Comments
1. Vague "Optionally" Comments
Removed from: surfsense_backend/app/routes/search_source_connectors_routes.py
- Removed all instances of
# Optionally update status in DB to indicate failure - These comments were vague and didn't provide actionable information
2. Redundant Explanatory Comments
Removed from: surfsense_backend/app/tasks/connector_indexers/github_indexer.py
- Removed
# Update the last_indexed_at timestamp for the connector only if requested - Removed
# Commit all changes at the end - Removed
# Log success
Removed from: surfsense_backend/app/routes/search_source_connectors_routes.py
- Removed
# Don't update timestamp in the indexing function(multiple instances) - Removed
# Note: This assumes 'name' and 'is_indexable' are not crucial for config validation itself - Removed inline comments like
# Use existing name,# Not used by validator
3. Verbose Docstring Notes
Cleaned up in: surfsense_backend/app/tasks/connector_indexers/github_indexer.py
- Removed redundant notes from parameter descriptions
- Simplified docstring to be more concise
4. Debug Files
Removed:
debug_github_connector.pyvalidate_github_fix.pyfinal_validation.py
Code Quality Improvements
✅ Before Cleanup:
# Optionally update status in DB to indicate failure
update_last_indexed=False, # Don't update timestamp in the indexing function
# Update the last_indexed_at timestamp for the connector only if requested
if update_last_indexed:
await update_connector_last_indexed(session, connector, update_last_indexed)
# Commit all changes at the end
await session.commit()
# Log success
await task_logger.log_task_success(...)
✅ After Cleanup:
update_last_indexed=False,
if update_last_indexed:
await update_connector_last_indexed(session, connector, update_last_indexed)
await session.commit()
await task_logger.log_task_success(...)
Benefits
- Cleaner Code: Removed unnecessary noise that didn't add value
- Better Readability: Code is now more concise and easier to read
- Professional Appearance: Removed vague/tentative language like "optionally"
- Reduced Maintenance: Fewer comments to maintain and update
- Code Review Friendly: Eliminates potential nitpick comments about redundant documentation
What Was Preserved
- Functional comments: Comments that explain complex business logic
- Important documentation: Docstrings and API documentation
- Contextual comments: Comments that provide necessary context for understanding code flow
The codebase now follows clean code principles with comments that add genuine value rather than restating what the code obviously does.