-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
feat: migrate to ruff for linting and formatting #2530
base: main
Are you sure you want to change the base?
Conversation
lint fails are expected because the linters are removed and replaced with a different pipeline, both in pyproject and ci |
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.
It looks like ruff
found a lot of helpful stuff the other tools missed which is pretty cool. I don't like the if
/ elif
change though.
@@ -43,4 +33,4 @@ repos: | |||
additional_dependencies: [mdformat-gfm, mdformat-frontmatter, mdformat-pyproject] | |||
|
|||
default_language_version: | |||
python: python3 | |||
python: python3 |
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.
python: python3 | |
python: python3 | |
|
||
[tool.mdformat] | ||
number = true | ||
number = true |
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.
number = true | |
number = true | |
src/ape/__init__.py
Outdated
@@ -26,35 +26,34 @@ def __getattr__(name: str): | |||
if name not in __all__: | |||
raise AttributeError(name) | |||
|
|||
elif name == "reverts": | |||
if name == "reverts": |
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.
I've always preferred elif
in these cases in case you need to switch from returning here to building up a return (have had a rookie mistakes back in the day from that).
Can we disable this rule?
- Replace black, flake8, isort with unified ruff tooling - Disable RET (flake8-return) and SIM (flake8-simplify) rules per maintainer feedback - Remove some opinionated code style rewrites that would change if/elif patterns - Maintain existing code style preferences for conditionals
i disabled the rules you don't want, but there is a bunch more to go through. im handing off this pr at this point, it's up to your prefernce which of the remaining rules you like and which you find annoying. you can tune the active rules in you can find all the rules here https://docs.astral.sh/ruff/rules/
|
- Replace black, isort, and flake8 with ruff check and ruff format - Maintain same CI validation functionality with new tooling 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
- Replace black, isort, and flake8 with ruff check and ruff format in GitHub Actions - Remove unnecessary Black configuration from pyproject.toml - Complete migration from multiple linting tools to unified Ruff toolchain 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
I saw it raises for |
i think it's the T100 rule |
i went through all ruff rules with claude and updated the config to better fit the existing code style. this is what it had to say: Our refined Ruff configuration successfully addresses all the linting issues across both the src and tests directories. Here's a summary of the key aspects of our final configuration:
This configuration provides a good balance of code quality enforcement while respecting the existing patterns in the codebase. It can be applied incrementally, focusing first on the most critical issues before gradually addressing more stylistic concerns. |
] | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "google" |
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.
Oh sick
Summary
Test plan
🤖 Generated with Claude Code