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

Replace flake8 with ruff #1155

Open
kimwnasptd opened this issue Nov 27, 2024 · 1 comment
Open

Replace flake8 with ruff #1155

kimwnasptd opened this issue Nov 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@kimwnasptd
Copy link
Contributor

Context

While working on a new charm canonical/github-profiles-automator#7 I realised that charmcraft init now is using ruff by default for lint and not flake8 canonical/charmcraft#1461

As of 27 November 2024 the auto-created configuration for ruff in pyproject.toml is the following

# Linting tools configuration
[tool.ruff]
line-length = 99
lint.select = ["E", "W", "F", "C", "N", "D", "I001"]
lint.extend-ignore = [
    "D203",
    "D204",
    "D213",
    "D215",
    "D400",
    "D404",
    "D406",
    "D407",
    "D408",
    "D409",
    "D413",
]
lint.ignore = ["D107"]
extend-exclude = ["__pycache__", "*.egg_info"]
lint.per-file-ignores = {"tests/*" = ["D100","D101","D102","D103","D104"]}

[tool.ruff.lint.mccabe]
max-complexity = 10

We should gradually replace flake8 in all our charms. Looking a bit around other teams have done this as well:

What needs to get done

  1. Replace the [tool.flake8] with [tool.ruff], if a repo contains a pyproject.yaml file
  2. Update the unit environment of tox to use ruff instead of flake8
  3. Update the corresponding .in file (or pyproject.yaml in case of poetry) to install ruff
  4. Run ruff check and fix all the incompatibilities

Definition of Done

When all of the Analytics charms are using ruff

@kimwnasptd kimwnasptd added the enhancement New feature or request label Nov 27, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-6597.

This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant