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

Flake8 Does Not Exclude Subdirectories Indicated in .flake8 File #18694

Closed
FeryET opened this issue Mar 15, 2022 · 4 comments
Closed

Flake8 Does Not Exclude Subdirectories Indicated in .flake8 File #18694

FeryET opened this issue Mar 15, 2022 · 4 comments
Assignees
Labels
area-linting bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@FeryET
Copy link

FeryET commented Mar 15, 2022

Issue Type: Bug

Behaviour

Expected vs. Actual

When I run flake8 directly in terminal, the .flake8 config works, but running from vscode, the linter is not successful in finding out the nested subdirectories and files.

Steps to reproduce:

  1. Install flake8.
  2. create a .flake8 config:
# .flake8 file content
[flake8]
exclude= root
  1. create subdir: mkdir -p root/something
  2. create python files in root/something.
  3. The linter run by extension will not exclude *.py files in root/something.
  4. Change .flake8
[flake8]
exclude= root/something/*.py
  1. Now it works.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.11
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • Value of the python.languageServer setting: Pylance
User Settings


defaultLS: {"defaultLSType":"Pylance"}

downloadLanguageServer: true

envFile: "<placeholder>"

venvPath: "<placeholder>"

venvFolders: "<placeholder>"

condaPath: "<placeholder>"

pipenvPath: "<placeholder>"

poetryPath: "<placeholder>"

languageServer: "Pylance"

linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: true
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"

sortImports
• args: "<placeholder>"
• path: "<placeholder>"

formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "black"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"

testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true

terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"

experiments
• enabled: true
• optInto: []
• optOutFrom: []

insidersChannel: "off"

tensorBoard
• logDirectory: "<placeholder>"

Extension version: 2022.2.1924087327
VS Code version: Code 1.65.2 (c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1, 2022-03-10T15:36:26.048Z)
OS version: Linux x64 5.13.0-27-generic
Restricted Mode: No

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz (8 x 2400)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 1, 1, 1
Memory (System) 7.51GB (0.39GB free)
Process Argv --unity-launch --crash-reporter-id 355bcffe-c3aa-4b6e-a779-e66010575b25
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
testflight:30433670
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vsclayoutctrt:30451275
dsvsc009:30452663
pythonvsnew555:30450902
vscscmwlcmt:30438805
vscgsvidc:30447482
cppdebug:30451566
pynewfile477cf:30450039

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Mar 15, 2022
@karthiknadig
Copy link
Member

@FeryET Can you verify this behavior outside of python extension? We don't see anything specifically that should cause such a selective behavior with linting.

@karthiknadig karthiknadig self-assigned this Mar 15, 2022
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug area-linting triage and removed triage-needed Needs assignment to the proper sub-team labels Mar 15, 2022
@FeryET
Copy link
Author

FeryET commented Mar 15, 2022

@FeryET Can you verify this behavior outside of python extension? We don't see anything specifically that should cause such a selective behavior with linting.

Pre-commit hook of flake8 and installing standalone flake8 have no problem understanding the .flake8 config. The only place that I've found this to be problematic is the extension.

I have also tried explicitly giving the extension the .flake8 path via --config flag for flake8Args, but to no avail. For whatever it's worth, I suspect maybe the shell that the extension spawns maybe doesn't support the command that lists the files in a directory recursively? It's the only difference that I can think of.

I've also tested both in bash and zsh environments.

@karthiknadig
Copy link
Member

karthiknadig commented Mar 15, 2022

@FeryET Any chance you can try out this prototype extension for flake8 and see if it helps with this issue? PyCQA/flake8#1467 (comment)

Be sure to disable linting from the python extension before trying.

@karthiknadig karthiknadig added the info-needed Issue requires more information from poster label Mar 17, 2022
@brettcannon
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2022
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 info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants