• glualint - Linter for Garry's mod Lua
    87 replies, posted
[img]http://i.imgur.com/bzsG8nH.png[/img] [B]glualint - Linter and pretty printer for Garry's Mod Lua![/B] Now with sublime plugin [B]Linter features:[/B] - Inconsistent use of C-style and Lua style syntax (if true && true and true) - Deprecated functions - Scope depth checking (when you have 7 nested scopes you're doing something wrong) - Goto hating: using goto anywhere but a double nested loop makes you an idiot - Duplicate keys in a table ({a = 1, a = 2, b = 3}) - self.Weapon in SWEPs/self.Entity in SENTs - not (a == b), not (a ~= b), not (a > b) etc. - Inconsistent " vs ' usage - Variable/parameter/loop var/function name shadowing - Using "self" in a non-metafunction - Trailing whitespace - Lack of whitespace around operators, after a keyword or after a ')' - Inconsistent use of tabs and spaces for indentation (really basic, only looks for both "\n\t" and "\n " in whitespace) - Empty conditions/loops - Unused local variables - Unnecessary if statements in if statements (or while loops) - Unnecessary parentheses [B]Installing:[/B] 1. [url=https://github.com/FPtje/GLuaFixer/releases]Get the latest version of glualint here![/url] 2. Place the glualint executable inside some folder' 3. Add the folder you put glualint in to your PATH. How this is done differs per operating system. When not sure how to do this, please Google "[I]Add to path <YOUR OS>[/I]" [u]Failure to perform the third step will cause glualint to fail in Sublime![/u] [B]Installing in atom:[/B] Follow the above three steps. Make sure not to forget the third one or it won't work. 4. Open Atom 5. Go to Settings -> Install 6. Install both the [url=https://atom.io/packages/linter]linter[/url] and the [url=https://github.com/FPtje/linter-glualint]linter-glualint[/url] packages ([b][i]not[/b][/i] [i]linter-glua[/i]) [B]Installing in sublime:[/B] Follow the above three steps. Make sure not to forget the third one or it won't work. 4. Open sublime text 3 5. Make sure that [url=https://packagecontrol.io/]package control[/url] is installed 6. Open the command palette (Ctrl + Shift + P) 7. Type "Install" and select "Package Control: Install Package" 8. Type "glualint" and select "SublimeLinter-contrib-glualint" 9. Restart sublime. 10. Repeat steps 4 to 9 with "SublimeLinter" itself if you don't have that yet [B]Configuring glualint:[/B] Both the linter itself and the pretty printer can be configured. Please check out the [url=https://github.com/FPtje/GLuaFixer#configuring-glualint]README[/url] for all the necessary information on that. [highlight]FAQ[/highlight] [B]Q: [/B] IT DOESN'T WORK [B]A: [/B] YOU FAILED TO ADD THE EXECUTABLE TO THE PATH. TRY AGAIN. [B]A: [/B] If you're REALLY sure that glualint is in path, make sure you have the right packages installed (SublimeLinter and SublimeLinter-contrib-glualint for sublime, linter and linter-glualint for atom) [B]A: [/B] Problems may occur if you put glualint in C:\ or C:\Program Files. Try putting glualint somewhere in C:\users\yourusername\, like the "my documents" folder. [B]A: [/B] If it STILL doesn't work, at least in sublime you can debug the linter. [I]Ctrl + shift + P -> SublimeLinter debug -> SublimeLinter: Enable Debug Mode[/I]. Then open the console (view -> Show Console) and look for any errors.
This is amazing! Thank you so much for releasing this!
Nice job. It's a shame sublime is Windows-only (probably works in wine)
[QUOTE=ph:lxyz;48539121]Nice job. It's a shame sublime is Windows-only (probably works in wine)[/QUOTE] eh? [url]http://www.sublimetext.com/2[/url] or [url]http://www.sublimetext.com/3[/url] (beta)
So are you supposed to use a Lua linter with this? It doesn't look like this is for syntax checking.
Nice, finally a linter which also works on linux.
Good job!
-snip- space in path mistake
[QUOTE=gonzalolog;48539358]I don't know how to use it, i've installed glualint and added the path, but when i try to "Use" it, nothing happens [img]https://dl.dropboxusercontent.com/s/jg0lhp1s9mir01k/2015-08-25_15-30-05.jpg?dl=0[/img][/QUOTE] Nothing happening means sublimelinter can't reach the executable. This other guy said it wouldn't work when he put it in his G:\ drive, but it did work when he put it in some folder. [editline]25th August 2015[/editline] [QUOTE=Tenrys;48539165]So are you supposed to use a Lua linter with this? It doesn't look like this is for syntax checking.[/QUOTE] It's disabled by default because it assumes gluac is installed. You can turn syntax checking on in the glualint.json settings. edit: Version 1.1.1 of glualint checks syntax by default.
Why does glualint.exe give me bullshit about missing libs? [t]http://tenrys.montoyo.net/ShareX/2015-08-26_13-37-57.png[/t] [t]http://tenrys.montoyo.net/ShareX/2015-08-26_13-38-08.png[/t] [t]http://tenrys.montoyo.net/ShareX/2015-08-26_13-38-24.png[/t] [t]http://tenrys.montoyo.net/ShareX/2015-08-26_13-38-33.png[/t]
[QUOTE=Tenrys;48544064]Why does glualint.exe give me bullshit about missing libs? [/QUOTE] Ah, god damnit, I uploaded glua[U]fixer[/U] instead of glua[U]lint[/U]. I've replaced the download with the right program. Sorry about that.
[QUOTE=gonzalolog;48539358] I don't know how to use it, i've installed glualint and added the path, but when i try to "Use" it, nothing happens [img]https://dl.dropboxusercontent.com/s/jg0lhp1s9mir01k/2015-08-25_15-30-05.jpg?dl=0[/img] [/QUOTE] Gotta ask, why not the built-in functionality of (tm == LocalPlayer():Team() ? "win.mp3" : "lose.mp3") instead of Either(tm == LocalPlayer():Team(), "win.mp3", "lose.mp3")? I'm assuming that's what [i]Either(,,,)[/i] is.
[QUOTE=Conna;48544471]Gotta ask, why not the built-in functionality of (tm == LocalPlayer():Team() ? "win.mp3" : "lose.mp3") instead of Either(tm == LocalPlayer():Team(), "win.mp3", "lose.mp3")? I'm assuming that's what [i]Either(,,,)[/i] is.[/QUOTE] Because good lua style lua does not use ternary statements Edit: C style ternary statements, I mean
[QUOTE=Conna;48544471]Gotta ask, why not the built-in functionality of (tm == LocalPlayer():Team() ? "win.mp3" : "lose.mp3") instead of Either(tm == LocalPlayer():Team(), "win.mp3", "lose.mp3")? I'm assuming that's what [i]Either(,,,)[/i] is.[/QUOTE] Either is a Lua function added by [del]an idiot[/del] our lord and savior and is deprecated BECAUSE IT IS SHIT. Use (tm == LocalPlayer():Team() and "win.mp3" or "lose.mp3") [editline]26th August 2015[/editline] [QUOTE=Ylsid;48544887]Because good lua style lua does not use ternary statements[/QUOTE] you're dumb too
-snip- fixed
[QUOTE=kpjVideo;48547920]Sorry if I may just be dumb, but I've installed all the required sublime plugins and checked my environment PATH (windows/system32 it seemed) and added the required exe file. Whenever I run the 'pretty' function inside Sublime it doesn't seem to do anything. After looking a few posts above it seems I may have it in the wrong path, would you happen to have an idea what I need to change?[/QUOTE] Try using the path config of sublimelinter. Preferences -> Package settings -> Sublimelinter -> Settings - User. Also don't put it in system32..., put it in a folder created by you somewhere (like desktop)
[QUOTE=zerf;48547850]Either is a Lua function added by [del]an idiot[/del] our lord and savior and is deprecated BECAUSE IT IS SHIT. Use (tm == LocalPlayer():Team() and "win.mp3" or "lose.mp3") [editline]26th August 2015[/editline] you're dumb too[/QUOTE] I don't think anyone actually ever used this, not even Garry.
Anyone else needs OSX support besides me?
[QUOTE=bububuubb;48550612]Anyone else needs OSX support besides me?[/QUOTE] Osx is not supported because I don't have an apple device.
[QUOTE=FPtje;48550784]Osx is not supported because I don't have an apple device.[/QUOTE] i have :v:
[QUOTE=bububuubb;48551682]i have :v:[/QUOTE] It should be possible to build from source. Install ghc and cabal using this package: [url]https://www.haskell.org/platform/#osx[/url] Clone the GLuaFixer repository Open a terminal in the folder and enter these commands: [code] cabal sandbox init cabal update cabal install --only-dependencies cabal configure --cabal-lib-version=1.22.2.0 cabal build glualint [/code] After that you should find a single executable in dist/build/glualint.
[QUOTE=FPtje;48551925]It should be possible to build from source. Install ghc and cabal using this package: [url]https://www.haskell.org/platform/#osx[/url] Clone the GLuaFixer repository Open a terminal in the folder and enter these commands: [code] cabal sandbox init cabal update cabal install --only-dependencies cabal configure --cabal-lib-version=1.22.2.0 cabal build glualint [/code] After that you should find a single executable in dist/build/glualint.[/QUOTE] Just to add: if you have any [I]files[/I] (instead of directories) in your $PATH, you might have to remove them for the dependencies to install correctly or cabal will throw a fit.
Will there be a version for Sublime text 2? Just wondering [editline]27th August 2015[/editline] Also, its giving me this error [QUOTE]Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 556, in run_ return self.run(edit) File "prettyprint in C:\Users\usuario\AppData\Roaming\Sublime Text 3\Installed Packages\SublimeLinter-contrib-glualint.sublime-package", line 14, in run File "prettyprint in C:\Users\usuario\AppData\Roaming\Sublime Text 3\Installed Packages\SublimeLinter-contrib-glualint.sublime-package", line 30, in prettyPrint File "./subprocess.py", line 824, in __init__ File "./subprocess.py", line 1118, in _execute_child FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado[/QUOTE] Last line means: The system could not find the specified file
[QUOTE=geferon;48553394]Will there be a version for Sublime text 2? Just wondering [editline]27th August 2015[/editline] Also, its giving me this error Last line means: The system could not find the specified file[/QUOTE] I wish adding an executable to a path wasn't so hard in Windows. You've failed step 3.
[QUOTE=FPtje;48554029]I wish adding an executable to a path wasn't so hard in Windows. You've failed step 3.[/QUOTE] I did add it to path. Look: [IMG]http://imageshack.com/a/img537/8591/XzDzdB.png[/IMG] [IMG]http://imageshack.com/a/img537/9031/d3Juko.png[/IMG]
In that case I have no idea what's wrong. Perhaps try putting glualint in a folder somewhere in C:\users\yourusername. Have you installed SublimeLinter itself? Have you restarted sublime since changing the path?
Yes. I did ALL of that. I did restart sublime like 5 times. Still giving the same error. Maybe i just need a reboot
-snip-
[url=https://github.com/FPtje/GLuaFixer/releases]OSX version now available![/url] I've managed to install OSX on a virtual box. It runs at about 5 fps max, has terrible problems with screen resolution, has visible tearing and it takes about a century to start, but I've managed to make it compile. Installation instructions are the same as for every other OS.
[QUOTE=geferon;48554531]Yes. I did ALL of that. I did restart sublime like 5 times. Still giving the same error. Maybe i just need a reboot[/QUOTE] If that doesn't work, you might want to try adding a backward slash, changing it to "C:\servers\glualint\". I've personally had issues like that before with the Java JDK and adding the backward slash seemed to fix it.
Sorry, you need to Log In to post a reply to this thread.