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

Python3 vs Anaconda linting squiggle differences #18362

Closed
TylerLeonhardt-alt opened this issue Jan 25, 2022 · 3 comments
Closed

Python3 vs Anaconda linting squiggle differences #18362

TylerLeonhardt-alt opened this issue Jan 25, 2022 · 3 comments
Assignees
Labels
area-linting bug Issue identified by VS Code Team member as probable bug

Comments

@TylerLeonhardt-alt
Copy link

Testing #18349

They should be both using pylint (settings for proof)

Python3:
image

Anaconda:
image

Python3:

> /bin/python3 -m pylint --reports=n --output-format=json ./foo.py
cwd: .
##########Linting Output - pylint##########

[
    {
        "type": "convention",
        "module": "foo",
        "obj": "",
        "line": 1,
        "column": 0,
        "endLine": null,
        "endColumn": null,
        "path": "foo.py",
        "symbol": "disallowed-name",
        "message": "Disallowed name \"foo\"",
        "message-id": "C0104"
    },
    {
        "type": "convention",
        "module": "foo",
        "obj": "",
        "line": 1,
        "column": 0,
        "endLine": null,
        "endColumn": null,
        "path": "foo.py",
        "symbol": "missing-module-docstring",
        "message": "Missing module docstring",
        "message-id": "C0114"
    },
    {
        "type": "convention",
        "module": "foo",
        "obj": "asf",
        "line": 2,
        "column": 0,
        "endLine": 4,
        "endColumn": 17,
        "path": "foo.py",
        "symbol": "missing-function-docstring",
        "message": "Missing function or method docstring",
        "message-id": "C0116"
    },
    {
        "type": "convention",
        "module": "foo",
        "obj": "asf",
        "line": 3,
        "column": 4,
        "endLine": 3,
        "endColumn": 12,
        "path": "foo.py",
        "symbol": "invalid-name",
        "message": "Variable name \"zxcvSDvx\" doesn't conform to snake_case naming style",
        "message-id": "C0103"
    },
    {
        "type": "warning",
        "module": "foo",
        "obj": "asf",
        "line": 3,
        "column": 4,
        "endLine": 3,
        "endColumn": 12,
        "path": "foo.py",
        "symbol": "unused-variable",
        "message": "Unused variable 'zxcvSDvx'",
        "message-id": "W0612"
    }
]

Anaconda:

> ~/anaconda3/bin/conda run -n base --no-capture-output python -m pylint --reports=n --output-format=json ./foo.py
cwd: .
##########Linting Output - pylint##########

[
    {
        "type": "convention",
        "module": "foo",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "foo.py",
        "symbol": "disallowed-name",
        "message": "Disallowed name \"foo\"",
        "message-id": "C0104"
    },
    {
        "type": "convention",
        "module": "foo",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "foo.py",
        "symbol": "missing-module-docstring",
        "message": "Missing module docstring",
        "message-id": "C0114"
    },
    {
        "type": "convention",
        "module": "foo",
        "obj": "asf",
        "line": 2,
        "column": 0,
        "path": "foo.py",
        "symbol": "missing-function-docstring",
        "message": "Missing function or method docstring",
        "message-id": "C0116"
    },
    {
        "type": "convention",
        "module": "foo",
        "obj": "asf",
        "line": 3,
        "column": 4,
        "path": "foo.py",
        "symbol": "invalid-name",
        "message": "Variable name \"zxcvSDvx\" doesn't conform to snake_case naming style",
        "message-id": "C0103"
    },
    {
        "type": "warning",
        "module": "foo",
        "obj": "asf",
        "line": 3,
        "column": 4,
        "path": "foo.py",
        "symbol": "unused-variable",
        "message": "Unused variable 'zxcvSDvx'",
        "message-id": "W0612"
    }
]

I would expect these to be the same, but maybe no?

cc @TylerLeonhardt

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 25, 2022
@karthiknadig
Copy link
Member

This is due to differences in the pylint version. Can you run this and verify?

/bin/python3 -m pylint --version
~/anaconda3/bin/conda run -n base --no-capture-output python -m pylint --version

@TylerLeonhardt-alt
Copy link
Author

Yeah that's correct:

(base) tyler@tyler-ThinkPad-X1-Carbon:~/Code/Misc$ /bin/python3 -m pylint --version
pylint 2.12.2
astroid 2.9.3
Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0]
(base) tyler@tyler-ThinkPad-X1-Carbon:~/Code/Misc$ ~/anaconda3/bin/conda run -n base --no-capture-output python -m pylint --version
pylint 2.9.6
astroid 2.6.6
Python 3.9.7 (default, Sep 16 2021, 13:09:58) 
[GCC 7.5.0]

I feel like the anaconda version isn't as nice as the newer version... maybe worth checking minimum version and prompting for updating?

@karthiknadig karthiknadig self-assigned this Jan 26, 2022
@karthiknadig karthiknadig added triage bug Issue identified by VS Code Team member as probable bug area-linting and removed triage-needed Needs assignment to the proper sub-team labels Jan 26, 2022
@karthiknadig
Copy link
Member

People stick to specific linter versions because they like the default rules shipped in that version. For now, this is working as expected. We do have plans on improving this with #17235 type of work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-linting bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants