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.

IDE Integration fails on VSCode

See original GitHub issue

Hi,

I replaced the Python > Linting: Flake8 Path on settings and followed the instructions here

image

It’s currently not working, here’s the output

image

I also added the --format=default under Python > Linting: Flake8 Args, same result as above

$ python -m flake8heavened --format=default 

.venv/bin/python: No module named flake8heavened

FlakeHeaven 0.11.1
Flake8    4.0.1
For plugins versions use flakeheaven plugins
NAME                     | VERSION  | CODES            | RULES
flake8-bandit            | 2.1.2    | S                | 
flake8-broken-line       | 0.4.0    | N4               | 
flake8-bugbear           | 21.11.29 | B                | 
flake8-commas            | 2.1.0    | C81              | 
flake8-comprehensions    | 3.8.0    | C4               | 
flake8-darglint          | 1.8.1    | DAR              | 
flake8-debugger          | 4.0.0    | T100             | 
flake8-docstrings        | 1.6.0    | D                | 
flake8-eradicate         | 1.2.0    | E8               | 
flake8-isort             | 4.1.1    | I00              | 
flake8-quotes            | 3.3.1    | Q0               | 
flake8-rst-docstrings    | 0.2.5    | RST              | 
flake8-string-format     | 0.3.0    | P                | 
mccabe                   | 0.6.1    | C90              | 
pep8-naming              | 0.12.1   | N8               | 
pycodestyle              | 2.8.0    | E, W             | 
pyflakes                 | 2.4.0    | F                | 
pylint                   | 0.0.0    | C, E, F, I, R, W | 
wemake-python-styleguide | 0.16.0   | WPS              | 

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
purple-emilycommented, Feb 28, 2022
{
    ...
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Path": "${workspaceFolder}/.venv/Scripts/flake8heavened.exe",
    ...
}

Took me a long time to figure this out. This information needs adding to the documentation.

1reaction
pwoolvettcommented, May 20, 2022

Has anyone found a workaround for the current (1.67.2) version of VS Code to run flakeheaven without specifying a full path?

vscode detects non-absolute paths and invokes using those args (thus ignoring custom location).

A bit hacky, but The following works:

  1. set settings.json to any absolute path (non-existent is fine). This ensures the linter is called using the -p invoke in vscode extension
{
    "python.linting.flake8Path": "/flakeheaven",
    "python.linting.flake8Args": ["lint"]
}
  1. modify vscode extension lint script. eg, in your case, ~/.vscode/extensions/ms-python.python-2022.6.2/pythonFiles/linter.py:
...

def main():
    ...
    else:
        linter = sys.argv[2]
        args = [sys.argv[3]] + linter_settings[linter]["args"] + sys.argv[4:]

    if args[0] == "/flake8heavened":                       # THIS LINE
        args[0] = "flake8heavened"                         # THIS LINE. alternatively, insert at the beginning of args: sys.executable, "-m", flakeheaven", "lint" 

    if hasattr(subprocess, "run"):
        subprocess.run(args, encoding="utf-8", stdout=sys.stdout, stderr=sys.stderr)
    else:
        subprocess.call(args, stdout=sys.stdout, stderr=sys.stderr)

...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Terminal launch failures - Visual Studio Code
To troubleshoot Integrated Terminal launch failures in Visual Studio Code, follow these steps to diagnose issues: Check your user settings.
Read more >
Working with GitHub Issues in Visual Studio Code
Our integration approach​​ We did not want to add GitHub functionality directly to the core VS Code editor because there are many source...
Read more >
Visual Studio Code Frequently Asked Questions
Visual Studio Code is a streamlined code editor with support for development operations like debugging, task running, and version control.
Read more >
Remote Development Tips and Tricks - Visual Studio Code
Visual Studio Code Remote Development troubleshooting tips and tricks for SSH, Containers, and the Windows Subsystem for Linux (WSL)
Read more >
Source Control with Git in Visual Studio Code
Make sure Git is installed. VS Code will use your machine's Git installation (at least version 2.0.0 ), so you need to install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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