-
Notifications
You must be signed in to change notification settings - Fork 10
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
, isort
and pydocstyle
with ruff
#541
Conversation
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.
Thanks for taking a crack at it! Looks good, I just have a few comments about re-organizing those Make targets and possibly replace black
with ruff format
. Let me know what you think.
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.
Looks like ruff-doc
doesn't pick up the ignored rules.
Yeah, I am trying a few things locally to see why. Based on the docs, it should. |
Looks like if I dropped the |
This is what I use, I think we will need to add more items to [tool.ruff.lint]
extend-select = ["D212"]
select = ["D"]
ignore = [
# D105 Docstrings for magic methods
"D105",
# D107 Docstrings for __init__
"D107",
# D203 as it conflicts with D211 https://github.com/PyCQA/pydocstyle/issues/141
"D203",
# D205 1 blank line required between summary line and description, awkward spacing
"D205",
# D400 First line should end with a period, doesn't work when sentence spans 2 lines
"D400",
]
extend-ignore = ["E203"]
per-file-ignores = {"__init__.py" = ["F401"]}
pydocstyle.convention = "pep257" |
This is the part I am not sure. We either change how I think I prefer to have everything in The downside is that we will always check |
Agreed, let's not duplicate those configs in the Makefile.
True, not ideal but ruff is fast ;). We can also merge |
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.
LGTM, thanks!
@gruberb FYI, you can also assign |
References
JIRA: DISCO-2165
Description
Replacing
flake8
,isort
andpydocstyle
withruff
flake8
is a linter, which can be replaced withruff check
isort
can sort imports, which is not possible with a single command yet. We have to useruf check --fix && ruff format
(there is an open discussion to have a combined command: Unified command for linting and formatting astral-sh/ruff#8232)pydocstyle
is supported out of the box, and the configuration can be taken over toruff
.I also attempted to upgrade dependencies which are still using
flake8
,isort
orpydocstyle
in our version, and have since updated toruff
.flake8
commonmark
(imported throughrich
andscalene
.commonmark
is also not maintained anymore, andmarkdown-it-py
recommended.)upgraded to versiontyper
0.11.0
which replacesflake8
withruff
uvloop
(throughuvicorn
)bandit
isort
pydocstyle
Changes in linting
This commit holds the changes from
ruff check
: 527dd5b.Challenges
ruff
is not a 1:1 replacement forisort
, which means our "just do sorting withmake isort
doesn't truly work anymore. I kept the step, but the story is slightly more complicated: https://docs.astral.sh/ruff/formatter/#sorting-importsFurther reading
To discuss
We should be able to replace
black
withruff
as well: https://docs.astral.sh/ruff/faq/#is-the-ruff-linter-compatible-with-blackPR Review Checklist
Put an
x
in the boxes that apply[DISCO-####]
, and has the same title (if applicable)[load test: (abort|warn)]
keywords are applied (if applicable)