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

No old counts in pylint report mode (version 2.4.4) #3819

Closed
hamishmb opened this issue Sep 7, 2020 · 16 comments · Fixed by #4321
Closed

No old counts in pylint report mode (version 2.4.4) #3819

hamishmb opened this issue Sep 7, 2020 · 16 comments · Fixed by #4321

Comments

@hamishmb
Copy link

hamishmb commented Sep 7, 2020

Question

Hi all,

Since my upgrade to Linux Mint 20, I've not had any old counts in my reports, and I'm not sure why. Multiple runs of pylint does show "NC" for old counts. The .pylintrc files have not changed.

Here is the output of "pylint --version":

pylint 2.4.4
astroid 2.3.3
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0]

My old pylint version on Linux Mint 19.3 was 1.8.3.

Has anyone else encountered this issue?

Attached is a simple python 3 file (with some deliberate mistakes so pylint can moan about them), and a .pylintrc file that demonstrates the issue for me.

#!/usr/bin/env python3
import os
import platform

print(platform.system())

if (platform.system() == 'Linux'):
    linux = True
    cygwin = False
  
elif ("CYGWIN" in platform.system()):
    linux = True
    cygwin = True
  
elif (platform.system() == "Darwin"):
    linux = False
    cygwin = False
  

print(linux, cygwin)

pylintrc_testfiles.zip

@hippo91
Copy link
Contributor

hippo91 commented Sep 7, 2020

@hamishmb thanks for the report.
I can reproduce it.

@hippo91 hippo91 added Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning Configuration Related to configuration labels Sep 7, 2020
@hamishmb
Copy link
Author

hamishmb commented Sep 8, 2020

Oh good, I was wondering if it was to do with my setup somehow.

Anything I can do to help debug? Any known working versions other than the old one? I guess I could set up a virtual environment and/or use pip to install some different versions.

@hamishmb
Copy link
Author

hamishmb commented Sep 9, 2020

NB: Also occurs in 2.6.0 from PyPI

@hippo91
Copy link
Contributor

hippo91 commented Sep 10, 2020

Oh good, I was wondering if it was to do with my setup somehow.

Anything I can do to help debug? Any known working versions other than the old one? I guess I could set up a virtual environment and/or use pip to install some different versions.

Yes it could help if you could find what was the last version with the feature working as expected. Thanks.

@hamishmb
Copy link
Author

NB: Just tried clearing out $HOME/.pylint.d, but no difference.

I'll try again but my initial attempt at getting old versions working with pylint resulted in errors related to Astroid. I'm on Python 3.8, do I need to use an older version to test?

@hamishmb
Copy link
Author

I always get this error trying older versions it seems:

Traceback (most recent call last):
File "/home/hamish/pylint/lib/python3.8/site-packages/astroid/astpeephole.py", line 17, in
_TYPES = (_ast.Str, _ast.Bytes)
AttributeError: module '_ast' has no attribute 'Str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/hamish/pylint/bin/pylint", line 8, in
sys.exit(run_pylint())
File "/home/hamish/pylint/lib/python3.8/site-packages/pylint/init.py", line 15, in run_pylint
from pylint.lint import Run
File "/home/hamish/pylint/lib/python3.8/site-packages/pylint/lint.py", line 64, in
import astroid
File "/home/hamish/pylint/lib/python3.8/site-packages/astroid/init.py", line 67, in
from astroid.builder import parse, extract_node
File "/home/hamish/pylint/lib/python3.8/site-packages/astroid/builder.py", line 26, in
from astroid import rebuilder
File "/home/hamish/pylint/lib/python3.8/site-packages/astroid/rebuilder.py", line 17, in
from astroid import astpeephole
File "/home/hamish/pylint/lib/python3.8/site-packages/astroid/astpeephole.py", line 19, in
_TYPES = (_ast.Str, )
AttributeError: module '_ast' has no attribute 'Str'

Any ideas why?

@hamishmb
Copy link
Author

No matter, just figured it out.

It was broken some time between pylint 2.3.1 and 2.4.0.

@pallavishenoy
Copy link

@hamishmb How did you resolve the issue?
I'm encountering the same problem. I want to run older version of pylint on code written with Python 2.7.
Currently I have Python 3.9 installed

@hamishmb
Copy link
Author

I ended up just downgrading to pylint 2.3.1 with pip. I do eventually plan to bisect this if no one else does, but I unfortunately don't really have time to do that right now.

@hippo91
Copy link
Contributor

hippo91 commented Feb 16, 2021

@hamishmb i located the source of the bug. It is commit 293a7f5.
However before reverting brutally, i would like to investigate a bit in order to revert only the strict minimum.
@Pierre-Sassoulas if you remember this commit, can you tell me a bit more about it please?

@Pierre-Sassoulas
Copy link
Member

It was a cleanup around removing a circular import in the utils package, but I don't remember the particular. It seems I made a mistake and the code was actually used somewhere even if untested. I'll check that.

@Pierre-Sassoulas Pierre-Sassoulas added Regression and removed Needs investigation 🔬 A bug or crash where it's not immediately obvious what is happenning labels Feb 16, 2021
@hippo91
Copy link
Contributor

hippo91 commented Feb 16, 2021

@Pierre-Sassoulas don't worry about this. I will make a PR that partially or totally revert this commit and we will see if it is ok!

@hippo91 hippo91 added Bug 🪲 and removed Configuration Related to configuration labels Feb 16, 2021
@hippo91 hippo91 self-assigned this Feb 16, 2021
@Pierre-Sassoulas
Copy link
Member

I was going to add functional tests for it, it's not mutually exclusive ;)

@hamishmb
Copy link
Author

Thanks for taking a look at it, and apologies I never got around to finding the commit that caused it. I'll happily test the fix for you when it's out.

@hippo91
Copy link
Contributor

hippo91 commented Feb 17, 2021

@hamishmb no problem for not finding the commit. Your investigation helped me a lot to find it! Thanks.

@hamishmb
Copy link
Author

Excellent thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants