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

"llegal argument: line must be non-negative" when using flake8 and flake8-isort #7349

Closed
ahobsonsayers opened this issue Sep 12, 2019 · 5 comments
Assignees
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug good first issue

Comments

@ahobsonsayers
Copy link

ahobsonsayers commented Sep 12, 2019

Environment data

  • VS Code version: 1.38.0
  • Extension version: 2019.9.34911
  • OS and version: Windows 10 Home
  • Python version: Python 3.7 (Anaconda Variant)
  • Type of virtual environment used: conda
  • Relevant/affected Python packages and their versions: flake8: 3.7.8, flake8_isort: 2.3
  • Jedi or Language Server?: Language Server

Expected behaviour

VSCode fully lints a file using flake8 and the flake8_isort plugin and highlight errors, warnings and information as appropriate.

Actual behaviour

When using flake8 as a linter in vscode, if flake8 finds a reported error, warning or info that has a location line number of 0, vscode throws the error "llegal argument: line must be non-negative" and does not complete linting.

This happens for example when using when using the flake8-isort extension, as I002 specifies there is no isort configuration found, and the Info location line number is 0.

This is also an issue if using the wemake-python-styleguide as there are several rules which report a line location of 0.

Steps to reproduce:

  1. Install flake8 and the flake8-isort plugin
  2. Set VSCode to use flake8 as the linter
  3. Run flake8 linting on any file through vscode, ensuring there is no isort config file in the same folder that can be detected

Logs

Output for Python in the Output panel

##########Linting Output - flake8##########
0,1,I,I002:no configuration found (.isort.cfg or [isort] in configs)

Output from Console under the Developer Tools panel:

notificationsAlerts.ts:38 Error: Illegal argument: line must be non-negative
at Object.t.illegalArgument (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:13:195)
at new g (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:350:768)
at new g (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:350:44)
at w.createDiagnostics (c:\Users\Arran.vscode\extensions\ms-python.python-2019.9.34911\out\client\extension.js:119:490471)
at w.lintDocument (c:\Users\Arran.vscode\extensions\ms-python.python-2019.9.34911\out\client\extension.js:119:489854)

@ahobsonsayers ahobsonsayers added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 12, 2019
@DonJayamanne DonJayamanne self-assigned this Sep 16, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 16, 2019
@brettcannon
Copy link
Member

I just wanted to acknowledge that we received this bug report, @ahobsonsayers .

@DonJayamanne
Copy link

Prescribed solution:

  • Add support for negative line numbers and default them to 0.

@DonJayamanne DonJayamanne removed their assignment Sep 23, 2019
@brettcannon brettcannon removed the triage label Oct 8, 2019
@dabljues
Copy link

I also experience this issue. Vs code insiders 1.40.0

@lachlan-eagling
Copy link

Also experiencing this issue, would like to take a crack at submitting a fix.

@karthiknadig
Copy link
Member

Validated:
image

@ghost ghost removed the needs PR label Dec 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-formatting bug Issue identified by VS Code Team member as probable bug good first issue
Projects
None yet
Development

No branches or pull requests

9 participants