question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
brettcannoncommented, Sep 18, 2019

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

0reactions
karthiknadigcommented, Dec 3, 2019

Validated: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

flake8-isort - PyPI
flake8 plugin that integrates isort . ... Use isort to check if the imports on your python files are sorted the way you...
Read more >
2.6 PDF - Pylint Documentation
Pylint is a tool that checks for errors in Python code, tries to enforce a coding standard and looks for code smells. It....
Read more >
How to use black, flake8, and isort to format Python codes
flake8 : A python tool that glues together pep8, pyflakes, mccabe, and third-party plugins to check the style and quality of some python...
Read more >
Introduction to Python for Econometrics, Statistics and Data ...
If you are wondering whether you should bother with Python (or another language), ... conda install black isort flake8 pylint or using pip:....
Read more >
hypothesis command man page - ManKier
e.g it works fine if you use pytest fixtures for some arguments and ... The min_magnitude and max_magnitude parameters should be non-negative Real...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found