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

Fix suppressed pylint errors #14212

Open
NymanRobin opened this issue May 15, 2024 · 0 comments · May be fixed by #14243
Open

Fix suppressed pylint errors #14212

NymanRobin opened this issue May 15, 2024 · 0 comments · May be fixed by #14243
Assignees
Labels

Comments

@NymanRobin
Copy link
Contributor

Deviation from expected behavior:

When pylint upgraded to version 3.2.0 in the CI, a new set of errors was added that failed the linting check and thus blocked CI. To unblock the CI check, a fix was added that suppressed the errors rather than fixing them in this PR #14204. However, as a follow-up to this, the error suppression on line 17 in the file deploy/examples/external/create-external-cluster-resources.py should be removed, and corresponding fixes should be made to pass the pylint check. The major problem is that two dependencies are only imported in Python 3.

if sys.version_info.major >= 3:
    py3k = True
    import urllib.parse
    from ipaddress import ip_address, IPv4Address

This then caused the following errors in pylint

deploy/examples/create-external-cluster-resources.py:592:31: E0606: Possibly using variable 'ip_address' before assignment (possibly-used-before-assignment)
deploy/examples/create-external-cluster-resources.py:592:63: E0606: Possibly using variable 'IPv4Address' before assignment (possibly-used-before-assignment)
deploy/examples/create-external-cluster-resources.py:769:19: E0606: Possibly using variable 'ip' before assignment (possibly-used-before-assignment)

The code can either be refactored to use another method to determine the ip_address and to perform an IP protocol check. However, since the usage of Python 2 is most likely minimal and not working properly at the moment, I would suggest dropping the support. This allows for a neat fix for the aforementioned pylint problem and multiple other cleanups in the code.

Expected behavior and How to reproduce it (minimal and precise):

  1. The pylint suppression # pylint: disable=E0606 should be removed from code base
  2. pylint 3.2.0 or newer should be installed
  3. command pylint $(git ls-files '*.py') -E should pass
@NymanRobin NymanRobin added the bug label May 15, 2024
parth-gr added a commit to parth-gr/rook that referenced this issue May 20, 2024
closes: rook#14212

Signed-off-by: parth-gr <partharora1010@gmail.com>
parth-gr added a commit to parth-gr/rook that referenced this issue May 20, 2024
closes: rook#14212

Signed-off-by: parth-gr <partharora1010@gmail.com>
@parth-gr parth-gr linked a pull request May 20, 2024 that will close this issue
6 tasks
parth-gr added a commit to parth-gr/rook that referenced this issue May 20, 2024
closes: rook#14212

Signed-off-by: parth-gr <partharora1010@gmail.com>
parth-gr added a commit to parth-gr/rook that referenced this issue May 20, 2024
closes: rook#14212

Signed-off-by: parth-gr <partharora1010@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants