Skip to content

flake8 test failure due to obsolete flake8 configuration #286

@gav451

Description

@gav451

Hello, I traced failing test report below

=========================== short test summary info ============================
FAILED test/plugins/test_flake8_lint.py::test_flake8_multiline - AssertionError: assert ['flake8', '-...W3,W6,B,B950'] == ['flake8', '-...h/...
============ 1 failed, 136 passed, 9 skipped, 7 warnings in 48.28s =============

back to the presence of a ~/.config/flake8 file that is picked up by pylsp/config/flake8_conf.py. The patch below makes the test succeed because it excludes extra options picked up from the configuration file.

--- a/test/plugins/test_flake8_lint.py
+++ b/test/plugins/test_flake8_lint.py
@@ -126,7 +126,7 @@ exclude =
         flake8_lint.pylsp_lint(workspace, doc)

     call_args = popen_mock.call_args[0][0]
-    assert call_args == ["flake8", "-", "--exclude=blah/,file_2.py"]
+    assert call_args[3] == ["flake8", "-", "--exclude=blah/,file_2.py"]

     os.unlink(os.path.join(workspace.root_path, "setup.cfg"))

However, according to the documentation section Flake8 Configuration Locations, flake8 looks for its configuration files (setup.cfg, tox.ini, and .flake8) only in its project or workspace directory. I would expect that pylsp would do the same to ensure identical flake8 messages from the command line and the server. Do you think it is worthwhile to propose a PR implementing this policy?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions