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 pylint and ignore error from removed rule #406

Closed

Conversation

EvgeneOskin
Copy link

@EvgeneOskin EvgeneOskin commented Feb 26, 2021

Update pylint 2.5.3 -> 2.7.2
Update astroid 2.4.1 -> 2.5.1
Drop python 3.5 because astroid 2.5.1 does not support it.

Pylint 2.7.2 contains security fix for a vulnerability.

Description

This change ignores UnknownMessageError to support running on other versions of pylint.

Motivation and Context

At the moment prospector cannot run checks with the pylint 2.6.1+ due to the error:

  File "/Users/eoskin/projects/prospector/tests/tools/pylint/test_pylint_tool.py", line 36, in test_wont_throw_false_positive_relative_beyond_top_level                                                                                                                                             
    pylint_tool.configure(config, found_files)                                                                                                                                                                                                                                                      
  File "/Users/eoskin/projects/prospector/prospector/tools/pylint/__init__.py", line 128, in configure                                                                                                                                                                                              
    check_paths, config_messages, configured_by, ext_found, linter, prospector_config, pylint_options                                             
  File "/Users/eoskin/projects/prospector/prospector/tools/pylint/__init__.py", line 218, in _get_pylint_configuration                                                                                                                                                                              
    config_messages = self._prospector_configure(prospector_config, linter)                                                                                                                                                                                                                         
  File "/Users/eoskin/projects/prospector/prospector/tools/pylint/__init__.py", line 82, in _prospector_configure                                                                                                                                                                                   
    linter.disable("mixed-indentation")                            
  File "/Users/eoskin/projects/prospector/.tox/py36/lib/python3.6/site-packages/pylint/message/message_handler_mix_in.py", line 68, in disable    
    msgid, enable=False, scope=scope, line=line, ignore_unknown=ignore_unknown                                                                    
  File "/Users/eoskin/projects/prospector/.tox/py36/lib/python3.6/site-packages/pylint/message/message_handler_mix_in.py", line 118, in _set_msg_status                                                                                                                                             
    message_definitions = self.msgs_store.get_message_definitions(msgid)                                                                                                                                                                                                                            
  File "/Users/eoskin/projects/prospector/.tox/py36/lib/python3.6/site-packages/pylint/message/message_definition_store.py", line 57, in get_message_definitions                                                                                                                                    
    for m in self.message_id_store.get_active_msgids(msgid_or_symbol)                                                                                                                                                                                                                               
  File "/Users/eoskin/projects/prospector/.tox/py36/lib/python3.6/site-packages/pylint/message/message_id_store.py", line 120, in get_active_msgids                                                                                                                                                 
    raise UnknownMessageError(error_msg)                                                                                                          
pylint.exceptions.UnknownMessageError: No such message id or symbol 'mixed-indentation'.         

mixed-indentation was removed pylint 2.6.1.

How Has This Been Tested?

I've tested the change by running it on the prospector code base and by running tox on macOS 11.2.1.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change requires a change to the dependencies
  • I have updated the dependencies accordingly
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

coveralls commented Feb 26, 2021

Coverage Status

Coverage remained the same at 82.071% when pulling be1f023 on EvgeneOskin:add-support-for-pylint-2.6.1 into 9a8c0e3 on PyCQA:master.

@joaopslins
Copy link

There's no pylint version 2.6.2, although they have the release on Github, it looks like it was a mistag, and 2.6.2 is actually 2.6.1, which doesn't include the vulnerability fix.

Maybe you meant to use 2.7.0? That version actually has the security fix.

http://pylint.pycqa.org/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-2-7-0

@EvgeneOskin
Copy link
Author

Hi @joaopslins ,
There is 2.6.1 on pypi it has an issue with missed function which is resolved in 2.6.2.
image

Thanks for the info about 2.7.0. Yes, it looks like the data on Snyk is not correct. ☹️ https://snyk.io/vuln/SNYK-PYTHON-PYLINT-609883

I'll update the PR shortly.

@joaopslins
Copy link

No worries, thank you for creating the PR. I'm having the same issue here. Hope this gets merged soon.

@joshfinnie
Copy link

Would love to see this merged in... it allows the latest isort to also be used. Although pylint is already past 2.8.x currently.

@Palisand
Copy link

Another reason to upgrade: pylint <= 2.5 on Python 3.9 does not support subscripting on Union and Optional!.

Copy link
Contributor

@sbrunner sbrunner left a comment

Choose a reason for hiding this comment

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

Nice :-)

Copy link
Collaborator

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

👍

@@ -30,9 +30,9 @@
"pycodestyle<2.7.0,>=2.6.0",
"pep8-naming>=0.3.3,<=0.10.0",
"pydocstyle>=2.0.0",
"pylint==2.5.3",
"pylint==2.7.2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"pylint==2.7.2",
"pylint==2.8.3",

astroid is pinned to 2.5.6 in pylint 2.8.3 and will stay pinned in future versionso I don't know what to do with the astroid version line 35, but the easiest would be to use pylint's version.

Choose a reason for hiding this comment

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

One additional comment - is there any specific reason that prospector is pinning 2.8.3/2.7.2? It seems like prospector is pretty widely compatible, so it might increase user flexibility to unpin asteroid, and change the pylint version to something like:

pylint>=2.5.3,<2.9

This would increase user flexibility, allowing users requiring a fixed pylint/asteroid version to specify exactly (unless there are actually breaking changes).

@Kilo59
Copy link
Contributor

Kilo59 commented Jul 13, 2021

Can this be merged?
What's the issue?

This is going to be more and more of an issue as the adoption of 3.9 increases.

Does anybody know of a better-maintained fork of this project?

@Pierre-Sassoulas
Copy link
Collaborator

Close in favor of #421

@EvgeneOskin EvgeneOskin deleted the add-support-for-pylint-2.6.1 branch August 26, 2021 22:34
@EvgeneOskin EvgeneOskin restored the add-support-for-pylint-2.6.1 branch August 26, 2021 22:35
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.

None yet

9 participants