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

Enforce ruff/flake8-pyi rules (PYI) #292

Merged
merged 2 commits into from
Jun 15, 2024

Conversation

DimitriPapadopoulos
Copy link
Contributor

No description provided.

PYI032 Prefer `object` to `Any` for the second parameter to `__eq__`
PYI041 Use `float` instead of `int | float`
Copy link
Collaborator

@CPBridge CPBridge left a comment

Choose a reason for hiding this comment

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

@DimitriPapadopoulos

Thanks for these various changes. I'm wondering whether you would be able to share the specific configurarion/command line options you used for these various tools so that I can look into integrating them in the CI?

@CPBridge CPBridge merged commit e827aba into ImagingDataCommons:master Jun 15, 2024
13 checks passed
@DimitriPapadopoulos
Copy link
Contributor Author

I used ruff --extend--select PYI for this specific merge request. Ideally I should have used ruff --config 'line-length = 80' --extend--select PYI instead of fixing possible line length issues after linting. Since you're using flake8, you just need to add to your test requirements the relevant plugin — in this case flake8-pyi.

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented Jun 16, 2024

More generally, for ruff rules that implement the rules of flake8 plugins, just install the plugin:

For ruff rules that implement the rules of other tools, add the relevant tool to your test dependencies and add them to the CI jobs:

For ruff rules, you have no other choice than adding ruff to your setup:

@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented Jun 16, 2024

If you do want to enforce many of these rules, I would recommend moving to ruff altogether.

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.

2 participants