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

Add more rules to ruff linter #4227

Open
4 tasks
emdneto opened this issue Oct 15, 2024 · 6 comments
Open
4 tasks

Add more rules to ruff linter #4227

emdneto opened this issue Oct 15, 2024 · 6 comments
Assignees
Labels
build & infra Issues related to build & infrastructure. contribfest good first issue Good first issue help wanted

Comments

@emdneto
Copy link
Member

emdneto commented Oct 15, 2024

Now we are using ruff, the idea is that we add more rules to ruff linter in separate PRs since there are a lot of fixes to do (maybe create a separate issues for that) . e.g.,

select = [
  "I",   # isort
  "F",   # pyflakes
  "E",   # pycodestyle errors
  "W",   # pycodestyle warnings
  "N",   # pep8-naming
  "C90", # mccabe
  "RUF", # Ruff-specific rules
  "UP",  # pyupgrade
  "ERA", # eradicate
  "PLC", # pylint - convention
  "PLE", # pylint - error
  "PLW", # pylint - warning
  "A",   # flake8-builtins
  "B",   # flake8-bugbear
  "BLE", # flake8-blind-except
  "C4",  # flake8-comprehensions
  "Q",   # flake8-quotes
  "G",   # flake8-logging-format
  "ICN", # flake8-import-conventions
  "ISC", # flake8-implicit-str-concat
  "PIE", # flake8-pie
  "PTH", # flake8-use-pathlib
  "RET", # flake8-return
  "S",   # flake8-bandit
  "SIM", # flake8-simplify
  "T10", # flake8-debugger
  "T20", # flake8-print
  "TCH", # flake8-type-checking
  "TID", # flake8-tidy-imports
]

I think a good start would be to add support for:

Originally posted by @emdneto in #4223 (comment)

@emdneto emdneto added good first issue Good first issue help wanted build & infra Issues related to build & infrastructure. labels Oct 15, 2024
@Neema-Joju
Copy link

Neema-Joju commented Oct 17, 2024

Hi,
I am an Outreachy applicant.
May I work on this issue?

@Neema-Joju
Copy link

Thank you for assigning me this task.

When I added ruff rule A, I ran ruff check . as well. Should I fix them or do I keep adding the rules?
image

@emdneto
Copy link
Member Author

emdneto commented Oct 21, 2024

@Neema-Joju If the issues are easy to fix, I think you can open a PR adding rule "A" with the actual fixes so we can get more coverage from Ruff Linter.

@Neema-Joju
Copy link

@emdneto Ok. I'll create separate pull requests for different rules so, it will be easy for everyone to follow. As I work along I'll fix the issues that I can.

@Kludex
Copy link

Kludex commented Nov 22, 2024

The list of rules in the description are huge.

Can we copy the most used rules from more modern projects from the ecosystem?

Pydantic: https://github.com/pydantic/pydantic/blob/f9f4aee799ceb65b25b2f95a3c030b7df2e929d1/pyproject.toml#L190-L208
FastAPI: https://github.com/fastapi/fastapi/blob/8c29eaec25b3add7106e1cbfe0c217e4bbd6f187/pyproject.toml#L188-L197
Starlette: https://github.com/encode/starlette/blob/ad7ff0800de563528691d26dcccf3c055cab0571/pyproject.toml#L56-L65

Also, related, but we can move away from pylint, like all modern projects? Since most of the rules are pedantic/redundant?

@emdneto
Copy link
Member Author

emdneto commented Nov 22, 2024

@Kludex, sure. The description is just a list of rules to see what's more suitable for us; we don't need to implement all of them. Would you be open to sending a PR adding the rules?

About pylint, I think we can drop pylint at some point when we are sure ruff is enough and we don't have pylint CI failing for a while

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build & infra Issues related to build & infrastructure. contribfest good first issue Good first issue help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants