-
Notifications
You must be signed in to change notification settings - Fork 324
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
Add luacheck config #1741
Add luacheck config #1741
Conversation
For
|
Already noticed here: |
Good catch, it's the subcheck that should be handed to need_table, but it does not exist, which need_table checks for, before executing it, hence no breakage. |
|
How about adding lua extensions where possible? cc @NeoRaider |
I think 120 characters is mighty fine these days. |
...gluon-config-mode-geo-location-osm/luasrc/usr/lib/lua/gluon/config-mode/geo-location-osm.lua
Outdated
Show resolved
Hide resolved
As wished on IRC this PR should not mix fixes for warnings and the lua config file. I removed the "fix" part, and might open different PR for that, atm the opinions of the Gluon developers are missing how specific luacheck warnings should be handled (ignored, ..) The config contains atm global definitions (global functions, variables, and so on), mostly. |
How about instead of listing all those globals in the config, we update our modules to define them in an explicit module table? This will be necessary anyways to become compatible with Lua 5.3. |
@NeoRaider could you point to an example? Checking http://lua-users.org/wiki/ModulesTutorial it could be something like:
and including the module
Or do you have something different in mind? |
Yes, like this.
|
how do you apply the file I guess, just install and call like this:
How do you activate it in github as auto-check then? Do you want to use Travis? |
What to do about the following issues? (running
|
Maybe we should ignore all warnings for now and implement only a check for errors at first.
Then we would only get those errors:
all no valid errors, because they are a bug in luacheck: mpeterv/luacheck#152 I added this in our Travis check for our site config: Freifunk-Nord/nord-site@a4aeb8a works fine, thanks ;) |
@rubo77 Why are you even checking the luci feed? We don't use any packages from that feed, and there is no use in linting code that is not in our repo anyways. All warnings in the Gluon packages are easy to fix - and some of them hint at real bugs. |
@bobcanthelpyou
Yes, likely a good idea. |
@bobcanthelpyou Have you already fixed the issues in |
Added the fixes in a separate pull request #1748 Removed all globals which are not required anymore. |
I think most of the globals should actually be read_globals. |
I misused Added globals of |
Squashed and rebased to master |
In the mumble developer meeting the lua linter
luacheck
was suggested for the CI pipeline.As i played around with it, and already have some
.luacheckrc
snippets for Gluon i want to add the config file and try to fix warnings found by luacheck.In the
check_site.lua
files the following issues where fixedline is too long (137 > 120)
-> what is the maximum line length that should be used in Gluon? 120 is the default by luacheckunused loop variable k, v
-> replaced by_
setting non-standard global variable from, to
-> addlocal
line contains trailing whitespace
-> removed