-
Notifications
You must be signed in to change notification settings - Fork 51
1510 replace black with ruff #1512
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
Conversation
- Remove [tool.black] and [tool.isort] configuration sections - Add ruff>=0.8.0 as development dependency - Configure [tool.ruff] with line-length=79, target-version=py311 - Set up [tool.ruff.format] with Black-compatible settings - Configure [tool.ruff.isort] with Django-aware import sorting - Add [tool.ruff.lint] with basic linting rules (E, F, W, I) - Exclude migrations directory from formatting and linting This maintains existing code style while consolidating formatting, import sorting, and linting into a single faster tool.
- Update pre-commit configuration to use Ruff instead of Black/isort - Add Ruff as development dependency in pyproject.toml - Configure Ruff with Django-aware import sorting and formatting rules - Apply Ruff formatting across entire codebase: - Fix import ordering and grouping - Remove unused imports and variables - Fix string formatting (remove f-string prefixes where unnecessary) - Improve code style consistency - Fix minor linting issues (unused variables, comparison style) - Update task completion status in migration spec - Maintain existing line length and formatting preferences This migration consolidates two tools (Black + isort) into one (Ruff) while maintaining code quality standards and improving development workflow efficiency.
- Update tech.md to reference Ruff as combined linter and formatter - Update structure.md to use Ruff for formatting and import sorting - Maintain 79-character line length configuration - Preserve Django-aware import sorting documentation
- Remove custom line-length setting (79 -> 88 chars default) - Remove custom exclude patterns, using Ruff's built-in defaults - Remove custom lint rule selections, using recommended rule set - Remove custom isort and format configurations - Keep Django-specific __init__.py wildcard import allowance - Update documentation to reflect simplified configuration
- Test formatting compatibility with existing codebase - Verify import sorting functionality and Django-aware organization - Validate pre-commit hooks execute correctly in containerized environment - Confirm migration files are properly excluded from formatting - Fix 31 import sorting issues and reformat 25 files during testing - All Ruff functionality working as expected with proper exclusion patterns
- Move linter settings to [tool.ruff.lint] section - Remove COM812 rule to avoid conflicts with formatter - Add COM812 to ignore list to prevent formatter conflicts - Maintain all existing rule selections and configurations Resolves warnings about deprecated top-level linter settings and formatter conflicts with COM812 rule.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- None values: Sets them to 0 - Negative values: Sets them to 0 - Positive values: Leaves them unchanged This preserves the original intent of the code while being more readable than the redundant max() calls.
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 migrates the codebase from Black and isort to Ruff for Python code formatting and linting. The migration consolidates two tools into one faster alternative while maintaining the same code style standards.
- Replaced Black and isort configuration with comprehensive Ruff setup in pyproject.toml
- Updated pre-commit hooks to use Ruff instead of Black and isort
- Applied automatic formatting changes throughout the codebase including f-string removal, import reorganization, and trailing comma additions
Reviewed Changes
Copilot reviewed 58 out of 59 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pyproject.toml | Replaced Black/isort config with comprehensive Ruff configuration and added Ruff dependency |
| .pre-commit-config.yaml | Updated hooks to use Ruff instead of Black and isort |
| Various Python files | Applied Ruff formatting including f-string simplification, import sorting, and style fixes |
| Documentation files | Updated references from Black/isort to Ruff in project documentation |
Comments suppressed due to low confidence (1)
coderdojochi/util.py:29
- [nitpick] The error message is overly verbose and redundant. Consider simplifying to: "Missing required parameters: subject, template_name, and recipients are required"
raise ValueError("Missing required parameters: 'subject', 'template_name', and 'recipients' are all required.")
No description provided.