Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

lslint - offline code checker for LSL

Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
03-10-2006 19:06
Thanks Masakazu

The other real minor thing (that I haven't worked out how to do) would be to override F7 (instead of CNTL-F7) to automatically do the SAVE -> COMPILE -> COPY_TO_CLIPBOARD. This would save a few extra key strokes each time :)

Cheers
Greg
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
03-10-2006 21:26
From: Masakazu Kojima
I couldn't see any way to when I played with it. The docs say "SciTE partially understands the error messages produced by Python, GCC, Visual C++, Borland C++, PHP and other tools which use the same format as one of these," so I'm guessing you can't make it understand custom error formats, but I can't say for sure.

I had a little hunt around the net for this and found a few hints at what the error format has to be for SciTE to recognise them. This page about JSL pretty much explains it, and it fits in with comments I've seen on a number of other pages...

From: someone
You will also need to change your JavaScript Lint configuration so that SciTE will correctly place a yellow dot at the beginning of the line corresponding to the current error (see screenshot). Change the "output-format" setting to:

+output-format __FILE__:__LINE__: __ERROR__

So it seems to need the name of the source file (which also allows inclusion of a full path to the file), the the line number, then the error message, with colons in between each. I've also consistantly noticed that they have no spaces around the colons, except for one space right in front of the error message itself. They don't specifically mention the double-click here but from what I've seen the display of the "yellow dot" goes hand in hand with the double-click functionality.

Of course all of this assumes you're not using includes cause I guess the lines numbers are still going to be wrong if you do. What we really need now is for lslint to somehow check how many lines are in the includes and adjust for it when it outputs the line numbers of the errors, although I'm not sure how you'd actually indicate errors in the include files if it could be done that way.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-11-2006 14:39
++ & -- still don't work on floats (they should)
CODE

--move_a.y;
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
03-12-2006 19:56
using "lslint v0.2.4 by masa, built 2006-03-08"

I like the "function `XXX' declared but never used" warning which are shown.

I've noted that if you have 10 such functions you might get some which aren't highlighted the first round through. Then, after you have removed the unused functions which were highlighted (say 6 items) and then do another build, it then picks up more of the ones it missed.

Does this make sense.

Greg
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-13-2006 00:30
In my mind it makes sence to to keep the current functionality as is. Those functions are depended on by the other functions. Even if the other functions are not called.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
03-16-2006 01:05
just noted something lslint didn't pick up

CODE
if (llGetListLength(params) > 4) 
string param1 = llList2String(params, 4);


Gives in SL an "ERROR : Declaration requires a new scope -- use { and }"
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
lslint vs LSL difference: Integer/Integer gives 0, but Integer/(float)Integer works?
03-28-2006 17:03
(as posted in /54/7a/96762/1.html)

Interesting, I just noted a case I have where Integer/Integer gives 0, but Integer/(float)Integer works? Specifically:

llCeil(llStringLength(message) / (float)dataLen)
==> WORKS (as I want it to)
==> lslint.exe reports this as an error "ERROR:: (164, 46): Invalid operator: integer / float"

llCeil(llStringLength(message) / dataLen)
==> gives 0 (not what I wanted)
==> lslint.exe reports no errors in this case

Is this expected operations? Seems to imply LL and lslint at the minimum aren't aligned? (I'll post this to the lslint thread too)

Cheers
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
global variable initialisation - setting string to a list
03-30-2006 04:53
Masakazu ,

Justed noted that the following wasn't picked up by lslint - "string emailStringBuffer = [];" when used in the global settings area.

SL gives a "ERROR - Type mismatch"

regards
Greg
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
03-30-2006 05:02
From: Greg Hauptmann
Justed noted that the following wasn't picked up by lslint - "string emailStringBuffer = [];" when used in the global settings area.

SL gives a "ERROR - Type mismatch"


That is a type mismatch. You're trying to assign an empty list to a string variable.

EDIT: OK ignore me... you're saying that SL picked it up and lslint didn't.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
04-13-2006 19:47
Could we get an updated version with 1.9 additions? (and 1.9.1 too)
Maybe make lslint have input file so it can have functions & constants added?
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
04-13-2006 19:55
I'll post an updated version when 1.9.1 is finalized.
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
04-13-2006 20:34
Thanks Masakazu

BTW - Did anyone have time to the issue of how to configure things so that you can double click on a lslint error message at the bottom and for it to take you to that point in the code? (ie using SciTE)
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
04-13-2006 21:09
^_^ yah
I was worried that you had been carried away by a pack of wild prims to be offered up as a sacrifice to King Kong Prim (you'd be tied up in court for years for copyright infringement).
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
04-16-2006 05:58
Hi Masakazu,

Noted that the following code was OK in lslint, however got an SL error of "Not all code paths return a value" in the SL IDE.

CODE
string getProtocolName(integer protocol) {
if (protocol == PROTOCOL_LINK)
return "LINK";
else if (protocol == PROTOCOL_CHAT)
return "CHAT";
else if (protocol == PROTOCOL_EMAIL)
return "EMAIL";
else
log(ERROR, "getProtocolName got passed an invalid protocol value of " + (string)protocol);
}


Regards
Greg
MC Seattle
Registered User
Join date: 3 Apr 2006
Posts: 63
04-16-2006 12:37
I was also able to trick lslint in to thinking code was good by declaring a variable after it was used. It didn't check the order of operations properly, just that the variable existed in the proper scope. Other than minor flaws this is a very handy piece of code!
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
05-29-2006 16:50
0.2.5: 2006-05-29
- added new constants and functions from versions 1.9 and 1.10
- fixed integer/float
- fixed global declaration type checking

http://w-hat.com/lslint/

Let me know if I missed anything.
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
06-01-2006 20:28
llSin is undefined, give an undeclared error
Wonko Barmy
Registered User
Join date: 28 Feb 2005
Posts: 2
06-07-2006 08:15
From: Masakazu Kojima
Let me know if I missed anything.

OK, you missed the Mac version. Pretty please :)
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
06-11-2006 01:09
PRIM_POINT_LIGHT seems to have been missed from the 1.10 additions. Whenever I use it lslint gives me... `PRIM_POINT_LIGHT' is undeclared.
Rifkin Habsburg
Registered User
Join date: 17 Nov 2005
Posts: 113
06-20-2006 21:00
From: Wonko Barmy
OK, you missed the Mac version. Pretty please :)

Seconded. Can you please post a Mac version for the latest lslint? I'm getting errors on all my llHTTPRequest() calls...
_____________________
Procyon Games: makers of Can't Stop, En Garde, Take it Easy, Danger Zone and Frootcake.
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
06-21-2006 01:18
From: Strife Onizuka
Maybe make lslint have input file so it can have functions & constants added?


I'd just like to reiterate this suggestion of Strifes. I think this is a really good idea. It can be frustrating when one or two functions have been missed and the updates take a while. I tried to get around the missing PRIM_POINT_LIGHT constant by using the $[Exxxx] error thing but couldn't seem to get it to work so I've had to switch lslint off entirely for now. Please consider moving the definitions to an external file.
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
06-21-2006 04:08
From: Kermitt Quirk
I'd just like to reiterate this suggestion of Strifes. I think this is a really good idea.
I agree. 0.3 loads the constants, builtins, events, configuration, and a few other things from external files, or embedded defaults that you can extract and mess with. I am planning on releasing the source for it as well. The current lslint is based on LL's lex and yacc files, which are awful, and have all the constants and events hard-coded into the lexer and parser. 0.3 is rewritten from scratch, and should be ready in the next few weeks.

I haven't been able to compile a mac version because I don't have access to a mac right now, but I will post one as soon as I can. I'll also update 0.2 with PRIM_POINT_LIGHT and llSin() later today.
Natalie Weeks
Registered User
Join date: 10 May 2006
Posts: 1
06-21-2006 12:36
ERROR:: (472, 10): `llListSort' is undeclared.

Might want to add that too.

Great Program though, Very Usefull!
I have my esl precompile, then run through lslint, then to the clipboard. whoo... now if only there was a way to calculate the memory usage of your: bytecode + stack (at max) + heap (at max) :P

~Natalie~
Trevor Langdon
Second Life Resident
Join date: 20 Oct 2004
Posts: 149
06-21-2006 12:49
Natalie beat me to it.

llListSort() was recognized in lslint 0.2.4 and still shows a link to wiki in lslint 0.2.5, but is no longer recognized as an LL function.

Kudos on lslint!
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
06-21-2006 16:01
0.2.6: 2006-06-21
- Fixed llSin, llListSort
- Added PRIM_POINT_LIGHT, PRIM_FLEXIBLE, PRIM_TEXGEN_*
- Added HTTP_BODY_MAXLENGTH, HTTP_VERIFY_CERT, PARCEL_FLAG_*

http://w-hat.com/lslint/
1 2 3 4 5 6