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

Bump linter versions. #1112

Merged
merged 9 commits into from
Sep 25, 2023
Merged

Bump linter versions. #1112

merged 9 commits into from
Sep 25, 2023

Conversation

rjeffman
Copy link
Member

@rjeffman rjeffman commented Jul 12, 2023

In recent pylint versions more checks are being triggered by current ansible-freeipa code. This PR fixes or disables all new warnings found with:

  • pylint 2.17.4
  • astroid 2.15.6
  • Python 3.11.4

The linter versions are updated for development requirements, pre-commit checks and upstream CI.

Details can be found on the individual commit messages.

@rjeffman rjeffman requested a review from t-woerner July 12, 2023 21:46
@rjeffman rjeffman changed the title Future pylint preparation Bump linter versions. Jul 13, 2023
@rjeffman rjeffman force-pushed the future_pylint branch 2 times, most recently from 583036c to 59d1da2 Compare July 13, 2023 16:06
Recent pylint versions warns when a dictionaire is created using
'dict()' instead of '{...}'. Using 'dict()' in ansible-freeipa modules
actually enhances readability, so this change disables the check for
'use-dict-literal' in pylint.
Recent pylint versions warn against the use of an 'else' in a
'try-except' block if using a 'return' on the 'except' part is is the
idom used by ansible-freeipa when retrieving IPA data objects.

This change removes the usage of the 'else:' in such cases, and modify
the templates so that new modules do not have the same issue in the
future.
In recent pylint versions, use of broad exceptions for both raise and
try/except blocks raise a linter warning. As its use is justifiable in
the case of ipavault, the warnings are disabled where they occur.
Changing the use of 'Exception' to 'RuntimeError' has the benefits of
making the error more specific and meaningful for what is being reported
and to remove warnings from linters (pylint).

The same change is applied to all deployment roles.
This patch removes unnecessary usage of parens on attributions.
Update versions for linters and pre-commit checks, and fix ansible-lint
execution.
Change pylint version to match latest version on Fedora 38.
@rjeffman
Copy link
Member Author

/azp run CheckPR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@t-woerner t-woerner left a comment

Choose a reason for hiding this comment

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

LGTM

@t-woerner t-woerner merged commit 12e0d11 into freeipa:master Sep 25, 2023
31 checks passed
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