-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow exclude files #118
Comments
This is an example of the error messages reported in the SQLFluff output: ------------------------------------------------------------
Reading from workspace, not stdin
--------------------Executing Command--------------------
/opt/conda/envs/dev/bin/sqlfluff lint --format json --exclude-rules RF01
------------------------------------------------------------
Received close event, code 1 signal null
Raw stdout output:
------------------------------------------------------------
------------------------------------------------------------
Raw stderr output:
------------------------------------------------------------
Traceback (most recent call last):
File "/opt/conda/envs/dev/bin/sqlfluff", line 8, in <module>
sys.exit(cli())
^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/cli/commands.py", line 633, in lint
result = lnt.lint_paths(
^^^^
^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/core/linter/linter.py", line 1084, in lint_paths
for i, linted_file in enumerate(runner.run(expanded_paths, fix), start=1):
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/core/linter/runner.py", line 107, in run
for fname, partial in self.iter_partials(fnames, fix=fix):
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/core/linter/runner.py", line 60, in iter_partials
for fname, rendered in self.iter_rendered(fnames):
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/core/linter/runner.py", line 47, in iter_rendered
yield fname, self.linter.render_file(fname, self.config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/core/linter/linter.py", line 751, in render_file
raw_file, config, encoding = self.load_raw_file_and_config(fname, root_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/core/linter/linter.py", line 120, in load_raw_file_and_config
encoding = get_encoding(fname=fname, config=file_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/dev/lib/python3.11/site-packages/sqlfluff/core/file_helpers.py", line 13, in get_encoding
with open(fname, "rb") as f:
^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/workspaces/sample/target/test-classes/cleanup.sql'
------------------------------------------------------------
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have configured:
So, when I open a project, all sql files are parsed.
The problem here is that "all" files are parsed and, in my case, some of them are generated copies "on the fly" from the original ones.
I have a Java project with some sql file in the class path. When I open the project those files are copied to target/classes folder (which is also removed before re-generated).
This makes an error for sqlfluff parsing files from a directory that, suddenly, does not exists.
It should be great to have an option, similar to files.exclude, that allows excluding files and directories from being parsed by sqlfluff.
The text was updated successfully, but these errors were encountered: