martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.21k stars 258 forks source link

Luacheck fixes #918

Closed moesasji closed 3 years ago

moesasji commented 3 years ago

Running make luacheck showed what seem to be two potential bugs. I think I managed to fix the first one in the first commit. How to fix the second one isn't clear. The warning is as follows:

` Checking lua/plugins/filetype.lua 1 warning

lua/plugins/filetype.lua:542:6: accessing undefined variable mime

`

To me this warning triggered by this line indeed looks like this part of the code wouldn't pick up the mime variable from the defined file-extensions, so I don't think this is a false positive. Unfortunately not at all clear to me how to fix this one.

While there I also silenced the "unused argument warnings" as one can't pass ignore values to make luacheck and not returning false positives is probably the better approach seeing that the developer documentation recommends to run make luacheck here.

martanne commented 3 years ago

In general I don't like to clutter the source with workarounds just to make some diagnostic tools happy. This also recently came up in a C context #893.

Most of the warnings should be fixed by d2d6b29f7f86f9bfedeb6c8050f68cda5196b1e4, in Lua _ is typically used as a variable name for unused results.

moesasji commented 3 years ago

Thanks for fixing those. Note that you still have the warning that I didn't know how to fix, which does look like a genuine bug to me.