action-sqlfluff icon indicating copy to clipboard operation
action-sqlfluff copied to clipboard

fix wrong lint exit code

Open XiChu2333 opened this issue 3 years ago • 4 comments

fix issue #39

https://github.com/yu-iskw/action-sqlfluff/compare/main...XiChu2333:action-sqlfluff:main#:~:text=%24lint_results%22-,sqlfluff_exit_code%3D%24%3F,-sqlfluff_exit_code%3D%24%3F

Variable sqlfluff_exit_code would receive the return code of command "tee "$lint_results"" instead of the return code sqlfluff. So, the return code is always 0. Fix it by using ">>" to replace "tee"

XiChu2333 avatar Jul 21 '22 21:07 XiChu2333

@yu-iskw

kieronellis avatar Aug 31 '22 14:08 kieronellis

@XiChu2333, thanks for this patch. Did you consider using sqlFluff's --write-output, instead of >> ?

In my project, we have a few configurations which don't apply to any resources; thus, when templater configured with dbt SqlFluff returns Dbt's warning logs, and those lines cause failure with jq (to built rdjson)

18:16:56  [WARNING]: Configuration paths exist in your dbt_project.yml file which do not apply to any resources.
There are 21 unused configuration paths:
- models.my_project.staging.mysql_user
- models.my_project.staging.braze_user
...
[...actual format=json lint result here..]

--write-output worked better in my case.

ktopcuoglu avatar May 22 '23 22:05 ktopcuoglu

@XiChu2333, thanks for this patch. Did you consider using sqlFluff's --write-output, instead of >> ?

In my project, we have a few configurations which don't apply to any resources; thus, when templater configured with dbt SqlFluff returns Dbt's warning logs, and those lines cause failure with jq (to built rdjson)

18:16:56  [WARNING]: Configuration paths exist in your dbt_project.yml file which do not apply to any resources.
There are 21 unused configuration paths:
- models.my_project.staging.mysql_user
- models.my_project.staging.braze_user
...
[...actual format=json lint result here..]

--write-output worked better in my case.

That sounds good. But seems the author has correct the file himself. I don't know why this PR is still here

chu-xi avatar May 23 '23 01:05 chu-xi

I'm still seeing this issue where there are linting problems, but workflow is green

enclaver avatar Jan 24 '24 23:01 enclaver