From 1cdb4d9c539b91c0d0a698e94efbca690be41ac6 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Mon, 25 Aug 2014 15:00:17 +0400 Subject: [PATCH] 0.4.1 release --- bin/luacheck.lua | 14 +++++----- doc/index.html | 9 +++---- rockspecs/luacheck-0.4.1-1.rockspec | 41 +++++++++++++++++++++++++++++ spec/check_spec.lua | 3 ++- 4 files changed, 54 insertions(+), 13 deletions(-) create mode 100644 rockspecs/luacheck-0.4.1-1.rockspec diff --git a/bin/luacheck.lua b/bin/luacheck.lua index 4f3bb505..fb6e1bce 100644 --- a/bin/luacheck.lua +++ b/bin/luacheck.lua @@ -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. " @@ -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 diff --git a/doc/index.html b/doc/index.html index a53ed881..8ca999ea 100644 --- a/doc/index.html +++ b/doc/index.html @@ -61,12 +61,11 @@

$ luacheck --help
 
-
Usage: luacheck [-g] [-r] [-u] [-a] [-v] [--globals [<global>] ...]
-       [-c] [-e] [--ignore <var> [<var>] ...]
-       [--only <var> [<var>] ...] [-l <limit>] [-q] [-h]
-       <file> [<file>] ...
+
Usage: luacheck [-g] [-r] [-u] [-a] [-v] [-c] [-e] [-l <limit>] [-q]
+       [-h] <file> [<file>] ... [--globals [<global>] ...]
+       [--ignore <var> [<var>] ...] [--only <var> [<var>] ...]
 
-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. 
diff --git a/rockspecs/luacheck-0.4.1-1.rockspec b/rockspecs/luacheck-0.4.1-1.rockspec
new file mode 100644
index 00000000..fa4c13b6
--- /dev/null
+++ b/rockspecs/luacheck-0.4.1-1.rockspec
@@ -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"}
+}
diff --git a/spec/check_spec.lua b/spec/check_spec.lua
index f5fa71c1..21ea98a8 100644
--- a/spec/check_spec.lua
+++ b/spec/check_spec.lua
@@ -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)