action-sqlfluff
action-sqlfluff copied to clipboard
fix wrong lint exit code
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"
@yu-iskw
@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.
@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
dbtSqlFluff returns Dbt's warning logs, and those lines cause failure withjq(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
I'm still seeing this issue where there are linting problems, but workflow is green