Merge branch 'master' of https://github.com/leafo/moonscript into compile_for_lua5.3

This commit is contained in:
nymphium 2016-01-20 02:29:14 +09:00
commit ea129603c8
2 changed files with 10 additions and 1 deletions

View File

@ -314,16 +314,22 @@ if opts.w then
io.stderr:write("\nQuitting...\n")
elseif opts.l then
local has_linted_with_error;
local lint = require "moonscript.cmd.lint"
for _, tuple in pairs(files) do
local fname = tuple[1]
local res, err = lint.lint_file(fname)
if res then
has_linted_with_error = true
io.stderr:write(res .. "\n\n")
elseif err then
has_linted_with_error = true
io.stderr:write(fname .. "\n" .. err.. "\n\n")
end
end
if has_linted_with_error then
os.exit(1)
end
else
for _, tuple in ipairs(files) do
local fname, target = util.unpack(tuple)

View File

@ -134,11 +134,14 @@ A full list of flags can be seen by passing the `-h` or `--help` flag.
`moonc` contains a [lint][1] tool for statically detecting potential problems
with code. The linter has two tests: detects accessed global variables,
detect unused declared variables.
detect unused declared variables. If the linter detects any issues with a file,
the program will exit with a status of `1`.
You can execute the linter with the `-l` flag. When the linting flag is
provided only linting takes place and no compiled code is generated.
The linter is compatible with the watch mode (see above) for automatic linting.
```bash
moonc -l file1.moon file2.moon
```