Releases: mpeterv/luacheck
Releases · mpeterv/luacheck
0.23.0
Breaking changes:
- Removed
--no-inline
CLI option andinline
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 inpackage.path
and copyingbin/luacheck.lua
to a directory inPATH
asluacheck
.
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
anduntil
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
to1
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
, andtest
. - 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
0.22.0
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 ifluacheck
is
used as a custom build step (#142). ranges
andquiet
options can now be used in config, e.g.quiet = 1
to
disableOK
lines in default formatter output.luacheck
module now addsprev_line
,prev_column
, andprev_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 asfunction
/end
point to the the first token (#134).luacheck
module now addsprev_end_column
field to warning events that
already haveprev_line
andprev_column
fields, andoverwritten_end_column
for warnings withoverwritten_line
andoverwritten_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
tolove
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 copyingsrc/luacheck
to a directory inpackage.path
and copyingbin/luacheck.lua
to a directory inPATH
asluacheck
.
0.21.2
0.21.1
0.21.0
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 withinngx
global
are now reported (#118).
Fixes:
luacheck
no longer aborts on internal error while checking files
in parallel.
0.20.0
Breaking changes:
luacheck
now exits with2
instead of1
if there are syntax errors
or invalid inline options present. It now exits with3
instead of
2
if I/O errors are present. It now exits with4
instead of3
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
0.19.0
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, butlocal 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 fieldstring.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 usingmax_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
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 usingread_globals
option
in overwriting settings (previouslyglobals
had priority
overread_globals
even ifread_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).