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

Update pre-commit #1707

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Update pre-commit #1707

merged 3 commits into from
Nov 6, 2024

Conversation

kurtmckee
Copy link
Member

Description

This PR resolves pre-commit deprecation warnings that are appearing in CI (recent example).

In addition, it updates the pyupgrade configuration to target Python 3.9+ compatibility, and commits the changes introduced by pre-commit run -a, and fixes the resulting flake8 complaints.

While this resolves existing deprecation warnings, I recommend updating the flake8-bugbear plugin to the latest version (you can install and run upadup to accomplish this automatically, or copy-and-paste the version shown in the console logs below). The plugin version in the pre-commit config is two years old, and new versions are throwing new warnings.

$ upadup
upadup is checking additional_dependencies of flake8...
  flake8-bugbear==22.10.27 => flake8-bugbear==24.10.31
apply updates...done

$ pre-commit run -a
compute_endpoint/globus_compute_endpoint/endpoint/config/config.py:188:13:
B028 No explicit stacklevel argument found.
The warn method from the warnings module uses a stacklevel of 1 by default.
This will only show a stack trace for the line on which the warn method is called.
It is therefore recommended to use a stacklevel of 2 or greater
to provide more information to the user.

compute_endpoint/tests/unit/test_endpointmanager_unit.py:765:5:
B017 `assertRaises(Exception)` and `pytest.raises(Exception)` should be considered evil.
They can lead to your test passing even if the code being tested is never executed due to a typo.
Assert for a more specific exception (builtin or custom),
or use `assertRaisesRegex` (if using `assertRaises`),
or add the `match` keyword argument (if using `pytest.raises`),
or use the context manager form with a target.

...

Type of change

Choose which options apply, and delete the ones which do not apply.

  • Code maintenance/cleanup

@khk-globus khk-globus added the no-news-is-good-news This change does not require a news file label Nov 6, 2024
Copy link
Contributor

@khk-globus khk-globus left a comment

Choose a reason for hiding this comment

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

Awesome; this is really helpful. Doing pretty much exactly this has been on my local TODO list for awhile (so I'm literally going to go remove that line!), but the how-to is not immediately top-of-mind for me.

The failing smoke tests are, I think, a factor of permissions rather than anything fundamentally wrong. If something is actually awry and I'm just not seeing it, then we can fix it up later.

Thankee kindly!

@khk-globus khk-globus merged commit f35d3b4 into globus:main Nov 6, 2024
8 of 10 checks passed
@kurtmckee kurtmckee deleted the update-pre-commit branch November 6, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-news-is-good-news This change does not require a news file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants