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

pythonSettings.linting.maxNumberOfProblems controls the number of lines of stdout instead of the number of problems #2198

Closed
saponas opened this issue Jul 19, 2018 · 2 comments · Fixed by #2208
Labels
area-linting bug Issue identified by VS Code Team member as probable bug

Comments

@saponas
Copy link

saponas commented Jul 19, 2018

Environment data

  • VS Code version: 1.25.1
  • Extension version (available under the Extensions sidebar): 2018.7.0
  • OS and version: Win10
  • Python version (& distribution if applicable, e.g. Anaconda): Python 2.7.14 (Anaconda)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: None

Actual behavior

Problems list when running PyLint contains only the errors in the first N lines of stdout when running PyLint where N = "python.linting.maxNumberOfProblems"

Expected behavior

Problems list when running PyLint contains only the errors in the first N MESSAGES contained in stdout when running PyLint where N = "python.linting.maxNumberOfProblems"

Steps to reproduce:

  1. Have a file that generates a bunch of "convention,C0326:Exactly one space required after comma" errors which generate 3 lines of text per message in PyLint when run with the formatting settings vscode-python passes to PyLint.

The line of code governing this is src/client/linters/baselinter.ts in function private parseLines(outputLines: string[], regEx: string): ILintMessage[]
"
.filter((value, index) => index <= this.pythonSettings.linting.maxNumberOfProblems)
"

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

NA

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

NA
@d3r3kk d3r3kk added bug Issue identified by VS Code Team member as probable bug area-linting needs verification labels Jul 19, 2018
@d3r3kk
Copy link

d3r3kk commented Jul 19, 2018

In this code or in some extension to it for pylint, we'll likely have to do some light parsing, or perhaps change our variable name to maxNumberOfLines to make it more clear for the user?

From pydocstyle's extension to the BaseLinter class:

        // Remember, the first line of the response contains the file name and line number, the next line contains the error message.
        // So we have two lines per message, hence we need to take lines in pairs.
        const maxLines = this.pythonSettings.linting.maxNumberOfProblems * 2;

@saponas
Copy link
Author

saponas commented Jul 19, 2018

I think it just needs to be done iteratively instead of with a filter+map. There is already the parse code right there in the function: const msg = this.parseLine(line, regEx);

saponas added a commit to saponas/vscode-python that referenced this issue Jul 20, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 3, 2018
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
3 participants