Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package lua-luacheck for openSUSE:Factory checked in at 2026-07-28 18:15:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lua-luacheck (Old) and /work/SRC/openSUSE:Factory/.lua-luacheck.new.2004 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lua-luacheck" Tue Jul 28 18:15:15 2026 rev:6 rq:1368062 version:1.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/lua-luacheck/lua-luacheck.changes 2026-03-03 15:30:45.780628333 +0100 +++ /work/SRC/openSUSE:Factory/.lua-luacheck.new.2004/lua-luacheck.changes 2026-07-28 18:17:01.428672156 +0200 @@ -1,0 +2,17 @@ +Wed Jul 22 09:58:40 UTC 2026 - Michal Suchanek <[email protected]> + +- Lua 5.5 support + + feat-Add-standard-support-for-Lua-5.5-132-133.patch +- Update to 1.2.0 + - Add builtin standards support for minetest + - Memoize results to addresses speed refression from new feature in v0.26 +- Update to 1.1.2 + - Support NO_COLOR environment variable + - Update SILE builtin with more allowed variables +- Update to 1.1.1 + - Update Löve standard to 11.4 + - Documentation improvements + - Correct compound operators to not crash on modifying upvalues + - Fix warning 582 (error prone negation) not applying to subexpressions + +------------------------------------------------------------------- Old: ---- luacheck-1.1.0.tar.gz New: ---- feat-Add-standard-support-for-Lua-5.5-132-133.patch luacheck-1.2.0.tar.gz ----------(New B)---------- New:- Lua 5.5 support + feat-Add-standard-support-for-Lua-5.5-132-133.patch - Update to 1.2.0 ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lua-luacheck.spec ++++++ --- /var/tmp/diff_new_pack.ypbyaP/_old 2026-07-28 18:17:03.340738998 +0200 +++ /var/tmp/diff_new_pack.ypbyaP/_new 2026-07-28 18:17:03.344739138 +0200 @@ -26,7 +26,7 @@ %else %define lua_value %(echo "%{flavor}" |sed -e 's:lua::') %endif -Version: 1.1.0 +Version: 1.2.0 Release: 0 Summary: Command-line tool for linting and static analysis of Lua code License: MIT @@ -38,6 +38,8 @@ # PATCH-FIX-UPSTREAM luacheck-lua55.patch gh#mpeterv/luacheck!238 [email protected] # Fix incompatibility with Lua 5.5 (changing of for cycle counters) Patch1: luacheck-lua55.patch +# PATCH-FIX-UPSTREAM - Initial lua 5.5 support https://github.com/lunarmodules/luacheck/pull/133 +Patch2: feat-Add-standard-support-for-Lua-5.5-132-133.patch BuildRequires: %{flavor} BuildRequires: %{flavor}-argparse BuildRequires: %{flavor}-luafilesystem ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.ypbyaP/_old 2026-07-28 18:17:03.412741514 +0200 +++ /var/tmp/diff_new_pack.ypbyaP/_new 2026-07-28 18:17:03.416741655 +0200 @@ -1,6 +1,6 @@ -mtime: 1772180304 -commit: bb6f574a55712a44d1426d9949e71ab3555f6abdee24e779ffdb5e5234c210b9 -url: https://src.opensuse.org/lua/lua-luacheck.git -revision: bb6f574a55712a44d1426d9949e71ab3555f6abdee24e779ffdb5e5234c210b9 +mtime: 1784715341 +commit: ca8674e1bcc2ca041c4cb4610fd8ec4c1bbc938135939f5ae89cc01ba4f4d33b +url: https://src.opensuse.org/lua/lua-luacheck +revision: ca8674e1bcc2ca041c4cb4610fd8ec4c1bbc938135939f5ae89cc01ba4f4d33b projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-07-22 12:15:41.000000000 +0200 @@ -0,0 +1,6 @@ +.osc +*.obscpio +*.osc +_build.* +.pbuild +lua*-luacheck-*-build/ ++++++ feat-Add-standard-support-for-Lua-5.5-132-133.patch ++++++ >From 6fc4af915c70a9326278d3df15875d28331b215d Mon Sep 17 00:00:00 2001 From: Alex Richard <[email protected]> Date: Fri, 1 Aug 2025 18:34:23 -0400 Subject: [PATCH] feat: Add standard support for Lua 5.5 (#132) (#133) ...in particular adding support for `table.create`. --- src/luacheck/builtin_standards/init.lua | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/luacheck/builtin_standards/init.lua b/src/luacheck/builtin_standards/init.lua index 966d433..063aabe 100644 --- a/src/luacheck/builtin_standards/init.lua +++ b/src/luacheck/builtin_standards/init.lua @@ -31,6 +31,7 @@ string_defs.lua51 = add_defs(string_defs.min, standards.def_fields("gfind")) string_defs.lua52 = string_defs.min string_defs.lua53 = add_defs(string_defs.min, standards.def_fields("pack", "packsize", "unpack")) string_defs.lua54 = string_defs.lua53 +string_defs.lua55 = string_defs.lua54 string_defs.luajit = string_defs.lua51 local file_defs = {} @@ -54,6 +55,7 @@ file_defs.lua51 = file_defs.min file_defs.lua52 = file_defs.min file_defs.lua53 = add_defs(file_defs.min, {fields = {__name = string_defs.lua53}}) file_defs.lua54 = add_defs(file_defs.min, {fields = {__name = string_defs.lua54}}) +file_defs.lua55 = file_defs.lua54 file_defs.luajit = file_defs.min local function make_min_def(method_defs) @@ -237,6 +239,16 @@ lua_defs.lua54c = add_defs(lua_defs.lua54, { math = standards.def_fields("atan2", "cosh", "frexp", "ldexp", "log10", "pow", "sinh", "tanh") } }) +lua_defs.lua55 = add_defs(lua_defs.lua54, { + fields = { + table = standards.def_fields("create") + } +}) +lua_defs.lua55c = add_defs(lua_defs.lua55, { + fields = { + math = standards.def_fields("atan2", "cosh", "frexp", "ldexp", "log10", "pow", "sinh", "tanh") + } +}) lua_defs.luajit = add_defs(make_min_def("luajit"), { fields = { bit = standards.def_fields("arshift", "band", "bnot", "bor", "bswap", "bxor", "lshift", "rol", "ror", @@ -263,7 +275,14 @@ lua_defs.luajit = add_defs(make_min_def("luajit"), { } }) lua_defs.ngx_lua = add_defs(lua_defs.luajit, ngx) -lua_defs.max = add_defs(lua_defs.lua51c, lua_defs.lua52c, lua_defs.lua53c, lua_defs.lua54c, lua_defs.luajit) +lua_defs.max = add_defs( + lua_defs.lua51c, + lua_defs.lua52c, + lua_defs.lua53c, + lua_defs.lua54c, + lua_defs.lua55c, + lua_defs.luajit +) for name, def in pairs(lua_defs) do builtin_standards[name] = def_to_std(def) @@ -280,6 +299,8 @@ local function get_running_lua_std_name() return "lua53c" elseif _VERSION == "Lua 5.4" then return "lua54c" + elseif _VERSION == "Lua 5.5" then + return "lua55c" else return "max" end -- 2.51.0 ++++++ luacheck-1.1.0.tar.gz -> luacheck-1.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/CHANGELOG.md new/luacheck-1.2.0/CHANGELOG.md --- old/luacheck-1.1.0/CHANGELOG.md 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/CHANGELOG.md 2024-05-24 10:32:29.000000000 +0200 @@ -2,6 +2,38 @@ All notable changes to this project will be documented in this file. +## [1.2.0] - 2024-05-24 + +### Features + +- Add builtin standards support for minetest (#108) — @BuckarooBanzay and @appgurueu + +### Performance + +- Memoize results to addresses speed refression from new feature in v0.26 (#105) — @tomlau10 + +## [1.1.2] - 2023-12-08 + +### Features + +- Support NO_COLOR environment variable (#102) — @ligurio + +### Bug Fixes + +- Update SILE builtin with more allowed variables — @alerque + +## [1.1.1] - 2023-06-09 + +### Features + +- Update Löve standard to 11.4 (#95) — @RunningDroid +- Documentation improvements (#92 and #89) — @rcloran and @hramrach + +### Bug Fixes + +- Correct compound operators to not crash on modifying upvalues (#96) — @arichard4 +- Fix warning 582 (error prone negation) not applying to subexpressions (#94) — @appgurueu + ## [1.1.0] - 2022-12-19 ### Features diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/README.md new/luacheck-1.2.0/README.md --- old/luacheck-1.1.0/README.md 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/README.md 2024-05-24 10:32:29.000000000 +0200 @@ -40,7 +40,7 @@ ### Windows binary download For Windows there is single-file 64-bit binary distribution, bundling Lua 5.4.4, Luacheck, LuaFileSystem, and LuaLanes using [LuaStatic](https://github.com/ers35/luastatic): -[download](https://github.com/lunarmodules/luacheck/releases/download/v1.1.0/luacheck.exe). +[download](https://github.com/lunarmodules/luacheck/releases/download/v1.2.0/luacheck.exe). ## Basic usage @@ -109,7 +109,7 @@ ## Development -Luacheck is currently in development. The latest released version is v1.1.0. The interface of the `luacheck` module may change between minor releases. The command line interface is fairly stable. +Luacheck is currently in development. The latest released version is v1.2.0. The interface of the `luacheck` module may change between minor releases. The command line interface is fairly stable. Use the Luacheck issue tracker on GitHub to submit bugs, suggestions and questions. Any pull requests are welcome, too. @@ -172,14 +172,14 @@ - name: Checkout uses: actions/checkout@v3 - name: Luacheck linter - uses: lunarmodules/luacheck@v0 + uses: lunarmodules/luacheck@v1 ``` By default the GH Action is configured to run `luacheck .`, but you can also pass it your own `args` to replace the default input of `.`. ```yaml - name: Luacheck linter - uses: lunarmodules/luacheck@v0 + uses: lunarmodules/luacheck@v1 with: args: myfile.lua ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/action.yml new/luacheck-1.2.0/action.yml --- old/luacheck-1.1.0/action.yml 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/action.yml 2024-05-24 10:32:29.000000000 +0200 @@ -7,7 +7,7 @@ default: "." runs: using: docker - image: docker://ghcr.io/lunarmodules/luacheck:v1.1.0 + image: docker://ghcr.io/lunarmodules/luacheck:v1.2.0 entrypoint: sh args: - -c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/docsrc/conf.py new/luacheck-1.2.0/docsrc/conf.py --- old/luacheck-1.1.0/docsrc/conf.py 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/docsrc/conf.py 2024-05-24 10:32:29.000000000 +0200 @@ -48,9 +48,9 @@ # built documents. # # The short X.Y version. -version = '1.1.0' +version = '1.2.0' # The full version, including alpha/beta/rc tags. -release = '1.1.0' +release = '1.2.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/docsrc/config.rst new/luacheck-1.2.0/docsrc/config.rst --- old/luacheck-1.1.0/docsrc/config.rst 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/docsrc/config.rst 2024-05-24 10:32:29.000000000 +0200 @@ -194,4 +194,6 @@ files["**/*.luacheckrc"].std = "+luacheckrc" files["**/config.ld"].std = "+ldoc" +These are added to the global ``std`` specified in the config file. Each of these can be overriden by setting a different ``std`` value for the corresponding key in ``files``. +Setting ``std`` on the commandline removes these default overrides. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/luacheck-dev-1.rockspec new/luacheck-1.2.0/luacheck-dev-1.rockspec --- old/luacheck-1.1.0/luacheck-dev-1.rockspec 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/luacheck-dev-1.rockspec 2024-05-24 10:32:29.000000000 +0200 @@ -45,6 +45,7 @@ luacheck = "src/luacheck/init.lua", ["luacheck.builtin_standards"] = "src/luacheck/builtin_standards/init.lua", ["luacheck.builtin_standards.love"] = "src/luacheck/builtin_standards/love.lua", + ["luacheck.builtin_standards.minetest"] = "src/luacheck/builtin_standards/minetest.lua", ["luacheck.builtin_standards.playdate"] = "src/luacheck/builtin_standards/playdate.lua", ["luacheck.builtin_standards.ngx"] = "src/luacheck/builtin_standards/ngx.lua", ["luacheck.cache"] = "src/luacheck/cache.lua", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/rockspecs/luacheck-1.1.1-1.rockspec new/luacheck-1.2.0/rockspecs/luacheck-1.1.1-1.rockspec --- old/luacheck-1.1.0/rockspecs/luacheck-1.1.1-1.rockspec 1970-01-01 01:00:00.000000000 +0100 +++ new/luacheck-1.2.0/rockspecs/luacheck-1.1.1-1.rockspec 2024-05-24 10:32:29.000000000 +0200 @@ -0,0 +1,95 @@ +local package_name = "luacheck" +local package_version = "1.1.1" +local rockspec_revision = "1" +local github_account_name = "lunarmodules" +local github_repo_name = package_name + +package = package_name +version = package_version .. "-" .. rockspec_revision + +source = { + url = "git+https://github.com/" .. github_account_name .. "/" .. github_repo_name .. ".git" +} + +if package_version == "dev" then source.branch = "master" else source.tag = "v" .. package_version end + +description = { + summary = "A static analyzer and a linter for Lua", + detailed = [[ + Luacheck is a command-line tool for linting and static analysis of Lua + code. It is able to spot usage of undefined global variables, unused + local variables and a few other typical problems within Lua programs. + ]], + homepage = "https://github.com/lunarmodules/luacheck", + license = "MIT" +} + +dependencies = { + "lua >= 5.1", + "argparse >= 0.6.0", + "luafilesystem >= 1.6.3" +} +build = { + type = "builtin", + modules = { + luacheck = "src/luacheck/init.lua", + ["luacheck.builtin_standards"] = "src/luacheck/builtin_standards/init.lua", + ["luacheck.builtin_standards.love"] = "src/luacheck/builtin_standards/love.lua", + ["luacheck.builtin_standards.playdate"] = "src/luacheck/builtin_standards/playdate.lua", + ["luacheck.builtin_standards.ngx"] = "src/luacheck/builtin_standards/ngx.lua", + ["luacheck.cache"] = "src/luacheck/cache.lua", + ["luacheck.check"] = "src/luacheck/check.lua", + ["luacheck.check_state"] = "src/luacheck/check_state.lua", + ["luacheck.config"] = "src/luacheck/config.lua", + ["luacheck.core_utils"] = "src/luacheck/core_utils.lua", + ["luacheck.decoder"] = "src/luacheck/decoder.lua", + ["luacheck.expand_rockspec"] = "src/luacheck/expand_rockspec.lua", + ["luacheck.filter"] = "src/luacheck/filter.lua", + ["luacheck.format"] = "src/luacheck/format.lua", + ["luacheck.fs"] = "src/luacheck/fs.lua", + ["luacheck.globbing"] = "src/luacheck/globbing.lua", + ["luacheck.lexer"] = "src/luacheck/lexer.lua", + ["luacheck.main"] = "src/luacheck/main.lua", + ["luacheck.multithreading"] = "src/luacheck/multithreading.lua", + ["luacheck.options"] = "src/luacheck/options.lua", + ["luacheck.parser"] = "src/luacheck/parser.lua", + ["luacheck.profiler"] = "src/luacheck/profiler.lua", + ["luacheck.runner"] = "src/luacheck/runner.lua", + ["luacheck.serializer"] = "src/luacheck/serializer.lua", + ["luacheck.stages"] = "src/luacheck/stages/init.lua", + ["luacheck.stages.detect_bad_whitespace"] = "src/luacheck/stages/detect_bad_whitespace.lua", + ["luacheck.stages.detect_compound_operators"] = "src/luacheck/stages/detect_compound_operators.lua", + ["luacheck.stages.detect_cyclomatic_complexity"] = "src/luacheck/stages/detect_cyclomatic_complexity.lua", + ["luacheck.stages.detect_empty_blocks"] = "src/luacheck/stages/detect_empty_blocks.lua", + ["luacheck.stages.detect_empty_statements"] = "src/luacheck/stages/detect_empty_statements.lua", + ["luacheck.stages.detect_globals"] = "src/luacheck/stages/detect_globals.lua", + ["luacheck.stages.detect_reversed_fornum_loops"] = "src/luacheck/stages/detect_reversed_fornum_loops.lua", + ["luacheck.stages.detect_unbalanced_assignments"] = "src/luacheck/stages/detect_unbalanced_assignments.lua", + ["luacheck.stages.detect_uninit_accesses"] = "src/luacheck/stages/detect_uninit_accesses.lua", + ["luacheck.stages.detect_unreachable_code"] = "src/luacheck/stages/detect_unreachable_code.lua", + ["luacheck.stages.detect_unused_fields"] = "src/luacheck/stages/detect_unused_fields.lua", + ["luacheck.stages.detect_unused_locals"] = "src/luacheck/stages/detect_unused_locals.lua", + ["luacheck.stages.linearize"] = "src/luacheck/stages/linearize.lua", + ["luacheck.stages.name_functions"] = "src/luacheck/stages/name_functions.lua", + ["luacheck.stages.parse"] = "src/luacheck/stages/parse.lua", + ["luacheck.stages.parse_inline_options"] = "src/luacheck/stages/parse_inline_options.lua", + ["luacheck.stages.resolve_locals"] = "src/luacheck/stages/resolve_locals.lua", + ["luacheck.stages.unwrap_parens"] = "src/luacheck/stages/unwrap_parens.lua", + ["luacheck.standards"] = "src/luacheck/standards.lua", + ["luacheck.unicode"] = "src/luacheck/unicode.lua", + ["luacheck.unicode_printability_boundaries"] = "src/luacheck/unicode_printability_boundaries.lua", + ["luacheck.utils"] = "src/luacheck/utils.lua", + ["luacheck.vendor.sha1"] = "src/luacheck/vendor/sha1/init.lua", + ["luacheck.vendor.sha1.bit32_ops"] = "src/luacheck/vendor/sha1/bit32_ops.lua", + ["luacheck.vendor.sha1.bit_ops"] = "src/luacheck/vendor/sha1/bit_ops.lua", + ["luacheck.vendor.sha1.common"] = "src/luacheck/vendor/sha1/common.lua", + ["luacheck.vendor.sha1.lua53_ops"] = "src/luacheck/vendor/sha1/lua53_ops.lua", + ["luacheck.vendor.sha1.pure_lua_ops"] = "src/luacheck/vendor/sha1/pure_lua_ops.lua", + ["luacheck.version"] = "src/luacheck/version.lua" + }, + install = { + bin = { + luacheck = "bin/luacheck.lua" + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/rockspecs/luacheck-1.1.2-1.rockspec new/luacheck-1.2.0/rockspecs/luacheck-1.1.2-1.rockspec --- old/luacheck-1.1.0/rockspecs/luacheck-1.1.2-1.rockspec 1970-01-01 01:00:00.000000000 +0100 +++ new/luacheck-1.2.0/rockspecs/luacheck-1.1.2-1.rockspec 2024-05-24 10:32:29.000000000 +0200 @@ -0,0 +1,95 @@ +local package_name = "luacheck" +local package_version = "1.1.2" +local rockspec_revision = "1" +local github_account_name = "lunarmodules" +local github_repo_name = package_name + +package = package_name +version = package_version .. "-" .. rockspec_revision + +source = { + url = "git+https://github.com/" .. github_account_name .. "/" .. github_repo_name .. ".git" +} + +if package_version == "dev" then source.branch = "master" else source.tag = "v" .. package_version end + +description = { + summary = "A static analyzer and a linter for Lua", + detailed = [[ + Luacheck is a command-line tool for linting and static analysis of Lua + code. It is able to spot usage of undefined global variables, unused + local variables and a few other typical problems within Lua programs. + ]], + homepage = "https://github.com/lunarmodules/luacheck", + license = "MIT" +} + +dependencies = { + "lua >= 5.1", + "argparse >= 0.6.0", + "luafilesystem >= 1.6.3" +} +build = { + type = "builtin", + modules = { + luacheck = "src/luacheck/init.lua", + ["luacheck.builtin_standards"] = "src/luacheck/builtin_standards/init.lua", + ["luacheck.builtin_standards.love"] = "src/luacheck/builtin_standards/love.lua", + ["luacheck.builtin_standards.playdate"] = "src/luacheck/builtin_standards/playdate.lua", + ["luacheck.builtin_standards.ngx"] = "src/luacheck/builtin_standards/ngx.lua", + ["luacheck.cache"] = "src/luacheck/cache.lua", + ["luacheck.check"] = "src/luacheck/check.lua", + ["luacheck.check_state"] = "src/luacheck/check_state.lua", + ["luacheck.config"] = "src/luacheck/config.lua", + ["luacheck.core_utils"] = "src/luacheck/core_utils.lua", + ["luacheck.decoder"] = "src/luacheck/decoder.lua", + ["luacheck.expand_rockspec"] = "src/luacheck/expand_rockspec.lua", + ["luacheck.filter"] = "src/luacheck/filter.lua", + ["luacheck.format"] = "src/luacheck/format.lua", + ["luacheck.fs"] = "src/luacheck/fs.lua", + ["luacheck.globbing"] = "src/luacheck/globbing.lua", + ["luacheck.lexer"] = "src/luacheck/lexer.lua", + ["luacheck.main"] = "src/luacheck/main.lua", + ["luacheck.multithreading"] = "src/luacheck/multithreading.lua", + ["luacheck.options"] = "src/luacheck/options.lua", + ["luacheck.parser"] = "src/luacheck/parser.lua", + ["luacheck.profiler"] = "src/luacheck/profiler.lua", + ["luacheck.runner"] = "src/luacheck/runner.lua", + ["luacheck.serializer"] = "src/luacheck/serializer.lua", + ["luacheck.stages"] = "src/luacheck/stages/init.lua", + ["luacheck.stages.detect_bad_whitespace"] = "src/luacheck/stages/detect_bad_whitespace.lua", + ["luacheck.stages.detect_compound_operators"] = "src/luacheck/stages/detect_compound_operators.lua", + ["luacheck.stages.detect_cyclomatic_complexity"] = "src/luacheck/stages/detect_cyclomatic_complexity.lua", + ["luacheck.stages.detect_empty_blocks"] = "src/luacheck/stages/detect_empty_blocks.lua", + ["luacheck.stages.detect_empty_statements"] = "src/luacheck/stages/detect_empty_statements.lua", + ["luacheck.stages.detect_globals"] = "src/luacheck/stages/detect_globals.lua", + ["luacheck.stages.detect_reversed_fornum_loops"] = "src/luacheck/stages/detect_reversed_fornum_loops.lua", + ["luacheck.stages.detect_unbalanced_assignments"] = "src/luacheck/stages/detect_unbalanced_assignments.lua", + ["luacheck.stages.detect_uninit_accesses"] = "src/luacheck/stages/detect_uninit_accesses.lua", + ["luacheck.stages.detect_unreachable_code"] = "src/luacheck/stages/detect_unreachable_code.lua", + ["luacheck.stages.detect_unused_fields"] = "src/luacheck/stages/detect_unused_fields.lua", + ["luacheck.stages.detect_unused_locals"] = "src/luacheck/stages/detect_unused_locals.lua", + ["luacheck.stages.linearize"] = "src/luacheck/stages/linearize.lua", + ["luacheck.stages.name_functions"] = "src/luacheck/stages/name_functions.lua", + ["luacheck.stages.parse"] = "src/luacheck/stages/parse.lua", + ["luacheck.stages.parse_inline_options"] = "src/luacheck/stages/parse_inline_options.lua", + ["luacheck.stages.resolve_locals"] = "src/luacheck/stages/resolve_locals.lua", + ["luacheck.stages.unwrap_parens"] = "src/luacheck/stages/unwrap_parens.lua", + ["luacheck.standards"] = "src/luacheck/standards.lua", + ["luacheck.unicode"] = "src/luacheck/unicode.lua", + ["luacheck.unicode_printability_boundaries"] = "src/luacheck/unicode_printability_boundaries.lua", + ["luacheck.utils"] = "src/luacheck/utils.lua", + ["luacheck.vendor.sha1"] = "src/luacheck/vendor/sha1/init.lua", + ["luacheck.vendor.sha1.bit32_ops"] = "src/luacheck/vendor/sha1/bit32_ops.lua", + ["luacheck.vendor.sha1.bit_ops"] = "src/luacheck/vendor/sha1/bit_ops.lua", + ["luacheck.vendor.sha1.common"] = "src/luacheck/vendor/sha1/common.lua", + ["luacheck.vendor.sha1.lua53_ops"] = "src/luacheck/vendor/sha1/lua53_ops.lua", + ["luacheck.vendor.sha1.pure_lua_ops"] = "src/luacheck/vendor/sha1/pure_lua_ops.lua", + ["luacheck.version"] = "src/luacheck/version.lua" + }, + install = { + bin = { + luacheck = "bin/luacheck.lua" + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/rockspecs/luacheck-1.2.0-1.rockspec new/luacheck-1.2.0/rockspecs/luacheck-1.2.0-1.rockspec --- old/luacheck-1.1.0/rockspecs/luacheck-1.2.0-1.rockspec 1970-01-01 01:00:00.000000000 +0100 +++ new/luacheck-1.2.0/rockspecs/luacheck-1.2.0-1.rockspec 2024-05-24 10:32:29.000000000 +0200 @@ -0,0 +1,96 @@ +local package_name = "luacheck" +local package_version = "1.2.0" +local rockspec_revision = "1" +local github_account_name = "lunarmodules" +local github_repo_name = package_name + +package = package_name +version = package_version .. "-" .. rockspec_revision + +source = { + url = "git+https://github.com/" .. github_account_name .. "/" .. github_repo_name .. ".git" +} + +if package_version == "dev" then source.branch = "master" else source.tag = "v" .. package_version end + +description = { + summary = "A static analyzer and a linter for Lua", + detailed = [[ + Luacheck is a command-line tool for linting and static analysis of Lua + code. It is able to spot usage of undefined global variables, unused + local variables and a few other typical problems within Lua programs. + ]], + homepage = "https://github.com/lunarmodules/luacheck", + license = "MIT" +} + +dependencies = { + "lua >= 5.1", + "argparse >= 0.6.0", + "luafilesystem >= 1.6.3" +} +build = { + type = "builtin", + modules = { + luacheck = "src/luacheck/init.lua", + ["luacheck.builtin_standards"] = "src/luacheck/builtin_standards/init.lua", + ["luacheck.builtin_standards.love"] = "src/luacheck/builtin_standards/love.lua", + ["luacheck.builtin_standards.minetest"] = "src/luacheck/builtin_standards/minetest.lua", + ["luacheck.builtin_standards.playdate"] = "src/luacheck/builtin_standards/playdate.lua", + ["luacheck.builtin_standards.ngx"] = "src/luacheck/builtin_standards/ngx.lua", + ["luacheck.cache"] = "src/luacheck/cache.lua", + ["luacheck.check"] = "src/luacheck/check.lua", + ["luacheck.check_state"] = "src/luacheck/check_state.lua", + ["luacheck.config"] = "src/luacheck/config.lua", + ["luacheck.core_utils"] = "src/luacheck/core_utils.lua", + ["luacheck.decoder"] = "src/luacheck/decoder.lua", + ["luacheck.expand_rockspec"] = "src/luacheck/expand_rockspec.lua", + ["luacheck.filter"] = "src/luacheck/filter.lua", + ["luacheck.format"] = "src/luacheck/format.lua", + ["luacheck.fs"] = "src/luacheck/fs.lua", + ["luacheck.globbing"] = "src/luacheck/globbing.lua", + ["luacheck.lexer"] = "src/luacheck/lexer.lua", + ["luacheck.main"] = "src/luacheck/main.lua", + ["luacheck.multithreading"] = "src/luacheck/multithreading.lua", + ["luacheck.options"] = "src/luacheck/options.lua", + ["luacheck.parser"] = "src/luacheck/parser.lua", + ["luacheck.profiler"] = "src/luacheck/profiler.lua", + ["luacheck.runner"] = "src/luacheck/runner.lua", + ["luacheck.serializer"] = "src/luacheck/serializer.lua", + ["luacheck.stages"] = "src/luacheck/stages/init.lua", + ["luacheck.stages.detect_bad_whitespace"] = "src/luacheck/stages/detect_bad_whitespace.lua", + ["luacheck.stages.detect_compound_operators"] = "src/luacheck/stages/detect_compound_operators.lua", + ["luacheck.stages.detect_cyclomatic_complexity"] = "src/luacheck/stages/detect_cyclomatic_complexity.lua", + ["luacheck.stages.detect_empty_blocks"] = "src/luacheck/stages/detect_empty_blocks.lua", + ["luacheck.stages.detect_empty_statements"] = "src/luacheck/stages/detect_empty_statements.lua", + ["luacheck.stages.detect_globals"] = "src/luacheck/stages/detect_globals.lua", + ["luacheck.stages.detect_reversed_fornum_loops"] = "src/luacheck/stages/detect_reversed_fornum_loops.lua", + ["luacheck.stages.detect_unbalanced_assignments"] = "src/luacheck/stages/detect_unbalanced_assignments.lua", + ["luacheck.stages.detect_uninit_accesses"] = "src/luacheck/stages/detect_uninit_accesses.lua", + ["luacheck.stages.detect_unreachable_code"] = "src/luacheck/stages/detect_unreachable_code.lua", + ["luacheck.stages.detect_unused_fields"] = "src/luacheck/stages/detect_unused_fields.lua", + ["luacheck.stages.detect_unused_locals"] = "src/luacheck/stages/detect_unused_locals.lua", + ["luacheck.stages.linearize"] = "src/luacheck/stages/linearize.lua", + ["luacheck.stages.name_functions"] = "src/luacheck/stages/name_functions.lua", + ["luacheck.stages.parse"] = "src/luacheck/stages/parse.lua", + ["luacheck.stages.parse_inline_options"] = "src/luacheck/stages/parse_inline_options.lua", + ["luacheck.stages.resolve_locals"] = "src/luacheck/stages/resolve_locals.lua", + ["luacheck.stages.unwrap_parens"] = "src/luacheck/stages/unwrap_parens.lua", + ["luacheck.standards"] = "src/luacheck/standards.lua", + ["luacheck.unicode"] = "src/luacheck/unicode.lua", + ["luacheck.unicode_printability_boundaries"] = "src/luacheck/unicode_printability_boundaries.lua", + ["luacheck.utils"] = "src/luacheck/utils.lua", + ["luacheck.vendor.sha1"] = "src/luacheck/vendor/sha1/init.lua", + ["luacheck.vendor.sha1.bit32_ops"] = "src/luacheck/vendor/sha1/bit32_ops.lua", + ["luacheck.vendor.sha1.bit_ops"] = "src/luacheck/vendor/sha1/bit_ops.lua", + ["luacheck.vendor.sha1.common"] = "src/luacheck/vendor/sha1/common.lua", + ["luacheck.vendor.sha1.lua53_ops"] = "src/luacheck/vendor/sha1/lua53_ops.lua", + ["luacheck.vendor.sha1.pure_lua_ops"] = "src/luacheck/vendor/sha1/pure_lua_ops.lua", + ["luacheck.version"] = "src/luacheck/version.lua" + }, + install = { + bin = { + luacheck = "bin/luacheck.lua" + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/spec/check_spec.lua new/luacheck-1.2.0/spec/check_spec.lua --- old/luacheck-1.1.0/spec/check_spec.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/spec/check_spec.lua 2024-05-24 10:32:29.000000000 +0200 @@ -331,12 +331,34 @@ ]]) end) - it("warns about error-prone negations", function() - assert.same({ - {code = "582", line = 1, column = 13, end_column = 21} - }, check[[ - if not 5 > 5 then return end + describe("error-prone negations", function() + it("as sole conditions", function() + assert.same({ + {code = "582", line = 1, column = 16, end_column = 24} + }, check[[ + if not 5 > 5 then return end ]]) + end) + + it("as subexpressions", function() + assert.same({ + {code = "582", line = 1, column = 25, end_column = 34} + }, check[[ + if not 5 or not 5 == 5 then return end +]]) + end) + + it("doesn't warn if properly parenthesized", function() + assert.same({}, check[[ + if (not 5) == 5 then return end +]]) + end) + + it("doesn't warn for a literal 'not'", function() + assert.same({}, check[[ + if 5 == "not" then return end +]]) + end) end) it("doesn't warn on similarly named variables", function() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/spec/cli_spec.lua new/luacheck-1.2.0/spec/cli_spec.lua --- old/luacheck-1.1.0/spec/cli_spec.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/spec/cli_spec.lua 2024-05-24 10:32:29.000000000 +0200 @@ -300,8 +300,8 @@ spec/samples/compound_operators.lua:2:1: assignment uses compound operator += spec/samples/compound_operators.lua:3:1: assignment uses compound operator -= - spec/samples/compound_operators.lua:4:1: assignment uses compound operator *= - spec/samples/compound_operators.lua:5:1: assignment uses compound operator /= + spec/samples/compound_operators.lua:5:2: assignment uses compound operator /= + spec/samples/compound_operators.lua:10:1: assignment uses compound operator *= Total: 0 warnings / 4 errors in 1 file ]], get_output "spec/samples/compound_operators.lua --no-config") @@ -311,8 +311,8 @@ assert.equal([[Checking spec/samples/compound_operators.lua 3 errors spec/samples/compound_operators.lua:3:1: assignment uses compound operator -= - spec/samples/compound_operators.lua:4:1: assignment uses compound operator *= - spec/samples/compound_operators.lua:5:1: assignment uses compound operator /= + spec/samples/compound_operators.lua:5:2: assignment uses compound operator /= + spec/samples/compound_operators.lua:10:1: assignment uses compound operator *= Total: 0 warnings / 3 errors in 1 file ]], get_output "spec/samples/compound_operators.lua --no-config --operators +=") @@ -1023,7 +1023,7 @@ end) it("expands folders", function() - assert.matches("^Total: %d+ warnings / %d+ errors in 27 files\n$", get_output "spec/samples -qqq --no-config --exclude-files spec/samples/global_fields.lua") + assert.matches("^Total: %d+ warnings / %d+ errors in 28 files\n$", get_output "spec/samples -qqq --no-config --exclude-files spec/samples/global_fields.lua") end) it("uses --include-files when expanding folders", function() @@ -1242,6 +1242,7 @@ Checking spec/samples/indirect_globals.lua 3 warnings Checking spec/samples/inline_options.lua 7 warnings / 2 errors Checking spec/samples/line_length.lua 8 warnings +Checking spec/samples/minetest.lua 2 warnings Checking spec/samples/python_code.lua 1 error Checking spec/samples/read_globals.lua 5 warnings Checking spec/samples/read_globals_inline_options.lua 3 warnings @@ -1252,7 +1253,7 @@ Checking spec/samples/utf8.lua 4 warnings Checking spec/samples/utf8_error.lua 1 error -Total: 73 warnings / 9 errors in 20 files +Total: 75 warnings / 9 errors in 21 files ]]):gsub("(spec/samples)/", "%1"..package.config:sub(1, 1)), get_output "spec/samples --config=spec/configs/exclude_files_config.luacheckrc -qq --exclude-files spec/samples/global_fields.lua") end) @@ -1268,6 +1269,7 @@ Checking indirect_globals.lua 3 warnings Checking inline_options.lua 7 warnings / 2 errors Checking line_length.lua 8 warnings +Checking minetest.lua 2 warnings Checking python_code.lua 1 error Checking read_globals.lua 5 warnings Checking read_globals_inline_options.lua 3 warnings @@ -1278,7 +1280,7 @@ Checking utf8.lua 4 warnings Checking utf8_error.lua 1 error -Total: 73 warnings / 9 errors in 20 files +Total: 75 warnings / 9 errors in 21 files ]], get_output(". --config=spec/configs/exclude_files_config.luacheckrc -qq --exclude-files global_fields.lua", "spec/samples/")) end) @@ -1293,6 +1295,7 @@ Checking indirect_globals.lua 3 warnings Checking inline_options.lua 7 warnings / 2 errors Checking line_length.lua 8 warnings +Checking minetest.lua 2 warnings Checking python_code.lua 1 error Checking redefined.lua 7 warnings Checking reversed_fornum.lua 1 warning @@ -1301,7 +1304,7 @@ Checking utf8.lua 4 warnings Checking utf8_error.lua 1 error -Total: 65 warnings / 9 errors in 18 files +Total: 67 warnings / 9 errors in 19 files ]], get_output(". --config=spec/configs/exclude_files_config.luacheckrc -qq --exclude-files global_fields.lua --exclude-files " .. quote("./read*"), "spec/samples/")) end) @@ -1351,6 +1354,17 @@ ]], get_output "spec/samples/globals.lua --config=spec/configs/import_config.luacheckrc") end) + describe("responds to builtin std preset", function() + it("minetest", function() + -- make sure minetest sample has something that normally throws a lint error + assert.equal(1, get_exitcode "spec/samples/minetest.lua --no-config") + -- turning on minetest std should pass all lints + assert.equal(0, get_exitcode "spec/samples/minetest.lua --no-config --std minetest") + -- confirm minetest std set isn't just blindly allowing anything + assert.equal(1, get_exitcode "spec/samples/sample.rockspec --no-config --std minetest") + end) + end) + describe("global path", function() setup(function() os.rename(".luacheckrc", ".luacheckrc.bak") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/spec/samples/compound_operators.lua new/luacheck-1.2.0/spec/samples/compound_operators.lua --- old/luacheck-1.1.0/spec/samples/compound_operators.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/spec/samples/compound_operators.lua 2024-05-24 10:32:29.000000000 +0200 @@ -1,6 +1,11 @@ local i = 0 i += 10 i -= 5 -i *= 2 -i /= 5 -return i +local function func() + i /= 5 +end +func() +local t = {} +t.a = i +t.a *= 2 +return t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/spec/samples/minetest.lua new/luacheck-1.2.0/spec/samples/minetest.lua --- old/luacheck-1.1.0/spec/samples/minetest.lua 1970-01-01 01:00:00.000000000 +0100 +++ new/luacheck-1.2.0/spec/samples/minetest.lua 2024-05-24 10:32:29.000000000 +0200 @@ -0,0 +1,2 @@ +local _ = minetest +local _ = minetest.get_current_modname() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/builtin_standards/init.lua new/luacheck-1.2.0/src/luacheck/builtin_standards/init.lua --- old/luacheck-1.1.0/src/luacheck/builtin_standards/init.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/builtin_standards/init.lua 2024-05-24 10:32:29.000000000 +0200 @@ -1,4 +1,5 @@ local love = require "luacheck.builtin_standards.love" +local minetest = require "luacheck.builtin_standards.minetest" local playdate = require "luacheck.builtin_standards.playdate" local ngx = require "luacheck.builtin_standards.ngx" local standards = require "luacheck.standards" @@ -296,6 +297,8 @@ builtin_standards.love = love +builtin_standards.minetest = minetest + builtin_standards.playdate = playdate builtin_standards.rockspec = { @@ -336,7 +339,8 @@ builtin_standards.sile = { globals = { - "SILE", "SU", "luautf8", "pl", "fluent", "CASILE" + package = { fields = { "searchpath" } }, + "SILE", "SU", "luautf8", "pl", "fluent", "executablePath", "extendSilePath", "CASILE" } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/builtin_standards/love.lua new/luacheck-1.2.0/src/luacheck/builtin_standards/love.lua --- old/luacheck-1.1.0/src/luacheck/builtin_standards/love.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/builtin_standards/love.lua 2024-05-24 10:32:29.000000000 +0200 @@ -8,6 +8,7 @@ getVersion = empty, conf = read_write, directorydropped = read_write, + displayrotated = read_write, draw = read_write, errhand = read_write, errorhandler = read_write, @@ -18,6 +19,7 @@ gamepadreleased = read_write, handlers = read_write, hasDeprecationOutput = empty, + isVersionCompatible = read_write, joystickadded = read_write, joystickaxis = read_write, joystickhat = read_write, @@ -87,17 +89,17 @@ "getDPIScale","getPixelDimensions","getPixelHeight","getPixelWidth","isActive","getDefaultMipmapFilter", "setDefaultMipmapFilter"), - image = standards.def_fields("isCompressed","newCompressedData","newImageData","newCubeFaces"), + image = standards.def_fields("isCompressed","newCompressedData","newImageData"), - joystick = standards.def_fields("getJoystickCount","getJoysticks","loadGamepadMappings", - "saveGamepadMappings","setGamepadMapping"), + joystick = standards.def_fields("getGamepadMappingString","getJoystickCount","getJoysticks", + "loadGamepadMappings","saveGamepadMappings","setGamepadMapping"), keyboard = standards.def_fields("getKeyFromScancode","getScancodeFromKey","hasKeyRepeat","hasTextInput", "isDown","isScancodeDown","setKeyRepeat","setTextInput","hasScreenKeyboard"), - math = standards.def_fields("compress","decompress","gammaToLinear","getRandomSeed","getRandomState", - "isConvex","linearToGamma","newBezierCurve","newRandomGenerator","noise","random", - "randomNormal","setRandomSeed","setRandomState","triangulate","newTransform"), + math = standards.def_fields("colorFromBytes","colorToBytes","compress","decompress","gammaToLinear", + "getRandomSeed","getRandomState","isConvex","linearToGamma","newBezierCurve","newRandomGenerator","noise", + "random","randomNormal","setRandomSeed","setRandomState","triangulate","newTransform"), mouse = standards.def_fields("getCursor","getPosition","getRelativeMode","getSystemCursor","getX", "getY","hasCursor","isDown","isGrabbed","isVisible","newCursor","setCursor","setGrabbed", @@ -122,12 +124,12 @@ video = standards.def_fields("newVideoStream"), - window = standards.def_fields("close","fromPixels","getDisplayName","getFullscreen", - "getFullscreenModes","getIcon","getMode","getPixelScale","getPosition","getTitle", - "hasFocus","hasMouseFocus","isDisplaySleepEnabled","isMaximized","isOpen","isVisible", - "maximize","minimize","requestAttention","setDisplaySleepEnabled","setFullscreen", - "setIcon","setMode","setPosition","setTitle","showMessageBox","toPixels", - "updateMode","isMinimized","restore","getDPIScale") + window = standards.def_fields("close","fromPixels","getDesktopDimensions","getDisplayCount","getDisplayName", + "getDisplayOrientation","getFullscreen","getFullscreenModes","getIcon","getMode","getPosition","getSafeArea", + "getTitle","getVSync","hasFocus","hasMouseFocus","isDisplaySleepEnabled","isMaximized","isOpen","isVisible", + "maximize","minimize","requestAttention","setDisplaySleepEnabled","setFullscreen","setIcon","setMode", + "setPosition","setTitle","setVSync","showMessageBox","toPixels","updateMode","isMinimized","restore", + "getDPIScale") } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/builtin_standards/minetest.lua new/luacheck-1.2.0/src/luacheck/builtin_standards/minetest.lua --- old/luacheck-1.1.0/src/luacheck/builtin_standards/minetest.lua 1970-01-01 01:00:00.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/builtin_standards/minetest.lua 2024-05-24 10:32:29.000000000 +0200 @@ -0,0 +1,479 @@ +-- minetest lua api standard +-- lua-api reference: https://github.com/minetest/minetest/blob/master/doc/lua_api.md +local standards = require "luacheck.standards" + +local empty = {} +local read_write = {read_only = false} +local open_table = {read_only = false, other_fields = true} + +-- main namespace +local minetest = { + fields = { + -- Utilities + get_current_modname = empty, + get_modpath = empty, + get_modnames = empty, + get_game_info = empty, + get_worldpath = empty, + is_singleplayer = empty, + features = open_table, + has_feature = empty, + get_player_information = empty, + get_player_window_information = empty, + mkdir = empty, + rmdir = empty, + cpdir = empty, + mvdir = empty, + get_dir_list = empty, + safe_file_write = empty, + get_version = empty, + sha1 = empty, + colorspec_to_colorstring = empty, + colorspec_to_bytes = empty, + encode_png = empty, + urlencode = empty, + + -- Logging + debug = empty, + log = empty, + + -- Environment + register_node = empty, + register_craftitem = empty, + register_tool = empty, + override_item = empty, + unregister_item = empty, + register_entity = empty, + register_abm = empty, + register_lbm = empty, + register_alias = empty, + register_alias_force = empty, + register_ore = empty, + register_biome = empty, + unregister_biome = empty, + register_decoration = empty, + register_schematic = empty, + clear_registered_biomes = empty, + clear_registered_decorations = empty, + clear_registered_ores = empty, + clear_registered_schematics = empty, + + -- Gameplay + register_craft = empty, + clear_craft = empty, + register_chatcommand = empty, + override_chatcommand = empty, + unregister_chatcommand = empty, + register_privilege = empty, + register_authentication_handler = empty, + + -- Global callback registration functions + register_globalstep = empty, + register_on_mods_loaded = empty, + register_on_shutdown = empty, + register_on_placenode = empty, + register_on_dignode = empty, + register_on_punchnode = empty, + register_on_generated = empty, + register_on_newplayer = empty, + register_on_punchplayer = empty, + register_on_rightclickplayer = empty, + register_on_player_hpchange = empty, + register_on_dieplayer = empty, + register_on_respawnplayer = empty, + register_on_prejoinplayer = empty, + register_on_joinplayer = empty, + register_on_leaveplayer = empty, + register_on_authplayer = empty, + register_on_auth_fail = empty, + register_on_cheat = empty, + register_on_chat_message = empty, + register_on_chatcommand = empty, + register_on_player_receive_fields = empty, + register_on_craft = empty, + register_craft_predict = empty, + register_allow_player_inventory_action = empty, + register_on_player_inventory_action = empty, + register_on_protection_violation = empty, + register_on_item_eat = empty, + register_on_item_pickup = empty, + register_on_priv_grant = empty, + register_on_priv_revoke = empty, + register_can_bypass_userlimit = empty, + register_on_modchannel_message = empty, + register_on_liquid_transformed = empty, + register_on_mapblocks_changed = empty, + -- ... and corresponding callback tables + registered_on_chat_messages = open_table, + registered_on_chatcommands = open_table, + registered_globalsteps = open_table, + registered_on_mods_loaded = open_table, + registered_on_shutdown = open_table, + registered_on_punchnodes = open_table, + registered_on_placenodes = open_table, + registered_on_dignodes = open_table, + registered_on_generateds = open_table, + registered_on_newplayers = open_table, + registered_on_dieplayers = open_table, + registered_on_respawnplayers = open_table, + registered_on_prejoinplayers = open_table, + registered_on_joinplayers = open_table, + registered_on_leaveplayers = open_table, + registered_on_player_receive_fields = open_table, + registered_on_cheats = open_table, + registered_on_crafts = open_table, + registered_craft_predicts = open_table, + registered_on_protection_violation = open_table, + registered_on_item_eats = open_table, + registered_on_item_pickups = open_table, + registered_on_punchplayers = open_table, + registered_on_priv_grant = open_table, + registered_on_priv_revoke = open_table, + registered_on_authplayers = open_table, + registered_can_bypass_userlimit = open_table, + registered_on_modchannel_message = open_table, + registered_on_player_inventory_actions = open_table, + registered_allow_player_inventory_actions = open_table, + registered_on_rightclickplayers = open_table, + registered_on_liquid_transformed = open_table, + registered_on_mapblocks_changed = open_table, + + -- Setting-related + settings = standards.def_fields("get", "get_bool", "get_np_group", "get_flags", "set", "set_bool", + "set_np_group", "remove", "get_names", "has", "write", "to_table"), + setting_get_pos = empty, + + -- Authentication + string_to_privs = empty, + privs_to_string = empty, + get_player_privs = empty, + check_player_privs = empty, + check_password_entry = empty, + get_password_hash = empty, + get_player_ip = empty, + get_auth_handler = empty, + notify_authentication_modified = empty, + set_player_password = empty, + set_player_privs = empty, + change_player_privs = empty, + auth_reload = empty, + + -- Chat + chat_send_all = empty, + chat_send_player = empty, + format_chat_message = empty, + + -- Environment access + set_node = empty, + add_node = empty, + bulk_set_node = empty, + swap_node = empty, + remove_node = empty, + get_node = empty, + get_node_or_nil = empty, + get_node_light = empty, + get_natural_light = empty, + get_artificial_light = empty, + place_node = empty, + dig_node = empty, + punch_node = empty, + spawn_falling_node = empty, + find_nodes_with_meta = empty, + get_meta = empty, + get_node_timer = empty, + add_entity = empty, + add_item = empty, + get_player_by_name = empty, + get_objects_inside_radius = empty, + get_objects_in_area = empty, + set_timeofday = empty, + get_timeofday = empty, + get_gametime = empty, + get_day_count = empty, + find_node_near = empty, + find_nodes_in_area = empty, + find_nodes_in_area_under_air = empty, + get_perlin = empty, + get_voxel_manip = empty, + set_gen_notify = empty, + get_gen_notify = empty, + get_decoration_id = empty, + get_mapgen_object = empty, + get_heat = empty, + get_humidity = empty, + get_biome_data = empty, + get_biome_id = empty, + get_biome_name = empty, + get_mapgen_params = empty, + set_mapgen_params = empty, + get_mapgen_edges = empty, + get_mapgen_setting = empty, + get_mapgen_setting_noiseparams = empty, + set_mapgen_setting = empty, + set_mapgen_setting_noiseparams = empty, + set_noiseparams = empty, + get_noiseparams = empty, + generate_ores = empty, + generate_decorations = empty, + clear_objects = empty, + load_area = empty, + emerge_area = empty, + delete_area = empty, + line_of_sight = empty, + raycast = empty, + find_path = empty, + spawn_tree = empty, + transforming_liquid_add = empty, + get_node_max_level = empty, + get_node_level = empty, + set_node_level = empty, + add_node_level = empty, + get_node_boxes = empty, + fix_light = empty, + check_single_for_falling = empty, + check_for_falling = empty, + get_spawn_level = empty, + + -- Mod channels + mod_channel_join = empty, + + -- Inventory + get_inventory = empty, + create_detached_inventory = empty, + remove_detached_inventory = empty, + do_item_eat = empty, + + -- Formspec + show_formspec = empty, + close_formspec = empty, + formspec_escape = empty, + explode_table_event = empty, + explode_textlist_event = empty, + explode_scrollbar_event = empty, + + -- Item handling + inventorycube = empty, + get_pointed_thing_position = empty, + dir_to_facedir = empty, + facedir_to_dir = empty, + dir_to_fourdir = empty, + fourdir_to_dir = empty, + dir_to_wallmounted = empty, + wallmounted_to_dir = empty, + dir_to_yaw = empty, + yaw_to_dir = empty, + is_colored_paramtype = empty, + strip_param2_color = empty, + get_node_drops = empty, + get_craft_result = empty, + get_craft_recipe = empty, + get_all_craft_recipes = empty, + handle_node_drops = empty, + itemstring_with_palette = empty, + itemstring_with_color = empty, + + -- Rollback + rollback_get_node_actions = empty, + rollback_revert_actions_by = empty, + + -- Defaults for the on_place and on_drop item definition functions + item_place_node = empty, + item_place_object = empty, + item_place = empty, + item_pickup = empty, + item_drop = empty, + item_eat = empty, + + -- Defaults for the on_punch and on_dig node definition callbacks + node_punch = empty, + node_dig = empty, + + -- Sounds + sound_play = empty, + sound_stop = empty, + sound_fade = empty, + + -- Timing + after = empty, + + -- Async environment + handle_async = empty, + register_async_dofile = empty, + + -- Server + request_shutdown = empty, + cancel_shutdown_requests = empty, + get_server_status = empty, + get_server_uptime = empty, + get_server_max_lag = empty, + remove_player = empty, + remove_player_auth = empty, + dynamic_add_media = empty, + + -- Bans + get_ban_list = empty, + get_ban_description = empty, + ban_player = empty, + unban_player_or_ip = empty, + kick_player = empty, + disconnect_player = empty, + + -- Particles + add_particle = empty, + add_particlespawner = empty, + delete_particlespawner = empty, + + -- Schematics + create_schematic = empty, + place_schematic = empty, + place_schematic_on_vmanip = empty, + serialize_schematic = empty, + read_schematic = empty, + + -- HTTP Requests + request_http_api = empty, + + -- Storage API + get_mod_storage = empty, + + -- Misc + get_connected_players = empty, + is_player = empty, + player_exists = empty, + hud_replace_builtin = empty, + parse_relative_number = empty, + send_join_message = empty, + send_leave_message = empty, + hash_node_position = empty, + get_position_from_hash = empty, + get_item_group = empty, + get_node_group = empty, + raillike_group = empty, + get_content_id = empty, + get_name_from_content_id = empty, + parse_json = empty, + write_json = empty, + serialize = empty, + deserialize = empty, + compress = empty, + decompress = empty, + rgba = empty, + encode_base64 = empty, + decode_base64 = empty, + is_protected = read_write, + record_protection_violation = empty, + is_creative_enabled = empty, + is_area_protected = empty, + rotate_and_place = empty, + rotate_node = empty, + calculate_knockback = empty, + forceload_block = empty, + forceload_free_block = empty, + compare_block_status = empty, + request_insecure_environment = empty, + global_exists = empty, + + -- Error Handling + error_handler = read_write, + + -- Helper functions + wrap_text = empty, + pos_to_string = empty, + string_to_pos = empty, + string_to_area = empty, + is_yes = empty, + is_nan = empty, + get_us_time = empty, + pointed_thing_to_face_pos = empty, + get_tool_wear_after_use = empty, + get_dig_params = empty, + get_hit_params = empty, + colorize = empty, + + -- Translations + get_translator = empty, + get_translated_string = empty, + translate = empty, + + -- Global tables + registered_items = open_table, + registered_nodes = open_table, + registered_craftitems = open_table, + registered_tools = open_table, + registered_entities = open_table, + object_refs = open_table, + luaentities = open_table, + registered_abms = open_table, + registered_lbms = open_table, + registered_aliases = open_table, + registered_ores = open_table, + registered_biomes = open_table, + registered_decorations = open_table, + registered_schematics = open_table, + registered_chatcommands = open_table, + registered_privileges = open_table, + + -- Constants (see: https://github.com/minetest/minetest/blob/master/builtin/game/constants.lua) + CONTENT_UNKNOWN = empty, + CONTENT_AIR = empty, + CONTENT_IGNORE = empty, + EMERGE_CANCELLED = empty, + EMERGE_ERRORED = empty, + EMERGE_FROM_MEMORY = empty, + EMERGE_FROM_DISK = empty, + EMERGE_GENERATED = empty, + MAP_BLOCKSIZE = empty, + PLAYER_MAX_HP_DEFAULT = empty, + PLAYER_MAX_BREATH_DEFAULT = empty, + LIGHT_MAX = empty + } +} + +-- Table additions +local table = standards.def_fields("copy", "indexof", "insert_all", "key_value_swap", "shuffle") + +-- String additions +local string = standards.def_fields("split", "trim") + +-- Math additions +local math = standards.def_fields("hypot", "sign", "factorial", "round") + +-- Bit library +local bit = standards.def_fields("tobit","tohex","bnot","band","bor","bxor","lshift","rshift","arshift","rol","ror", + "bswap") + +-- vector util +local vector = standards.def_fields("new", "zero", "copy", "from_string", "to_string", "direction", "distance", + "length", "normalize", "floor", "round", "apply", "combine", "equals", "sort", "angle", "dot", "cross", "offset", + "check", "in_area", "add", "subtract", "multiply", "divide", "rotate", "rotate_around_axis", "dir_to_rotation") + +return { + read_globals = { + -- main namespace + minetest = minetest, + + -- extensions + table = table, + math = math, + bit = bit, + string = string, + + -- Helper functions + vector = vector, + dump = empty, + dump2 = empty, + + -- classes + AreaStore = empty, + ItemStack = empty, + PerlinNoise = empty, + PerlinNoiseMap = empty, + PseudoRandom = empty, + PcgRandom = empty, + SecureRandom = empty, + VoxelArea = open_table, + VoxelManip = empty, + Raycast = empty, + Settings = empty, + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/builtin_standards/playdate.lua new/luacheck-1.2.0/src/luacheck/builtin_standards/playdate.lua --- old/luacheck-1.1.0/src/luacheck/builtin_standards/playdate.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/builtin_standards/playdate.lua 2024-05-24 10:32:29.000000000 +0200 @@ -35,7 +35,7 @@ -- JSON local json = standards.def_fields("decode", "decodeFile", "encode", "encodePretty", "encodeToFile") --- Text Alignement +-- Text Alignment local kTextAlignment = standards.def_fields("left", "center", "right") -- Playdate SDK diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/format.lua new/luacheck-1.2.0/src/luacheck/format.lua --- old/luacheck-1.1.0/src/luacheck/format.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/format.lua 2024-05-24 10:32:29.000000000 +0200 @@ -4,9 +4,11 @@ local format = {} local color_support = not utils.is_windows or os.getenv("ANSICON") +-- Disable colors when NO_COLOR is set, see https://no-color.org/. +color_support = color_support and not os.getenv("NO_COLOR") local function get_message_format(warning) - local message_format = assert(stages.warnings[warning.code], "Unkown warning code " .. warning.code).message_format + local message_format = assert(stages.warnings[warning.code], "Unknown warning code " .. warning.code).message_format if type(message_format) == "function" then return message_format(warning) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/init.lua new/luacheck-1.2.0/src/luacheck/init.lua --- old/luacheck-1.1.0/src/luacheck/init.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/init.lua 2024-05-24 10:32:29.000000000 +0200 @@ -5,7 +5,7 @@ local utils = require "luacheck.utils" local luacheck = { - _VERSION = "1.1.0" + _VERSION = "1.2.0" } local function raw_validate_options(fname, opts, stds, context) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/main.lua new/luacheck-1.2.0/src/luacheck/main.lua --- old/luacheck-1.1.0/src/luacheck/main.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/main.lua 2024-05-24 10:32:29.000000000 +0200 @@ -92,6 +92,7 @@ " luajit - globals of LuaJIT 2.x;\n" .. " ngx_lua - globals of Openresty lua-nginx-module 0.10.10, including standard LuaJIT 2.x globals;\n" .. " love - globals added by LÖVE;\n" .. + " minetest - globals added by minetest;\n" .. " playdate - globals added by the Playdate SDK;\n" .. " busted - globals added by Busted 2.0, by default added for files ending with _spec.lua within spec, " .. "test, and tests subdirectories;\n" .. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/parser.lua new/luacheck-1.2.0/src/luacheck/parser.lua --- old/luacheck-1.1.0/src/luacheck/parser.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/parser.lua 2024-05-24 10:32:29.000000000 +0200 @@ -900,7 +900,7 @@ if primary_expression.tag == "Call" or primary_expression.tag == "Invoke" then if lhs then - -- The is an assingment, and a call is not valid in lhs. + -- The is an assignment, and a call is not valid in lhs. parse_error(state, "expected call or indexing") else -- This is a call. @@ -931,7 +931,7 @@ parse_error(state, "compound assignment not allowed on tuples near " .. compound_operator .. "=") end - return new_inner_node(start_range, rhs[1], "OpSet", {compound_operator, lhs[1], rhs[1]}) + return new_inner_node(start_range, rhs[1], "OpSet", {lhs, rhs, compound_operator}) else -- This is an assignment in the form `lhs = rhs`. check_and_skip_token(state, "=") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/runner.lua new/luacheck-1.2.0/src/luacheck/runner.lua --- old/luacheck-1.1.0/src/luacheck/runner.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/runner.lua 2024-05-24 10:32:29.000000000 +0200 @@ -104,7 +104,7 @@ -- Normalizes inputs and filters inputs using `exclude_files` and `include_files` options. -- Returns an array of prepared input tables. --- Differences between normal and prepated inputs: +-- Differences between normal and prepared inputs: -- * Prepared inputs can't have `rockspec_path` field. -- * Prepared inputs can't have `path` pointing to a directory (unless it has an error). -- * Prepared inputs have `filename` field if possible (copied from `path` if not given). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/serializer.lua new/luacheck-1.2.0/src/luacheck/serializer.lua --- old/luacheck-1.1.0/src/luacheck/serializer.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/serializer.lua 2024-05-24 10:32:29.000000000 +0200 @@ -110,7 +110,7 @@ end -- Serializes a value into buffer. --- `strings` is a table mapping string values to where they first occured or to name of local +-- `strings` is a table mapping string values to where they first occurred or to name of local -- variable used to represent it. -- Array part contains representations of values saved into locals. local function add_value(buffer, strings, value, level) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/stages/detect_compound_operators.lua new/luacheck-1.2.0/src/luacheck/stages/detect_compound_operators.lua --- old/luacheck-1.1.0/src/luacheck/stages/detect_compound_operators.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/stages/detect_compound_operators.lua 2024-05-24 10:32:29.000000000 +0200 @@ -23,7 +23,7 @@ } local function check_node(chstate, node) - local operator = reverse_compound_operators[node[1]] + local operator = reverse_compound_operators[node[3]] chstate:warn_range("033", node, {operator = operator}) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/stages/detect_globals.lua new/luacheck-1.2.0/src/luacheck/stages/detect_globals.lua --- old/luacheck-1.1.0/src/luacheck/stages/detect_globals.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/stages/detect_globals.lua 2024-05-24 10:32:29.000000000 +0200 @@ -234,7 +234,7 @@ if item.rhs then detect_in_nodes(chstate, item, item.rhs, is_top_line) end - elseif item.tag == "Set" then + elseif item.tag == "Set" or item.tag == "OpSet" then detect_in_nodes(chstate, item, item.lhs, is_top_line, true) detect_in_nodes(chstate, item, item.rhs, is_top_line) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/stages/detect_uninit_accesses.lua new/luacheck-1.2.0/src/luacheck/stages/detect_uninit_accesses.lua --- old/luacheck-1.1.0/src/luacheck/stages/detect_uninit_accesses.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/stages/detect_uninit_accesses.lua 2024-05-24 10:32:29.000000000 +0200 @@ -15,7 +15,7 @@ for var, accessing_nodes in pairs(item_var_map) do -- If there are no values at all reaching this access, not even the empty one, -- this item (or a closure containing it) is not reachable from variable definition. - -- It will be reported as unreachable code, no need to report uninitalized accesses in it. + -- It will be reported as unreachable code, no need to report uninitialized accesses in it. if item.used_values[var] then -- If this variable is has only one, empty value then it's already reported as never set, -- no need to report each access. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/stages/linearize.lua new/luacheck-1.2.0/src/luacheck/stages/linearize.lua --- old/luacheck-1.1.0/src/luacheck/stages/linearize.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/stages/linearize.lua 2024-05-24 10:32:29.000000000 +0200 @@ -57,7 +57,7 @@ self.accessed_upvalues = {} -- Maps variables to arrays of mutating items. self.mutated_upvalues = {} - -- Maps variables to arays of setting items. + -- Maps variables to arrays of setting items. self.set_upvalues = {} self.lines = {} self.node = node @@ -203,8 +203,8 @@ return { tag = "OpSet", node = node, - lhs = node[2], - rhs = node[3], + lhs = node[1], + rhs = node[2], accesses = {}, mutations = {}, used_values = {}, @@ -530,18 +530,19 @@ function LinState:emit_stmt_OpSet(node) local item = new_opset_item(node) - self:scan_expr(item, node[3]) + self:scan_exprs(item, node[2]) - local lhs = node[2] - if lhs.tag == "Id" then - local var = self:check_var(lhs) + for _, expr in ipairs(node[1]) do + if expr.tag == "Id" then + local var = self:check_var(expr) - if var then - self:register_upvalue_action(item, var, "set_upvalues") + if var then + self:register_upvalue_action(item, var, "set_upvalues") + end + else + assert(expr.tag == "Index") + self:scan_lhs_index(item, expr) end - else - assert(lhs.tag == "Index") - self:scan_lhs_index(item, lhs) end self:emit(item) @@ -650,7 +651,7 @@ local line = self.lines.top for _, item in ipairs(line.items) do - if item.tag == "Local" or item.tag == "Set" then + if item.tag == "Local" or item.tag == "Set" or item.tag == "OpSet" then item.set_variables = {} local is_init = item.tag == "Local" @@ -674,6 +675,10 @@ local value if node.var then + -- OpSet also accesses + if item.tag == "OpSet" then + self:mark_access(item, node) + end value = new_value(node, item.rhs and item.rhs[i] or unpacking_item, item, is_init) item.set_variables[node.var] = value table.insert(node.var.values, value) @@ -724,7 +729,7 @@ end -- Builds linear representation (line) of AST and assigns it as `chstate.top_line`. --- Assings an array of all lines as `chstate.lines`. +-- Assigns an array of all lines as `chstate.lines`. -- Adds warnings for redefined/shadowed locals and unused labels. function stage.run(chstate) local linstate = LinState(chstate) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/stages/parse_inline_options.lua new/luacheck-1.2.0/src/luacheck/stages/parse_inline_options.lua --- old/luacheck-1.1.0/src/luacheck/stages/parse_inline_options.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/stages/parse_inline_options.lua 2024-05-24 10:32:29.000000000 +0200 @@ -239,7 +239,7 @@ end end --- Applies bounadaries withing `inline_options_and_boundaries` to replace them with pop count +-- Applies boundaries within `inline_options_and_boundaries` to replace them with pop count -- instructions in the resulting array. -- Comments on lines with code are popped at the end of line. -- Warns about unpaired push and pop directives. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/stages/resolve_locals.lua new/luacheck-1.2.0/src/luacheck/stages/resolve_locals.lua --- old/luacheck-1.1.0/src/luacheck/stages/resolve_locals.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/stages/resolve_locals.lua 2024-05-24 10:32:29.000000000 +0200 @@ -79,35 +79,48 @@ end local function contains_call(node) + if node._contains_call ~= nil then + -- return cached result + return node._contains_call + end + if node.tag == "Call" or node.tag == "Invoke" then + node._contains_call = true return true end if node.tag ~= "Function" then for _, sub_node in ipairs(node) do if type(sub_node) == 'table' and contains_call(sub_node) then + node._contains_call = true return true end end end + node._contains_call = false return false end local function is_circular_reference(item, var) + -- OpSet is circular by definition + if not (item.tag == "Set" or item.tag == "Local") then + return false + end + -- No support for matching multiple assignment to the specific assignment - if not (item.tag == "Set" or item.tag == "Local" or item.tag == "OpSet") then + if not item.lhs or #item.lhs ~= 1 or not item.rhs or #item.rhs ~= 1 then return false end -- Case t[t.function()] = t.func() -- Functions can have side-effects, so this isn't purely circular - local right_assignment = item.tag == "OpSet" and item.rhs or item.rhs[1] + local right_assignment = item.rhs[1] if contains_call(right_assignment) then return false end - local left_assignment = item.tag == "OpSet" and item.lhs or item.lhs[1] + local left_assignment = item.lhs[1] if contains_call(left_assignment) then return false end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/stages/unwrap_parens.lua new/luacheck-1.2.0/src/luacheck/stages/unwrap_parens.lua --- old/luacheck-1.1.0/src/luacheck/stages/unwrap_parens.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/stages/unwrap_parens.lua 2024-05-24 10:32:29.000000000 +0200 @@ -50,25 +50,24 @@ if node[2] then handle_nodes(chstate, node[2]) end - elseif tag == "Set" then + elseif tag == "Set" or tag == "OpSet" then handle_nodes(chstate, node[1]) handle_nodes(chstate, node[2], 1) else - -- warn that not x == y means (not x) == y - if tag ~= "Paren" - and node[1] - and node[1].tag == "Op" - and relational_operators[node[1][1]] - and node[1][2][1] == "not" + -- warn that not x <relop> y means (not x) <relop> y + if tag == "Op" + and relational_operators[node[1]] + and node[2].tag == "Op" + and node[2][1] == "not" then - chstate:warn_range("582", node[1]) + chstate:warn_range("582", node) end handle_nodes(chstate, node) -- warn that not (x == y) can become x ~= y if tag == "Op" and node[1] == "not" and node[2].tag == "Op" and relational_operators[node[2][1]] then - chstate:warn_range("581", node, { + chstate:warn_range("581", node, { operator = relational_operators[node[2][1]], replacement_operator = replacements[node[2][1]] }) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/luacheck-1.1.0/src/luacheck/vendor/sha1/init.lua new/luacheck-1.2.0/src/luacheck/vendor/sha1/init.lua --- old/luacheck-1.1.0/src/luacheck/vendor/sha1/init.lua 2022-12-19 18:51:56.000000000 +0100 +++ new/luacheck-1.2.0/src/luacheck/vendor/sha1/init.lua 2024-05-24 10:32:29.000000000 +0200 @@ -8,7 +8,7 @@ SHA-1 secure hash and HMAC-SHA1 signature computation in Lua, using bit and bit32 modules and Lua 5.3 operators when available and falling back to a pure Lua implementation on Lua 5.1. -Based on code orignally by Jeffrey Friedl and modified by +Based on code originally by Jeffrey Friedl and modified by Eike Decker and Enrique García Cota.]], _LICENSE = [[ MIT LICENSE
