Introduce more Ruff linter rules (Python) - #3910
Merged
Merged
Conversation
nycrat
force-pushed
the
avah/more_ruff_linting
branch
from
September 1, 2026 05:01
1e00074 to
001edbe
Compare
Contributor
|
is there a way to separate what got changed by linter and what you changed in settings? |
nycrat
force-pushed
the
avah/more_ruff_linting
branch
4 times, most recently
from
September 1, 2026 05:49
6959b86 to
d75df62
Compare
Member
Author
There's the auto linter fixes and manual fixes cause some rules don't have auto fixes. But settings changes are all in |
Member
Author
|
I might reduce the scope of this PR actually. There would be way too many merge conflicts and too difficult to review this PR if we actually try to turn on all the linter rules all at once. |
nycrat
force-pushed
the
avah/more_ruff_linting
branch
from
September 1, 2026 15:49
6f35a7b to
cb3cc83
Compare
nycrat
marked this pull request as ready for review
September 1, 2026 16:08
nycrat
requested review from
Andrewyx,
StarrryNight,
sauravbanna and
williamckha
as code owners
September 1, 2026 16:08
StarrryNight
reviewed
Sep 2, 2026
StarrryNight
left a comment
Contributor
There was a problem hiding this comment.
Left a small comment. Other changes lGTM
| resource = creator() | ||
| except tbots_cpp.TbotsNetworkException as error: | ||
| logger.error(f"Error setting up robot status interface:\n{error}") | ||
| is_setup_successfully = False |
Member
Author
There was a problem hiding this comment.
completely unused variable 😆
StarrryNight
approved these changes
Sep 3, 2026
williamckha
approved these changes
Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR enables actually checking for the default linter rules defined by ruff: https://docs.astral.sh/ruff/default-rules/. In addition, a
pyproject.tomlis added to configure this linter. Currently, the only extra rules are added for checking wildcard imports, and sorting imports automatically. In the future, we may want to extend more rules to enforce a more strict code style.Note
The D rules regarding documentation style have now been turned off. Originally lint_and_format would lint but not return any errors even if our code did not fit the style. As a result, we have accumulated exactly 2586 lint errors when applying the D rules. Cleaning up our current docs should be done in another PR in my opinion.
Testing Done
Ran test suite and all tests still pass. Thunderscope also behaves the same.
Resolved Issues
resolves #3894, resolves #3681
Length Justification and Key Files to Review
Look at
lint_and_format.shandpyproject.tomlfor my manual changes. Most of the other changes are automatically applied by the linter.Review Checklist
It is the reviewers responsibility to also make sure every item here has been covered
.hfile) should have a javadoc style comment at the start of them. For examples, see the functions defined inthunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.TODO(or similar) statements should either be completed or associated with a github issue