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

max-positional-arguments unrecognized when using "pylint.args": ["--rcfile=tox.ini"] #587

Closed
jdrese opened this issue Jan 3, 2025 · 4 comments
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Issue is not triaged.

Comments

@jdrese
Copy link

jdrese commented Jan 3, 2025

Diagnostic Data

  • Python version (& distribution if applicable, e.g., Anaconda): 3.11.4
  • Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): virtualenv
  • Operating system (and version): Windows 11 Pro
  • Version of tool extension you are using: 2024.0.0

Behaviour

Expected Behavior

max-positional-arguments should correctly be interpreted/linted when using a config rc file

Actual Behavior

When using a config file like tox.ini all python files get a "Unrecognized option found: max-positional-arguments", on the problems window.

Reproduction Steps:

  • Create a tox.ini file with the following:
[pylint]
max-line-length = 80
max-args = 8
max-positional-arguments = 8
max-locals = 40
max-returns = 5
max-attributes = 10
max-public-methods = 30
max-module-lines = 1500
max-statements = 100
min-public-methods = 1
  • In a VScode workspace file add:
        "pylint.args": [
            "--rcfile=tox.ini"
        ]

Logs:

2025-01-03 11:11:34.681 [info] [Trace - 11:11:34 AM] Received notification 'window/logMessage'.
2025-01-03 11:11:34.681 [info] Params: {
    "type": 4,
    "message": "HIDING_LOCAL_PATH\\.venv\\Scripts\\python.exe -m pylint --reports=n --output-format=json --rcfile=tox.ini --clear-cache-post-run=y --from-stdin HIDING_LOCAL_PATH"
}


2025-01-03 11:11:34.681 [info] j:\p4\FW5_main\pipeline\larry\FW5\.venv\Scripts\python.exe -m pylint --reports=n --output-format=json --rcfile=tox.ini --clear-cache-post-run=y --from-stdin HIDING_LOCAL_PATH
2025-01-03 11:11:34.682 [info] [Trace - 11:11:34 AM] Received notification 'window/logMessage'.
2025-01-03 11:11:34.682 [info] Params: {
    "type": 4,
    "message": "CWD Linter: HIDING_LOCAL_PATH"
}


2025-01-03 11:11:34.682 [info] CWD Linter: j:\p4\FW5_main\pipeline\larry\FW5
2025-01-03 11:11:36.165 [info] [Trace - 11:11:36 AM] Received notification 'window/logMessage'.
2025-01-03 11:11:36.165 [info] Params: {
    "type": 4,
    "message": "file:///HIDING_LOCAL_PATH :\r\n[\n    {\n        \"type\": \"error\",\n        \"module\": \"tox.ini\",\n        \"obj\": \"\",\n        \"line\": 1,\n        \"column\": 0,\n        \"endLine\": null,\n        \"endColumn\": null,\n        \"path\": \"tox.ini\",\n        \"symbol\": \"unrecognized-option\",\n        \"message\": \"Unrecognized option found: max-positional-arguments\",\n        \"message-id\": \"E0015\"\n    }\n]\n"
}


2025-01-03 11:11:36.165 [info] file:///HIDING_LOCAL_PATH :
[
    {
        "type": "error",
        "module": "tox.ini",
        "obj": "",
        "line": 1,
        "column": 0,
        "endLine": null,
        "endColumn": null,
        "path": "tox.ini",
        "symbol": "unrecognized-option",
        "message": "Unrecognized option found: max-positional-arguments",
        "message-id": "E0015"
    }
]

2025-01-03 11:11:36.166 [info] [Trace - 11:11:36 AM] Received notification 'textDocument/publishDiagnostics'.
2025-01-03 11:11:36.166 [info] Params: {
    "uri": "file:///HIDING_LOCAL_PATH",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 0,
                    "character": 0
                },
                "end": {
                    "line": 0,
                    "character": 0
                }
            },
            "message": "Unrecognized option found: max-positional-arguments",
            "severity": 1,
            "code": "E0015:unrecognized-option",
            "codeDescription": {
                "href": "https://pylint.readthedocs.io/en/latest/user_guide/messages/error/unrecognized-option.html"
            },
            "source": "Pylint"
        }
    ]
}


2025-01-03 11:12:29.758 [info] [Trace - 11:12:29 AM] Sending notification 'textDocument/didClose'.
2025-01-03 11:12:29.758 [info] Params: {
    "textDocument": {
        "uri": "file:///HIDING_LOCAL_PATH"
    }
}


2025-01-03 11:12:29.762 [info] [Trace - 11:12:29 AM] Received notification 'textDocument/publishDiagnostics'.
2025-01-03 11:12:29.762 [info] Params: {
    "uri": "file:///HIDING_LOCAL_PATH",
    "diagnostics": []
}

Outcome When Attempting Debugging Steps:

Running Pylint on the files with pylint --rcfile tox.ini ... works fine with all settings added inside tox.ini

@jdrese jdrese added the bug Issue identified by VS Code Team member as probable bug label Jan 3, 2025
@github-actions github-actions bot added the triage-needed Issue is not triaged. label Jan 3, 2025
@Pierre-Sassoulas
Copy link

Hello, this option was added in latest pylint version, maybe the pylint used need to be upgraded ? (I don't see the version of pylint anywhere in the bug report)

@jdrese
Copy link
Author

jdrese commented Jan 3, 2025

Hello @Pierre-Sassoulas

Strange. I am running with

pylint --version

pylint 3.3.2
astroid 3.3.6
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]

And the VScode extension:
Version
2024.0.0
Last Updated
2024-10-10, 09:50:31

I just saw that there is a 3.3.3 for Pylint.
After install the same issue occurs.
pylint 3.3.3
astroid 3.3.8
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]

@hamidnazari
Copy link

Make sure the vscode plugin knows to use your version of pylint.

"pylint.importStrategy": "fromEnvironment"  // defaults to bundled which causes the disparity

@jdrese
Copy link
Author

jdrese commented Jan 6, 2025

Yes that did it indeed @hamidnazari . Thank you very much 👍

@jdrese jdrese closed this as completed Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

3 participants