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

Replaces pylint with ruff #7438

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Replaces pylint with ruff #7438

wants to merge 7 commits into from

Conversation

Mic92
Copy link
Contributor

@Mic92 Mic92 commented Feb 16, 2024

Depends on #7436

Contributor Checklist:

  • I have updated the unit tests
  • I have created a file in the newsfragments directory (and read the README.txt in that directory)
  • I have updated the appropriate documentation

@Mic92 Mic92 changed the title Pylint Replaces pylint with ruff Feb 16, 2024
'pep8',
# spellcheck introduced in version 1.4.0
'pylint>=1.4.0',
'pyenchant',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are loosing spell checking here. I can bring in https://crates.io/crates/typos if desired.

Copy link
Member

Choose a reason for hiding this comment

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

I think this makes sense.

@Mic92
Copy link
Contributor Author

Mic92 commented Feb 16, 2024

As a follow up pull request, I would investigate all those pylint ignore comments. Some of them can be dropped now.

else:
# Split the string on whitespace to allow passing options in
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to disable warning that requires these changes. Often it's much more readable to have full else branch and a if statement there. If the main if and the else if checks are unrelated, this visual separation is a good way to hint to a logical separation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I revisit these changes after #7436

@@ -163,13 +163,13 @@ def test_compare(self):
b2 = self.makeService(attach_to_master=False, name='b', serviceid=21) # same args as 'b1'
b3 = self.makeService(attach_to_master=False, name='b', serviceid=20) # same id as 'a'

self.assertTrue(a == a) # pylint: disable=comparison-with-itself
self.assertTrue(a == a) # noqa: PLR0124
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to configure ruff to allow full name of the warning in places like here? The warning ID is completely nondescriptive and thus is blocker for retiring pylint.

Copy link
Member

Choose a reason for hiding this comment

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

Turns out like this is not implemented in ruff. But it will be there eventually.

Copy link
Member

Choose a reason for hiding this comment

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

I think it makes sense to have this PR in before ruff supports human-friendly rule names (astral-sh/ruff#1773). The speed benefits outweigh small additional confusion which will be addressed in the future anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I find those short labels easy to lookup in the ruff documentation: https://docs.astral.sh/ruff/rules/
Them being shorter actually makes them easier to copy.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, but when reading code it's completely unclear what these numeric codes mean. Usually code is read far more times than it is written.

In any case, this PR can go after merge conflicts are resolved (do we need to rebase and just drop some commits?). We can revisit the rule names later.

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.

None yet

2 participants