-
-
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
Linting the wrong file #88
Comments
Can you confirm whether this is just an issue of displaying the wrong file name, or whether you're getting unexpected linting errors as a result? In the background the dbt templater does use the compiled file as part of the input, so I'm not totally suprised that this is happening. It definitely should not be happening if you're using the jinja templater however. |
When I open the file in the target folder (the one that actually linted), then most of the linting is in the wrong place. It takes a few seconds while sqlfluff is run on the file in the target folder and everything is in order again. So, to answer your question, yes, unexpected linting errors. All in all it looks a bit random. Sometimes (rarely) it picks the right file. Most of the times its one from the target/compiled or target/run folder. I first thought it had something todo with the 'sqlfluff.format.enabled = true' setting, however that was just lucky first try. |
Correct me if i'm wrong, but it looks like the fileGlob for lookup up the file will match any matching part of the path, as long as the end is similar. In my case this is true.
**/{filePath} will match all of the cases;
and on this line results are limited to 1:
This would explain the randomness of the results. I'd expect a full match on the path here. |
@ferdyh I believe you are correct. I struggled to recreate this unless I switched to the other file while the linting was being processed, which was weird. Either way, definitely a bug. Should be fixed later today in the next version |
@ferdyh Please update to v2.2.5 and let us know if that solves the issue. |
@RobertOstermann That looks better, thanks! |
When I run the linter (jinja or dbt) on a project file, the right command is executed, with the right relative path. However, when the command finishes the wrong file is linted. So for example:
models/datamart_a/model.sql (file i created and is used while executing sqlfluff)
target/compiled/projectname/models/datamart_a/model.sql (is linted / shown in Problems tab)
Can't seem to find any setting relating to this problem.
The text was updated successfully, but these errors were encountered: