Closed cmcnicoll closed 1 year ago
There was a change in that version with making paths absolute.
Can you add a "./" before your paths and see if that fixes the issue for you?
That didn't work for me. I also can't get the --exclude
option to work: sqlfmt . --check --exclude ./dbt/target/**/*
.
ok, thanks!
related to #427
@cmcnicoll Would love it if you could give v0.19.0 a spin -- I'm pretty sure it'll fix your issue but I didn't have a perfect repro on my machine, so I'm not 100% sure.
My exclude
config in pyproject.toml
is working again as-is. Thanks!
sqlfmt . --check -k -q
1 file failed formatting check.
176 files passed formatting check.
However, I still can't get the --exclude
option to work.
sqlfmt . --check -k -q --exclude ./dbt/**/* --exclude ./sql/**/*
192 files had errors while formatting.
1681 files failed formatting check.
1234 files passed formatting check.
Depending on your she'll, you might have to quote those paths?
That didn't work for me. I tried path
, ./path
, .\path
, "path"
, "./path"
, ".\path"
.
The --exclude
behavior is the same for bash
and cmd
except for one case, which threw an error:
(.dbtenv)
aaa@aaa MINGW64 /c/aaa-aaa/dbt/tests (aaa)
$ sqlfmt . --check -k -q --exclude .\integration_tests\**\*
Traceback (most recent call last):
File "C:\Users\aaa\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\aaa\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\users\aaa\.local\bin\sqlfmt.exe\__main__.py", line 7, in <module>
File "C:\Users\aaa\.local\pipx\venvs\shandy-sqlfmt\lib\site-packages\click\core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "C:\Users\aaa\.local\pipx\venvs\shandy-sqlfmt\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\aaa\.local\pipx\venvs\shandy-sqlfmt\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\aaa\.local\pipx\venvs\shandy-sqlfmt\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\Users\aaa\.local\pipx\venvs\shandy-sqlfmt\lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Users\aaa\.local\pipx\venvs\shandy-sqlfmt\lib\site-packages\sqlfmt\cli.py", line 185, in sqlfmt
matched_files = api.get_matching_paths(files, mode=mode)
File "C:\Users\aaa\.local\pipx\venvs\shandy-sqlfmt\lib\site-packages\sqlfmt\api.py", line 105, in get_matching_paths
exclude_set.update(mode.exclude_root.glob(s))
File "C:\Users\aaa\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 1033, in glob
selector = _make_selector(tuple(pattern_parts), self._flavour)
File "C:\Users\aaa\AppData\Local\Programs\Python\Python310\lib\pathlib.py", line 374, in _make_selector
raise ValueError("Invalid pattern: '**' can only be an entire path component")
ValueError: Invalid pattern: '**' can only be an entire path component
I can repro on Powershell, I'm going to create a new issue for this
Describe the bug Upgraded to
0.18.3
and ransqlfmt -k .
, which ignored the exclude config. Reverted to0.18.1
and exclude config works again. Do I have to update mypyproject.toml
?To Reproduce I'm using Windows 11 Pro, Visual Studio Code, venv, powershell terminal.
Additional context What is the output of
sqlfmt --version
?sqlfmt, version 0.18.3