[ANN] luacheck 0.7.2

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] luacheck 0.7.2

Peter Melnichenko-2
Hello!

I'd like to announce a new release of luacheck[1].

luacheck is a static analyzer and a linter for Lua which detects
issues like accidental globals, unused variables and values, etc. It
is fairly configurable and can be used as a part of automated testing,
manually from the command line or inside an editor[2]. It can be
installed using luarocks.

The only new thing in luacheck 0.7.2 is a flow analysis pass replacing
old and naive AST-walking checker. This improves quality of unused
value detection in some cases, e.g. in the following snippet first
value assigned to `var` is now detected as unused:

    local var = expr1()
    if cond() then
       var = expr2()
    else
       var = expr3()
    end
    use(var)

In the next release I plan to add a few new diagnostics using data
gathered using flow analysis; I decided to make an intermediate
release as internally there were a lot of changes and I want to fix
any possible bugs before releasing 0.8.0.

Any feedback is welcome.

Happy New Year!

Peter

[1] https://github.com/mpeterv/luacheck
[2] https://github.com/mpeterv/luacheck#editor-support

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Vadi
This is pretty fanstastic. Thanks!

On Sun, Jan 4, 2015 at 4:25 AM, Peter Melnichenko <[hidden email]> wrote:
Hello!

I'd like to announce a new release of luacheck[1].

luacheck is a static analyzer and a linter for Lua which detects
issues like accidental globals, unused variables and values, etc. It
is fairly configurable and can be used as a part of automated testing,
manually from the command line or inside an editor[2]. It can be
installed using luarocks.

The only new thing in luacheck 0.7.2 is a flow analysis pass replacing
old and naive AST-walking checker. This improves quality of unused
value detection in some cases, e.g. in the following snippet first
value assigned to `var` is now detected as unused:

    local var = expr1()
    if cond() then
       var = expr2()
    else
       var = expr3()
    end
    use(var)

In the next release I plan to add a few new diagnostics using data
gathered using flow analysis; I decided to make an intermediate
release as internally there were a lot of changes and I want to fix
any possible bugs before releasing 0.8.0.

Any feedback is welcome.

Happy New Year!

Peter

[1] https://github.com/mpeterv/luacheck
[2] https://github.com/mpeterv/luacheck#editor-support


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Xpol Wan
Nice and Thanks!
On 2015年1月4日 周日 at 07:12 Vadim Peretokin <[hidden email]> wrote:
This is pretty fanstastic. Thanks!

On Sun, Jan 4, 2015 at 4:25 AM, Peter Melnichenko <[hidden email]> wrote:
Hello!

I'd like to announce a new release of luacheck[1].

luacheck is a static analyzer and a linter for Lua which detects
issues like accidental globals, unused variables and values, etc. It
is fairly configurable and can be used as a part of automated testing,
manually from the command line or inside an editor[2]. It can be
installed using luarocks.

The only new thing in luacheck 0.7.2 is a flow analysis pass replacing
old and naive AST-walking checker. This improves quality of unused
value detection in some cases, e.g. in the following snippet first
value assigned to `var` is now detected as unused:

    local var = expr1()
    if cond() then
       var = expr2()
    else
       var = expr3()
    end
    use(var)

In the next release I plan to add a few new diagnostics using data
gathered using flow analysis; I decided to make an intermediate
release as internally there were a lot of changes and I want to fix
any possible bugs before releasing 0.8.0.

Any feedback is welcome.

Happy New Year!

Peter

[1] https://github.com/mpeterv/luacheck
[2] https://github.com/mpeterv/luacheck#editor-support


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Eduardo Tongson
In reply to this post by Peter Melnichenko-2
Awesome. Knocked out a couple of bugs for me.

Thanks and Happy New Year!!

On Sun, Jan 4, 2015 at 2:25 AM, Peter Melnichenko <[hidden email]> wrote:

> Hello!
>
> I'd like to announce a new release of luacheck[1].
>
> luacheck is a static analyzer and a linter for Lua which detects
> issues like accidental globals, unused variables and values, etc. It
> is fairly configurable and can be used as a part of automated testing,
> manually from the command line or inside an editor[2]. It can be
> installed using luarocks.
>
> The only new thing in luacheck 0.7.2 is a flow analysis pass replacing
> old and naive AST-walking checker. This improves quality of unused
> value detection in some cases, e.g. in the following snippet first
> value assigned to `var` is now detected as unused:
>
>     local var = expr1()
>     if cond() then
>        var = expr2()
>     else
>        var = expr3()
>     end
>     use(var)
>
> In the next release I plan to add a few new diagnostics using data
> gathered using flow analysis; I decided to make an intermediate
> release as internally there were a lot of changes and I want to fix
> any possible bugs before releasing 0.8.0.
>
> Any feedback is welcome.
>
> Happy New Year!
>
> Peter
>
> [1] https://github.com/mpeterv/luacheck
> [2] https://github.com/mpeterv/luacheck#editor-support
>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Tim Caswell

Great work!  Now if only I can figure out how to get luacheck running on my windows box as well.  I'm addicted to luacheck linting in sublime text.

On Jan 4, 2015 6:43 PM, "Eduardo Tongson" <[hidden email]> wrote:
Awesome. Knocked out a couple of bugs for me.

Thanks and Happy New Year!!

On Sun, Jan 4, 2015 at 2:25 AM, Peter Melnichenko <[hidden email]> wrote:
> Hello!
>
> I'd like to announce a new release of luacheck[1].
>
> luacheck is a static analyzer and a linter for Lua which detects
> issues like accidental globals, unused variables and values, etc. It
> is fairly configurable and can be used as a part of automated testing,
> manually from the command line or inside an editor[2]. It can be
> installed using luarocks.
>
> The only new thing in luacheck 0.7.2 is a flow analysis pass replacing
> old and naive AST-walking checker. This improves quality of unused
> value detection in some cases, e.g. in the following snippet first
> value assigned to `var` is now detected as unused:
>
>     local var = expr1()
>     if cond() then
>        var = expr2()
>     else
>        var = expr3()
>     end
>     use(var)
>
> In the next release I plan to add a few new diagnostics using data
> gathered using flow analysis; I decided to make an intermediate
> release as internally there were a lot of changes and I want to fix
> any possible bugs before releasing 0.8.0.
>
> Any feedback is welcome.
>
> Happy New Year!
>
> Peter
>
> [1] https://github.com/mpeterv/luacheck
> [2] https://github.com/mpeterv/luacheck#editor-support
>

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Peter Melnichenko-2
On Wed, Jan 7, 2015 at 5:53 PM, Tim Caswell <[hidden email]> wrote:
> Great work!  Now if only I can figure out how to get luacheck running on my
> windows box as well.  I'm addicted to luacheck linting in sublime text.

Thanks! What kind of problems are there with luacheck on Windows?
Installing shouldn't be a problem once you have LuaRocks configured
properly (i.e. so that it can compile luafilesystem, the only C
dependency of luacheck).

Peter

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Ryan Phillips
Peter Melnichenko <[hidden email]> said:

> On Wed, Jan 7, 2015 at 5:53 PM, Tim Caswell <[hidden email]> wrote:
> > Great work!  Now if only I can figure out how to get luacheck running on my
> > windows box as well.  I'm addicted to luacheck linting in sublime text.
>
> Thanks! What kind of problems are there with luacheck on Windows?
> Installing shouldn't be a problem once you have LuaRocks configured
> properly (i.e. so that it can compile luafilesystem, the only C
> dependency of luacheck).
>
> Peter

Peter,

Do you know if this works with flycheck for emacs?

Thanks,
Ryan

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

John Logsdon
In reply to this post by Tim Caswell
Sorry to ask a dumb question but this looked just what I needed so I installed
LuaRocks and the Windows SDK 8.1A on my Dell Inspiron 7000 box.  My native
environment is Linux so registries and things like that cause me to break out
in a cold sweat!  I have to use Windoze unfortunately in this application.

But LC doesn't find the c++ compiler cl.exe and I suspect other things will
fall over as well. :(

Looking at the installed software, I see that Visual C++ 2005, 2008  and 2010
are already installed, the last with 86 and x64 versions.  I guess they came
with the box as I don't recall installing them or maybe they came with
something else.

Anyway is there a way of configuring luacheck so that it can use one of these
compilers?  I don't want to break another program.  Or the gcc compiler?

Maybe I don't need the SDK.  All I want to do is to check some code for
missing declarations and unused variables!


On Wednesday 07 January 2015 14:53:45 Tim Caswell wrote:

> Great work!  Now if only I can figure out how to get luacheck running on my
> windows box as well.  I'm addicted to luacheck linting in sublime text.
>
> On Jan 4, 2015 6:43 PM, "Eduardo Tongson" <[hidden email]> wrote:
> > Awesome. Knocked out a couple of bugs for me.
> >
> > Thanks and Happy New Year!!
> >
> > On Sun, Jan 4, 2015 at 2:25 AM, Peter Melnichenko <[hidden email]>
> >
> > wrote:
> > > Hello!
> > >
> > > I'd like to announce a new release of luacheck[1].
> > >
> > > luacheck is a static analyzer and a linter for Lua which detects
> > > issues like accidental globals, unused variables and values, etc. It
> > > is fairly configurable and can be used as a part of automated testing,
> > > manually from the command line or inside an editor[2]. It can be
> > > installed using luarocks.
> > >
> > > The only new thing in luacheck 0.7.2 is a flow analysis pass replacing
> > > old and naive AST-walking checker. This improves quality of unused
> > > value detection in some cases, e.g. in the following snippet first
> > > value assigned to `var` is now detected as unused:
> > >
> > >     local var = expr1()
> > >     if cond() then
> > >        var = expr2()
> > >     else
> > >        var = expr3()
> > >     end
> > >     use(var)
> > >
> > > In the next release I plan to add a few new diagnostics using data
> > > gathered using flow analysis; I decided to make an intermediate
> > > release as internally there were a lot of changes and I want to fix
> > > any possible bugs before releasing 0.8.0.
> > >
> > > Any feedback is welcome.
> > >
> > > Happy New Year!
> > >
> > > Peter
> > >
> > > [1] https://github.com/mpeterv/luacheck
> > > [2] https://github.com/mpeterv/luacheck#editor-support



--
Best wishes

John

John Logsdon
Quantex Research Ltd, Manchester UK
[hidden email]
+44161 445 4951/G:+447717758675

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Luiz Henrique de Figueiredo
> All I want to do is to check some code for missing declarations and unused variables!

There are no declarations in Lua.  See this for finding undefined globals:
        http://lua-users.org/lists/lua-l/2012-12/msg00397.html

See also
        http://lua-users.org/wiki/DetectingUndefinedVariables

Finding unused variables is harder. You may want to write your own checker
using lbci, my bytecode inspector library:
        http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lbci

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Peter Melnichenko-2
In reply to this post by John Logsdon
On Thu, Jan 8, 2015 at 2:30 PM, John Logsdon
<[hidden email]> wrote:

> Sorry to ask a dumb question but this looked just what I needed so I installed
> LuaRocks and the Windows SDK 8.1A on my Dell Inspiron 7000 box.  My native
> environment is Linux so registries and things like that cause me to break out
> in a cold sweat!  I have to use Windoze unfortunately in this application.
>
> But LC doesn't find the c++ compiler cl.exe and I suspect other things will
> fall over as well. :(
>
> Looking at the installed software, I see that Visual C++ 2005, 2008  and 2010
> are already installed, the last with 86 and x64 versions.  I guess they came
> with the box as I don't recall installing them or maybe they came with
> something else.
>
> Anyway is there a way of configuring luacheck so that it can use one of these
> compilers?  I don't want to break another program.  Or the gcc compiler?
>
> Maybe I don't need the SDK.  All I want to do is to check some code for
> missing declarations and unused variables!

You need to configure LuaRocks so that it can find cl.exe to compile
luafilesystem. I vaguely remember this answer helping:
http://stackoverflow.com/a/13428625/2733013. Also check that cl.exe is
in PATH. If that doesn't work, you can ask for help on the LuaRocks
mailing list[1]. Anyway, I plan to remove hard dependency on
luafilesystem in the next release.

Peter

[1] https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Tim Caswell
I finally got luacheck in windows in sublime text 3.

 - Use luarocks windows package and use the provided lua binary.
 - Set all the system paths it wants you to set.  This is a pain, but important.
 - Open a visual studio command prompt (search for "visual studio tools folder" in the start screen) to get the proper PATHs set
 - luarocks install luacheck
 - It worked mostly, but didn't install two dependencies, so I installed those also using luarocks
 - Got the sublime package to patch and support windows paths https://github.com/SublimeLinter/SublimeLinter-luacheck/issues/2

God luck.  I sometimes do lua development on windows, and I just don't feel at home without luacheck support in my editor.

On Thu, Jan 8, 2015 at 5:58 AM, Peter Melnichenko <[hidden email]> wrote:
On Thu, Jan 8, 2015 at 2:30 PM, John Logsdon
<[hidden email]> wrote:
> Sorry to ask a dumb question but this looked just what I needed so I installed
> LuaRocks and the Windows SDK 8.1A on my Dell Inspiron 7000 box.  My native
> environment is Linux so registries and things like that cause me to break out
> in a cold sweat!  I have to use Windoze unfortunately in this application.
>
> But LC doesn't find the c++ compiler cl.exe and I suspect other things will
> fall over as well. :(
>
> Looking at the installed software, I see that Visual C++ 2005, 2008  and 2010
> are already installed, the last with 86 and x64 versions.  I guess they came
> with the box as I don't recall installing them or maybe they came with
> something else.
>
> Anyway is there a way of configuring luacheck so that it can use one of these
> compilers?  I don't want to break another program.  Or the gcc compiler?
>
> Maybe I don't need the SDK.  All I want to do is to check some code for
> missing declarations and unused variables!

You need to configure LuaRocks so that it can find cl.exe to compile
luafilesystem. I vaguely remember this answer helping:
http://stackoverflow.com/a/13428625/2733013. Also check that cl.exe is
in PATH. If that doesn't work, you can ask for help on the LuaRocks
mailing list[1]. Anyway, I plan to remove hard dependency on
luafilesystem in the next release.

Peter

[1] https://lists.sourceforge.net/lists/listinfo/luarocks-developers


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] luacheck 0.7.2

Andrew Starks


On Thursday, January 8, 2015, Tim Caswell <[hidden email]> wrote:
I finally got luacheck in windows in sublime text 3.

 - Use luarocks windows package and use the provided lua binary.
 - Set all the system paths it wants you to set.  This is a pain, but important.
 - Open a visual studio command prompt (search for "visual studio tools folder" in the start screen) to get the proper PATHs set
 - luarocks install luacheck
 - It worked mostly, but didn't install two dependencies, so I installed those also using luarocks
 - Got the sublime package to patch and support windows paths https://github.com/SublimeLinter/SublimeLinter-luacheck/issues/2

God luck.  I sometimes do lua development on windows, and I just don't feel at home without luacheck support in my editor.

On Thu, Jan 8, 2015 at 5:58 AM, Peter Melnichenko <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;mpeterval@gmail.com&#39;);" target="_blank">mpeterval@...> wrote:
On Thu, Jan 8, 2015 at 2:30 PM, John Logsdon
<<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;j.logsdon@quantex-research.com&#39;);" target="_blank">j.logsdon@...> wrote:
> Sorry to ask a dumb question but this looked just what I needed so I installed
> LuaRocks and the Windows SDK 8.1A on my Dell Inspiron 7000 box.  My native
> environment is Linux so registries and things like that cause me to break out
> in a cold sweat!  I have to use Windoze unfortunately in this application.
>
> But LC doesn't find the c++ compiler cl.exe and I suspect other things will
> fall over as well. :(
>
> Looking at the installed software, I see that Visual C++ 2005, 2008  and 2010
> are already installed, the last with 86 and x64 versions.  I guess they came
> with the box as I don't recall installing them or maybe they came with
> something else.
>
> Anyway is there a way of configuring luacheck so that it can use one of these
> compilers?  I don't want to break another program.  Or the gcc compiler?
>
> Maybe I don't need the SDK.  All I want to do is to check some code for
> missing declarations and unused variables!

You need to configure LuaRocks so that it can find cl.exe to compile
luafilesystem. I vaguely remember this answer helping:
http://stackoverflow.com/a/13428625/2733013. Also check that cl.exe is
in PATH. If that doesn't work, you can ask for help on the LuaRocks
mailing list[1]. Anyway, I plan to remove hard dependency on
luafilesystem in the next release.

Peter

[1] https://lists.sourceforge.net/lists/listinfo/luarocks-developers



I went through similar hoops with Sublime Text 3 on windows. I used "he olde batch file trick":

luacheck.bat:
@echo off
lua.exe %~dp0\luacheck.lua %*

Where the magic noise in front of the file name expands to "the path of this batch file"

I submitted this as a pull request. 
-Andrew