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

Moving from pylint+black+isort+bandit to Ruff Linter #829

Merged
merged 5 commits into from
Jun 27, 2024

Conversation

L77H
Copy link
Contributor

@L77H L77H commented Jun 26, 2024

Description of the changes being introduced by the pull request:

  • pylint, bandit, black and isort calls replaced by ruff calls in tox.ini
  • ruff requirement added to requirements-lint.txt
  • ruff config added to pyproject.toml: this covers currently only the functionality as before (isort, pylint and bandit), to be extended in the next PRs.
  • code fixes made to comply with ruff rules
  • _vendor exclusion added to mypy.ini
  • black and isort config removed from pyproject.toml
  • inline ruff error suppression added where necessary (noqa)

Fixes #440

(First ever PR, so feedback on mistakes more than welcome)

@jku
Copy link
Collaborator

jku commented Jun 26, 2024

Looks like a good start, thanks.

I'll leave at least some comments today, might not have time for a full review . Just as a heads-up: I originally suggested doing small iterative PRs mostly because there might be quite a few comments if everything is done in one go... but we'll see how it goes, it looks manageable so far.

Copy link
Collaborator

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good and the speed is awesome. Thanks for the work,

If isort, black, pylint and bandit are no longer used, then most references should be removed as well. could do some grepping to find all cases but at least

  • remove them from requirements-lint.txt
  • remove all # pylint: disable= comments in code
  • remove references in .github/dependabot.yml (and add ruff instead)

I left some specific comments in-line as well

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
mypy.ini Show resolved Hide resolved
@L77H
Copy link
Contributor Author

L77H commented Jun 26, 2024

I'll be making the following changes:

  • removing all inline pylint, bandit comments
  • update requirements-lint.txt
  • update the dependabot.yml
  • suppressing for now all line-too-long warnings (to be addressed again in the future?)
  • remove mypy.ini file list

Please let me know if I missed anything.

After that in a new PR I can start adding more and more Rules to the Rules selector until we reach ["ALL"]. Now with all rules there are more than 2400 errors popping up, so I suggest to do it iteratively.

@jku
Copy link
Collaborator

jku commented Jun 26, 2024

After that in a new PR I can start adding more and more Rules to the Rules selector until we reach ["ALL"]. Now with all rules there are more than 2400 errors popping up, so I suggest to do it iteratively.

Yeah "ALL" is a bit demanding (even assuming a lengthy ignore list): it's a good goal to have but not required in any way. There's certainly rulesets that would be nice to enable so if you're willing to do more than this PR, that sounds great.

@L77H
Copy link
Contributor Author

L77H commented Jun 26, 2024

Sure, if you can let me know which rule sets would be nice to have, I will be working on adding those! I also noticed that not all files in _gpg have type annotations yet, maybe in a next PR I can also work on completing that.

Copy link
Collaborator

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I have a couple of small requests:

  • "/pylintrc" should still be removed from the sdist include in pyproject.toml -- this might break the release build otherwise
  • .pre-commit-config.yaml looks like it should be modified based on this: I would say it's not required as part of this PR but could you file an issue so we don't forget?

After this it looks good to merge. I filed an issue for the line length decision (so we don't just ignore E501 forever) #830.

@jku jku mentioned this pull request Jun 27, 2024
Copy link
Collaborator

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

@jku jku merged commit 6eb458f into secure-systems-lab:main Jun 27, 2024
14 checks passed
@L77H L77H deleted the move_to_ruff_branch branch June 27, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix linter issues where needed
2 participants