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

Wildcards in fortls #196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

pclausen
Copy link

First of all, I am so grateful for this project making my life in Fortran and VSCode so much better.

I was missing the feature of wildcards in .fortls file, mainly excl_paths eg

{
  "excl_paths": ["sub*"]
}

The change to allow this is line 200. I allowed myself also to change the

            `if self.excl_paths.count(dirName) > 0:`

to
if dirName in self.excl_paths:

which I think reads better, but maybe the other implementation has a performance reason or something else I am not aware of.

I was not able to run all test successfully with my Python3.9 on Windows 10. I am getting these assertion errors which I do not how to cope with.

Lib\site-packages\pyflakes\test\test_api.py:816: AssertionError
================================================================ short test summary info ================================================================ 
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_errors_io - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Python3...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Pyt...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Py...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_goodFile - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Python39...
FAILED Lib/site-packages/pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin - AssertionError: Tuples differ: ('', "E:\\nosave\\Python\\Pyt...
======================================================= 5 failed, 718 passed, 38 skipped in 8.90s =======================================================

@gnikit
Copy link

gnikit commented Apr 17, 2021

This is a pretty handy feature to have, thanks. IMO I think it is worth adding it in the include paths and include dirs as well, but ultimately that is @hansec 's call.

I should note though that there is a conversation to be had and a choice to be made here. glob.glob() performs non-recursive pattern matching which might or might not be what the user wants depending on the underlying project. There might be cases where the recursive=True is what is needed.

For example if you want to exclude all dir1 directories in the following directory structure

.
├── dir1
└── dir2
    └── dir1
        └── dir2

you would normally do something like

In [2]: glob.glob('**/dir1*', recursive=True)
Out[3]: ['dir1', 'dir2/dir1']

with the current implementation this will only exclude dir2/dir1.

@pclausen
Copy link
Author

Good point. I'm fine with any version of wildcard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants