Releases: mpeterv/luacheck
Releases · mpeterv/luacheck
0.23.0
Breaking changes:
- Removed
--no-inlineCLI option andinlineconfig 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.pathand copyingbin/luacheck.luato a directory inPATHasluacheck.
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
endanduntilsyntax errors. - Added
luacheckrcset 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
#tto1without negative step (#160). - Added support for LuaRocks 3 module autodetection when checking rockspecs (#176).
- Updated
lovestandard for LÖVE 11.1 (#178).
Changes:
- Default set of standard globals is now always
max, allowing globals of all Lua versions._Gstd is deprecated.
Fixes:
- Added missing globals to
rockspecstd: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 ifluacheckis
used as a custom build step (#142). rangesandquietoptions can now be used in config, e.g.quiet = 1to
disableOKlines in default formatter output.luacheckmodule 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/endpoint to the the first token (#134).luacheckmodule now addsprev_end_columnfield to warning events that
already haveprev_lineandprev_columnfields, andoverwritten_end_column
for warnings withoverwritten_lineandoverwritten_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-]cacheCLI 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.handlerstolovestd (#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/luacheckto a directory inpackage.path
and copyingbin/luacheck.luato a directory inPATHasluacheck.
0.21.2
0.21.1
0.21.0
New features and improvements:
- Column range for
line is too longwarning 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_luastd now contains full API definition for lua-nginx-module 0.10.10,
so that operations on unknown fields withinngxglobal
are now reported (#118).
Fixes:
luacheckno longer aborts on internal error while checking files
in parallel.
0.20.0
Breaking changes:
luachecknow exits with2instead of1if there are syntax errors
or invalid inline options present. It now exits with3instead of
2if I/O errors are present. It now exits with4instead of3
on a critical error (#94).
New features and improvements:
- If project-specific
.luacheckrcis not found,luacheckwill now use
config from some global location if it is present there. Default global
location is%LOCALAPPDATA%\Luacheck\.luacheckrcon Windows,
~/Library/Application Support/Luacheck/.luacheckrcon OS X/macOS, and
$XDG_CONFIG_HOME/luacheck/.luacheckrcor~/.config/luacheck/.luacheckrc
on other systems. This behaviour can be tweaked with--default-configand
--no-default-configoptions (#102). - New
--[no-]max-code-line-length,--[no-]max-string-line-length,
--[no-]max-comment-line-lengthCLI 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
lovestd 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,
luachecknow 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.lenundefines
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_globalsfor removing
defined standard and custom globals (#88). - Custom globals defined as mutable using
globalsoption
can now be set to read-only usingread_globalsoption
in overwriting settings (previouslyglobalshad priority
overread_globalseven ifread_globalswas 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 nonenow
results in warnings for any used globals (#51).