From 0262243136fdbb365c4b685202dba42b5452c828 Mon Sep 17 00:00:00 2001 From: AlissaSquared Date: Thu, 7 Jan 2016 17:37:47 -0600 Subject: [PATCH 1/3] Exit with status 1 on linting error --- bin/moonc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/moonc b/bin/moonc index 2d70767..99c056b 100755 --- a/bin/moonc +++ b/bin/moonc @@ -313,15 +313,21 @@ if opts.w then io.stderr:write("\nQuitting...\n") elseif opts.l then + local has_linted_with_error; for _, tuple in pairs(files) do local fname = tuple[1] local res, err = check_compile_or_lint(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) From f4a2c6c46f0b185b4c188cc48b7346b663ace0c8 Mon Sep 17 00:00:00 2001 From: AlissaSquared Date: Sat, 9 Jan 2016 22:19:32 -0600 Subject: [PATCH 2/3] Added linting documentation --- docs/command_line.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/command_line.md b/docs/command_line.md index 047a0dd..18743b2 100644 --- a/docs/command_line.md +++ b/docs/command_line.md @@ -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 ``` From 7758114e00c1269ef6741d6449184c0825043212 Mon Sep 17 00:00:00 2001 From: AlissaSquared Date: Sat, 9 Jan 2016 22:21:10 -0600 Subject: [PATCH 3/3] --- docs/command_line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/command_line.md b/docs/command_line.md index 18743b2..31fe48e 100644 --- a/docs/command_line.md +++ b/docs/command_line.md @@ -140,7 +140,7 @@ 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 +The linter is compatible with the watch mode (see above) for automatic linting. ```bash moonc -l file1.moon file2.moon