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

[BUG] salt-pylint throws a TypeError #46

Closed
major0 opened this issue May 30, 2021 · 5 comments
Closed

[BUG] salt-pylint throws a TypeError #46

major0 opened this issue May 30, 2021 · 5 comments
Assignees

Comments

@major0
Copy link

major0 commented May 30, 2021

Running pylint against salt-pylint:

> pylint saltpylint/pep8.py
Traceback (most recent call last):
  File "/home/mark.ferrell/.local/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/home/mark.ferrell/.local/lib/python3.8/site-packages/pylint/__init__.py", line 24, in run_pylint
    PylintRun(sys.argv[1:])
  File "/home/mark.ferrell/.local/lib/python3.8/site-packages/pylint/lint/run.py", line 330, in __init__
    linter.load_plugin_modules(plugins)
  File "/home/mark.ferrell/.local/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 503, in load_plugin_modules
    module = astroid.modutils.load_module_from_name(modname)
  File "/home/mark.ferrell/.local/lib/python3.8/site-packages/astroid/modutils.py", line 212, in load_module_from_name
    return importlib.import_module(dotted_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/mark.ferrell/.local/lib/python3.8/site-packages/saltpylint/pep8.py", line 384, in <module>
    class PEP8WhitespaceWarning(_PEP8BaseChecker):
  File "/home/mark.ferrell/.local/lib/python3.8/site-packages/saltpylint/pep8.py", line 391, in PEP8WhitespaceWarning
    'trailing-whitespace' if pylint_version_info < (1, 0) else
TypeError: '<' not supported between instances of 'str' and 'int'

Importing pip install pylint:

> python3
Python 3.8.5 (default, Jan 27 2021, 15:41:15) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylint.__pkginfo__ import numversion as pylint_version_info
>>> print(pylint_version_info)
('2', '8', '2')
>>> 

It looks like prior to pylint-dev/pylint@0e63847 pylint returned a tuple of strings, but after this commit it now returns a tuple of Int's. From pylint.git:

pylint.git (master)> python3
Python 3.8.5 (default, Jan 27 2021, 15:41:15) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylint.__pkginfo__ import numversion as pylint_version_info
>>> print(pylint_version_info)
(2, 8, 2)
>>> 
@major0
Copy link
Author

major0 commented May 30, 2021

I have tracked this down a little further:
Prior to 2.8.0 numversion is a tuple of ints.
For 2.8.0 numversion does not exist.
For 2.8.1 - 2.8.2 numversion is a tuple of strings.
For the upcoming 2.8.3+ release numversion go back to being a tuple of Ints.

@s0undt3ch
Copy link
Contributor

I have tracked this down a little further:
Prior to 2.8.0 numversion is a tuple of ints.
For 2.8.0 numversion does not exist.
For 2.8.1 - 2.8.2 numversion is a tuple of strings.
For the upcoming 2.8.3+ release numversion go back to being a tuple of Ints.

Wow, what went on there....

@s0undt3ch
Copy link
Contributor

I will actually propose on our teams next Arch meeting to deprecate the pep8 checker since Salt now uses black.
Still, this should be an easy fix.

@major0
Copy link
Author

major0 commented Jun 1, 2021

I have tracked this down a little further:
Prior to 2.8.0 numversion is a tuple of ints.
For 2.8.0 numversion does not exist.
For 2.8.1 - 2.8.2 numversion is a tuple of strings.
For the upcoming 2.8.3+ release numversion go back to being a tuple of Ints.

Wow, what went on there....

It starts with: pylint-dev/pylint#4399
Which they tried to fix with: pylint-dev/pylint@af1ac5e
Which lead to: pylint-dev/pylint#4420
But that resulted in the string problem so they are switching to: pylint-dev/pylint@0e63847

Oh, it looks like they are bumping the version to 2.9.0. The numversion tuple issue is mentioned in the 2.9.0 release notes:
See: https://docs.pylint.org/en/latest/whatsnew/changelog.html?highlight=namedtuple#what-s-new-in-pylint-2-9-0

numversion tuple contains integers again to fix multiple pylint's plugins that relied on it

@s0undt3ch
Copy link
Contributor

There were a number of checks that were removed in the last release since they no longer made any sense, namely, pep8, so, closing this issue.

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

No branches or pull requests

2 participants