Skip to content

Releases: mpeterv/luacheck

0.23.0

18 Sep 20:13
76bb567
Compare
Choose a tag to compare

Breaking changes:

  • Removed --no-inline CLI option and inline config option, inline options are now always enabled.
  • Inline comments are now supposed to be only in short comments but not long ones.
  • Installer script (install.lua) is removed. Luacheck can still be installed manually by recursively copying src/* to a directory in package.path and copying bin/luacheck.lua to a directory in PATH as luacheck.

New features and improvements:

  • Warning columns are now reported in Unicode codepoints if input is valid UTF-8 (#45).
  • Added indentaion-based guessing of a better location for missing end and until syntax errors.
  • Added luacheckrc set of allowed globals containing globals used in Luacheck config to set options.
  • Added default stds equivalent to predefined per-path std overrides in config:
    • files["**/spec/**/*_spec.lua"].std = "+busted";
    • files["**/test/**/*_spec.lua"].std = "+busted";
    • files["**/tests/**/*_spec.lua"].std = "+busted";
    • files["**/*.rockspec"].std = "+rockspec";
    • files["**/*.luacheckrc"].std = "+luacheckrc".
  • Added detection of numeric for loops going from #t to 1 without negative step (#160).
  • Added support for LuaRocks 3 module autodetection when checking rockspecs (#176).
  • Updated love standard for LÖVE 11.1 (#178).

Changes:

  • Default set of standard globals is now always max, allowing globals of all Lua versions. _G std is deprecated.

Fixes:

  • Added missing globals to rockspec std: hooks, deploy, build_dependencies, test_dependencies, and test.
  • Fixed line lengths appearing in the output before other warnings on the same line even if their column numbers are smaller.

Miscellaneous:

  • Luacheck now depends on argparse instead of bundling it.
  • LuaFileSystem dependency is now required.

0.22.1

01 Jul 17:06
Compare
Choose a tag to compare

Improvements:

  • Reduced amount of RAM used when checking a large number of files.

0.22.0

09 May 12:14
Compare
Choose a tag to compare

New features and improvements:

  • Added detection of cyclomatic complexity, with warnings emitted for
    functions with complexity higher than a configurable limit; disabled
    by default (#141).
  • Added a built-in formatter printing warnings and errors in a format
    understood by MSBuild/Visual Studio if luacheck is
    used as a custom build step (#142).
  • ranges and quiet options can now be used in config, e.g. quiet = 1 to
    disable OK lines in default formatter output.
  • luacheck module now adds prev_line, prev_column, and prev_end_column
    fields to syntax error events if they refer to some extra location:
    redefined label errors point to the previous definition,
    unpaired tokens such as function/end point to the the first token (#134).
  • luacheck module now adds prev_end_column field to warning events that
    already have prev_line and prev_column fields, and overwritten_end_column
    for warnings with overwritten_line and overwritten_column.
  • Improved error messages for invalid options and config: when an option is
    invalid, extra context is provided instead of just the name.
  • Custom stds are now validated on config load.
  • When recursively checking a directory, each failure to list a nested
    directory is now reported separately, and other found files and directories
    are checked anyway. Previously any error when listing any nested directory
    resulted in immediate failure for the entire parent directory (#159).
  • When --[no-]cache CLI option is used with LuaFileSystem not found,
    it is now ignored instead of causing an error. Missing LuaFileSystem is now
    mentioned in the help message next to features disabled without it.

Fixes:

  • Fixed errors or incorrect reporting when unused mutually recursive functions
    have other values assigned to their local variables.
  • Fixed unused values in infinite loops sometimes reported
    as overwritten by another value.
  • Fixed caching not working properly when cache is enabled in config
    loaded from a parent directory.
  • Fixed per-path config overrides not working on Windows when paths in config
    and input paths use different case (#150).
  • Added missing definition of love.handlers to love std (#161).

Miscellaneous:

  • Installer script (install.lua) is deprecated. Future versions of Luacheck
    may have required dependencies. Luacheck can still be installed manually
    by recursively copying src/luacheck to a directory in package.path
    and copying bin/luacheck.lua to a directory in PATH as luacheck.

0.21.2

13 Nov 20:55
Compare
Choose a tag to compare

Fixes:

  • Fixed error when an upvalue is accessed from an unreachable closure (#139).
  • Fixed unreachable code and accessing uninitialized variables not being detected inside unreachable functions.

0.21.1

10 Sep 14:42
Compare
Choose a tag to compare

Fixes:

  • Added missing definition of ngx.ERROR constant to ngx_lua std (#123).
  • Fixed unused values and initialized accesses not being reported when the access is in a closure defined in code path incompatible with the value assignment (#126).

0.21.0

03 Sep 21:31
Compare
Choose a tag to compare

New features and improvements:

  • Column range for line is too long warning now starts at the first
    character beyond the length limit instead of the very first character
    of the line (#117).
  • Error messages for invalid inline options are now a bit better, including
    reason why an inline option invocation is invalid and what is the name
    of the option at fault.
  • ngx_lua std now contains full API definition for lua-nginx-module 0.10.10,
    so that operations on unknown fields within ngx global
    are now reported (#118).

Fixes:

  • luacheck no longer aborts on internal error while checking files
    in parallel.

0.20.0

08 May 19:34
Compare
Choose a tag to compare

Breaking changes:

  • luacheck now exits with 2 instead of 1 if there are syntax errors
    or invalid inline options present. It now exits with 3 instead of
    2 if I/O errors are present. It now exits with 4 instead of 3
    on a critical error (#94).

New features and improvements:

  • If project-specific .luacheckrc is not found, luacheck will now use
    config from some global location if it is present there. Default global
    location is %LOCALAPPDATA%\Luacheck\.luacheckrc on Windows,
    ~/Library/Application Support/Luacheck/.luacheckrc on OS X/macOS, and
    $XDG_CONFIG_HOME/luacheck/.luacheckrc or ~/.config/luacheck/.luacheckrc
    on other systems. This behaviour can be tweaked with --default-config and
    --no-default-config options (#102).
  • New --[no-]max-code-line-length, --[no-]max-string-line-length,
    --[no-]max-comment-line-length CLI options and corresponding
    config and inline options that limit line length only for subsets of lines
    based on line type: string lines have their line endings within a string,
    comment lines have their line endings within a comment, other lines
    are code lines (#100).
  • New love std set containing globals added by Love2D framework (#108).
  • For warnings about unused values and fields, if the value is always
    overwritten by a single other value, location of the overwriting
    assignment is mentioned in the warning message (#106).
  • When attempting to check a directory while LuaFileSystem is not installed,
    luacheck now mentions that LuaFileSystem is required in the error
    message (#103).
  • Improved warning message for unbalanced assignment warnings (#104).

0.19.1

12 Mar 19:07
Compare
Choose a tag to compare

Miscellaneous:

  • Added warning code for line is too long warnings to documentation.
  • Added binary executable file for Windows.

0.19.0

03 Mar 17:00
Compare
Choose a tag to compare

Breaking changes:

  • New format for defining standard sets of globals that can
    describe all allowed fields of each global.

New features and improvements:

  • Luacheck can now detect mutations and accesses of specific fields
    within globals. Standard global definitions have been updated
    to provide precise lists of allowed fields. This also
    works through local aliases (e.g. local t = table; t.upsert()
    produces a warning, but local t = table; t.insert() does not).
  • Default set of allowed globals is now equal to globals normally
    provided by version of Lua used to run Luacheck, instead of
    all globals set in the interpreter while it runs Luacheck.
  • All options that operate on lists of global names can now use
    field names as well. E.g. --not-globals string.len undefines
    standard field string.len. Additionally, config options
    globals, new_globals, read_globals, new_read_globals
    can use a table-based format to define trees of allowed fields.
  • Lines that are longer than some maximum length are now reported.
    Default limit is 120. Limit can be changed using max_line_length
    option.
  • Warnings related to trailing whitespace in comments
    and inside string literals now use separate warning codes.
  • Luacheck no longer reports a crash with a long traceback when
    interrupted, instead it simply exits with an error message.

Fixes:

  • Fixes inconsistent indentation not being detected on lines
    with trailing whitespace.

0.18.0

10 Jan 12:26
Compare
Choose a tag to compare

New features and improvements:

  • Indirect mutations of read-only globals through local aliases
    are now detected (e.g. local t = table; t.foo = "bar").
  • New CLI, config, and inline option not_globals for removing
    defined standard and custom globals (#88).
  • Custom globals defined as mutable using globals option
    can now be set to read-only using read_globals option
    in overwriting settings (previously globals had priority
    over read_globals even if read_globals was the last
    option used).
  • Luacheck exit codes are now documented.

Fixes:

  • Warnings that are explictly enabled by inline options are
    now correctly reported. E.g. --luacheck: std none now
    results in warnings for any used globals (#51).