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

Migrate to Ruff #707

Open
ab623 opened this issue Apr 17, 2024 · 1 comment
Open

Migrate to Ruff #707

ab623 opened this issue Apr 17, 2024 · 1 comment

Comments

@ab623
Copy link
Contributor

ab623 commented Apr 17, 2024

Consider migrating to ruff for linting and for formatting.

Ruff already implements the black formatting style mostly, as well as other formatting tools like isort etc.

Generally I use the following in my pyproject.toml file

[tool.ruff.lint]
select = [
    # pycodestyle
    "E",
    # Warning
    "W",
    # Pyflakes
    "F",
    # pyupgrade
    "UP",
    # flake8-bugbear
    "B",
    # flake8-simplify
    "SIM",
    # isort
    "I",
]

Also consider using precommit to lint and format on the commit, to take the hassle out of running the formatted manually. You can also include the npm formatter at the same time.

For example my .pre-commit-config.yaml is as follows:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.2.2
  hooks:
    # Run the linter.
    - id: ruff
      args: [ --fix ]
    # Run the formatter.
    - id: ruff-format
@sissbruecker
Copy link
Owner

What would be the benefit? I'm quite happy with using Black for formatting at the moment, it's helpful and quite snappy.

Not sure about adding linting either. I've never worked with Python in a professional setting, so the codebase is mostly me making stuff work in a non-consistent style. I'm also not particularly interested in refactoring code just to satisfy the linter. Adding it might prevent some bugs, but so far there haven't been a lot of those, and some decent test coverage is more important to me.

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

No branches or pull requests

2 participants