-
Notifications
You must be signed in to change notification settings - Fork 12
Precommit improve #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Precommit improve #192
Conversation
- Add pyproject.toml with comprehensive ruff configuration - Increase line length limit to 100 characters for practicality - Add per-file ignores for dashboard star imports and maintenance scripts - Exclude Jupyter notebooks from strict linting - Update .pre-commit-config.yaml to use latest ruff version - Remove conflicting isort hook (ruff handles import sorting now) - Add ruff-format for consistent code formatting
- Run pre-commit hooks on entire codebase (93 files reformatted) - Fix import organization across all Python files - Remove trailing whitespace and ensure consistent line endings - Apply ruff formatting for consistent code style - Fix minor linting issues like noqa directive formatting - All pre-commit hooks now pass successfully
|
Caution Review failedThe pull request is closed. WalkthroughThis change is a comprehensive codebase-wide style and formatting update. It standardizes string quoting (favoring double quotes), consolidates multi-line statements into single lines where possible, and reorders import statements for consistency. Some configuration files are updated to reflect new linting practices, and function signatures are reformatted for clarity. No core logic, control flow, or exported entity functionality is altered. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (105)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request consolidates multi-line statements into single lines for improved readability and replaces isort with ruff for import sorting. The changes focus on formatting improvements and tooling modernization while maintaining code functionality.
- Replaced isort with ruff for import sorting in pre-commit configuration and added ruff-format hook
- Consolidated multi-line DataFrame definitions, function calls, and dict/list literals into single lines across test files
- Updated string quotes from single to double quotes for consistency with ruff formatting standards
Reviewed Changes
Copilot reviewed 102 out of 105 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_validate.py | Reformatted DataFrame definitions and function calls from multi-line to single-line format |
| tests/test_timeout_sensor.py | Removed blank line at beginning of file |
| tests/test_threshold.py | Consolidated multi-line DataFrame definitions and function parameters |
| tests/test_sql.py | Reformatted test method definitions and DataFrame creations |
| tests/test_slack.py | Consolidated multi-line dictionary definitions and function calls |
| tests/test_plots.py | Reformatted DataFrame definitions and function calls |
| tests/test_ml.py | Reordered imports and consolidated multi-line statements |
| tests/test_main.py | Split long assertion into multiple lines for readability |
| tests/test_llm.py | Consolidated DataFrame definitions and multi-line function calls |
| tests/test_jobs.py | Removed blank lines and reformatted multi-line configurations |
| tests/test_io.py | Reordered imports and consolidated multi-line statements |
| tests/test_external_duckdb_simple.py | Reformatted DataFrame definitions and function calls |
| tests/test_email.py | Consolidated multi-line configurations and function calls |
| tests/test_duckdb.py | Reformatted test method definitions and DataFrame creations |
| tests/test_df.py | Consolidated DataFrame definitions and function parameters |
| tests/test_dashboard.py | Reordered imports and reformatted DataFrame definition |
| tests/test_asciiart.py | Removed blank line and consolidated DataFrame definitions |
| tests/test_alerts.py | Reformatted function calls and DataFrame definitions |
📊 Test Coverage ReportCoverage: 59% (yellow) ✅ Coverage maintained or improved!
|
This pull request focuses on two main areas: improving import sorting and formatting in the codebase and enhancing the maintainability of the
anomstackproject. The most significant changes include replacingisortwithrufffor import sorting, consolidating multi-line statements into single lines for readability, and minor import reordering.Import Sorting and Configuration Updates:
.pre-commit-config.yaml: Removedisortasruffnow handles import sorting. Updated theruffversion and added theruff-formathook.Code Formatting Improvements:
anomstack/alerts/asciiart.py: Consolidated multiple multi-line statements into single lines for improved readability, such as in_gen_graph_string_part,_gen_value_string, andmake_alert_message. [1] [2] [3]anomstack/alerts/email.py: Reformatted multi-line statements insend_email_with_plotfor consistency and readability.anomstack/alerts/slack.py: Simplified multi-line statements insend_alert_slackandsend_alert_slack_with_plot. [1] [2]Import Reordering:
anomstack/alerts/email.py,anomstack/alerts/slack.py,anomstack/alerts/send.py, andanomstack/config.py: Reordered imports to align with best practices (e.g., standard library imports first, followed by third-party and local imports). [1] [2] [3] [4]These changes collectively aim to improve the codebase's maintainability, readability, and adherence to modern Python standards.
Summary by CodeRabbit
Style
Chores
Tests
No changes to application logic or user-facing features.