Closed texpert closed 6 years ago
That syntax is not standard Lua so luacheck doesn't support it. You could filter it out before passing file contents to luacheck, e.g. sed 's/<%=.*%>//' my_file_with_include_partial.lua | luacheck -
.
Thanks for advise, @mpeterv , but I have no idea how to accomplish this running codeclimate-luacheck
, if it is possible at all.
I could only completely disable 011 checks in Code Climate, but this is not an option.
I'm not sure that codeclimate-luacheck will decide to support that syntax extension either. If you just want to avoid breaking build with this, you could configure codeclimate to run luacheck only on files that you know don't containt that syntax (assuming it has a way to select what files should be linted). Alternatively, luacheck could have an option to filter out syntax errors, but normally that's a very strange thing to want.
Unfortunately, there are lot of such files in the project...
@texpert Hi, I'm the maintainer of codeclimate-luacheck.
So the issue is the wolverine library: https://github.com/Shopify/wolverine#nested-lua-scripts suggests you to write invalid Lua.
IMHO the .lua files should have .lua.erb
extension, because they are indeed ERB files, not plain Lua files.
You could also make those lua files valid by:
-- <%= include_partial "foo" %>
local foo = "foo"
And change https://github.com/Shopify/wolverine/blob/d917d57b79b223389ad62a936581ecf4e084b349/lib/wolverine/script.rb#L98 to output a \n
(maybe even with a file name) before rendering the template.
This is not really luachecks problem.
Hello!
It is a common practice to use shared Lua scripts in Wolverine Ruby gem with a command like:
For which luacheck is reporting a syntax error:
Could these errors be somehow avoided?