aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cmd/lint.tl (renamed from src/luarocks/cmd/lint.lua)22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/luarocks/cmd/lint.lua b/src/luarocks/cmd/lint.tl
index 738503ce..9f3db2d4 100644
--- a/src/luarocks/cmd/lint.lua
+++ b/src/luarocks/cmd/lint.tl
@@ -1,13 +1,19 @@
1 1
2--- Module implementing the LuaRocks "lint" command. 2--- Module implementing the LuaRocks "lint" command.
3-- Utility function that checks syntax of the rockspec. 3-- Utility function that checks syntax of the rockspec.
4local lint = {} 4local record lint
5end
5 6
6local util = require("luarocks.util") 7local util = require("luarocks.util")
7local download = require("luarocks.download") 8local download = require("luarocks.download")
8local fetch = require("luarocks.fetch") 9local fetch = require("luarocks.fetch")
9 10
10function lint.add_to_parser(parser) 11local argparse = require("luarocks.vendor.argparse")
12local type Parser = argparse.Parser
13
14local type Args = require("luarocks.core.types.args").Args
15
16function lint.add_to_parser(parser: Parser)
11 local cmd = parser:command("lint", "Check syntax of a rockspec.\n\n".. 17 local cmd = parser:command("lint", "Check syntax of a rockspec.\n\n"..
12 "Returns success if the text of the rockspec is syntactically correct, else failure.", 18 "Returns success if the text of the rockspec is syntactically correct, else failure.",
13 util.see_also()) 19 util.see_also())
@@ -16,12 +22,12 @@ function lint.add_to_parser(parser)
16 cmd:argument("rockspec", "The rockspec to check.") 22 cmd:argument("rockspec", "The rockspec to check.")
17end 23end
18 24
19function lint.command(args) 25function lint.command(args: Args): boolean, string, string
20 26
21 local filename = args.rockspec 27 local filename = args.rockspec
22 if not filename:match(".rockspec$") then 28 if not filename:match(".rockspec$") then
23 local err 29 local err: string
24 filename, err = download.download("rockspec", filename:lower()) 30 filename, err = download.download_file("rockspec", filename:lower())
25 if not filename then 31 if not filename then
26 return nil, err 32 return nil, err
27 end 33 end
@@ -44,7 +50,11 @@ function lint.command(args)
44 ok = false 50 ok = false
45 end 51 end
46 52
47 return ok, ok or filename.." failed consistency checks." 53 if ok then
54 return ok
55 end
56
57 return nil, filename.." failed consistency checks."
48end 58end
49 59
50return lint 60return lint