Skip to content

Commit

Permalink
0.4.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeterv committed Aug 25, 2014
1 parent 1aebb20 commit 1cdb4d9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 13 deletions.
14 changes: 7 additions & 7 deletions bin/luacheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local function toset(array)
end

local parser = argparse "luacheck"
:description "luacheck 0.4.0, a simple static analyzer for Lua. "
:description "luacheck 0.4.1, a simple static analyzer for Lua. "

parser:argument "files"
:description "List of files to check. "
Expand Down Expand Up @@ -89,14 +89,14 @@ end

local options = {
globals = globals or default_globals,
env_aware = not args["ignore-env"],
env_aware = not args.ignore_env,
ignore = toset(args.ignore),
only = toset(args.only),
check_global = not args["no-global"],
check_redefined = not args["no-redefined"],
check_unused = not args["no-unused"],
check_unused_args = not args["no-unused-args"],
check_unused_values = not args["no-unused-values"]
check_global = not args.no_global,
check_redefined = not args.no_redefined,
check_unused = not args.no_unused,
check_unused_args = not args.no_unused_args,
check_unused_values = not args.no_unused_values
}

local warnings, errors = 0, 0
Expand Down
9 changes: 4 additions & 5 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ <h2>
<div class="highlight highlight-bash"><pre><span class="nv">$ </span>luacheck --help
</pre></div>

<pre><code>Usage: luacheck [-g] [-r] [-u] [-a] [-v] [--globals [&lt;global&gt;] ...]
[-c] [-e] [--ignore &lt;var&gt; [&lt;var&gt;] ...]
[--only &lt;var&gt; [&lt;var&gt;] ...] [-l &lt;limit&gt;] [-q] [-h]
&lt;file&gt; [&lt;file&gt;] ...
<pre><code>Usage: luacheck [-g] [-r] [-u] [-a] [-v] [-c] [-e] [-l &lt;limit&gt;] [-q]
[-h] &lt;file&gt; [&lt;file&gt;] ... [--globals [&lt;global&gt;] ...]
[--ignore &lt;var&gt; [&lt;var&gt;] ...] [--only &lt;var&gt; [&lt;var&gt;] ...]

luacheck 0.4.0, a simple static analyzer for Lua.
luacheck 0.4.1, a simple static analyzer for Lua.

Arguments:
files List of files to check.
Expand Down
41 changes: 41 additions & 0 deletions rockspecs/luacheck-0.4.1-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package = "luacheck"
version = "0.4.1-1"
source = {
url = "git://github.com/mpeterv/luacheck.git",
branch = "0.4.x",
tag = "0.4.1"
}
description = {
summary = "A simple static analyzer",
detailed = [[
luacheck only looks for three things: non-standard global variables, unused local variables and redefinitions of existing local variables in the same scope.
luacheck provides a command-line interface as well as a small library which can be used from another Lua program.
]],
homepage = "https://github.com/mpeterv/luacheck",
license = "MIT/X11"
}
dependencies = {
"lua >= 5.1, < 5.3",
"metalua-parser >= 0.7.3-2",
"checks >= 1.0",
"argparse >= 0.3.0",
"ansicolors >= 1.0-1"
}
build = {
type = "builtin",
modules = {
luacheck = "src/luacheck.lua",
["luacheck.scan"] = "src/luacheck/scan.lua",
["luacheck.check"] = "src/luacheck/check.lua",
["luacheck.get_report"] = "src/luacheck/get_report.lua",
["luacheck.expand_rockspec"] = "src/luacheck/expand_rockspec.lua",
["luacheck.format"] = "src/luacheck/format.lua"
},
install = {
bin = {
luacheck = "bin/luacheck.lua"
}
},
copy_directories = {"spec", "doc"}
}
3 changes: 2 additions & 1 deletion spec/check_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ local a = 5; print(a)
end)

it("handles argparse sample", function()
assert.same({total = 4, global = 0, redefined = 0, unused = 4, unused_value = 0,
assert.same({total = 5, global = 1, redefined = 0, unused = 4, unused_value = 0,
{type = "unused", subtype = "loop", name = "setter", line = 34, column = 27},
{type = "unused", subtype = "arg", name = "self", line = 117, column = 27},
{type = "unused", subtype = "arg", name = "self", line = 125, column = 27},
{type = "global", subtype = "access", name = "_TEST", line = 942, column = 7},
{type = "unused", subtype = "arg", name = "parser", line = 957, column = 41}
}, get_report(io.open("spec/samples/argparse.lua", "rb"):read("*a")))
end)
Expand Down

0 comments on commit 1cdb4d9

Please sign in to comment.