Skip to content
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

chore: consolidate linters and formatter into Ruff for improved performance and simplicity #216

Merged
merged 13 commits into from
Dec 3, 2024

Conversation

jamagalhaes
Copy link
Collaborator

@jamagalhaes jamagalhaes commented Nov 29, 2024

KOALA-2299

This PR replaces the existing linters and formatter with Ruff, a fast Python linter and code formatter. Ruff serves as a drop-in replacement for tools like Flake8 (including various plugins), isort, pydocstyle, pyupgrade, black, etc.

Key Changes:

  • Tool Consolidation: Replaces multiple tools—such as black, isort, pydocstyle—with Ruff, streamlining the development workflow.
  • Single Configuration: Consolidates linter and formatter configurations into a single section, simplifying setup and maintenance.
  • Configuration Updates: Modifies configuration files to align with Ruff's settings and capabilities.
  • Linters Enabled:
    • Enables a wide range of linting checks, covering more code quality aspects than the previous setup:
      • B: flake8-bugbear (focus on code quality issues and best practices).
      • C4: flake8-comprehensions (improves comprehension readability and efficiency).
      • D: pydocstyle (docstring conventions).
      • E: pycodestyle errors.
      • F: Pyflakes (static analysis for Python code).
      • I: isort (import sorting).
      • SIM: flake8-simplify (simplifies overly complex patterns).
      • UP: pyupgrade (modernizes Python syntax).
      • W: pycodestyle warnings.

Benefits:

  • Performance Improvement: Ruff is designed for speed, providing faster linting and formatting compared to the previous toolchain.
  • Simplified Maintenance: Managing a single tool reduces complexity and potential conflicts between different linters and formatters.

IDE Integration:

Ruff supports integration with various editors and IDEs to enhance the development experience. For setup instructions, refer to the Editor Integration guide.

@jamagalhaes jamagalhaes marked this pull request as ready for review November 29, 2024 16:46
@jamagalhaes jamagalhaes requested a review from a team as a code owner November 29, 2024 16:46
@jamagalhaes jamagalhaes changed the title chore: replace linters and formatter with Ruff chore: consolidate linters and formatter into Ruff for improved performance and simplicity Nov 29, 2024
@beaugunderson
Copy link
Member

love it, this was on my list for home-app too--saw a complaint recently that it didn't do isort equivalent but it looks like it does based on your PR?

@jamagalhaes
Copy link
Collaborator Author

There are a few differences, you can check them here: https://docs.astral.sh/ruff/faq/#how-does-ruffs-import-sorting-compare-to-isort

@jamagalhaes jamagalhaes merged commit 15d2809 into main Dec 3, 2024
6 checks passed
@jamagalhaes jamagalhaes deleted the chore/ruff-devtools branch December 3, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants