diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index 924abb37a..0aee2ef4f 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -42,7 +42,7 @@ jobs: - name: Lint Lua code run: | test -d bin || mkdir bin - test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/bin/illuaminate + test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/linux-x86-64/illuaminate chmod +x bin/illuaminate bin/illuaminate lint diff --git a/src/main/resources/assets/computercraft/lua/bios.lua b/src/main/resources/assets/computercraft/lua/bios.lua index 500276da4..a7f7a9d21 100644 --- a/src/main/resources/assets/computercraft/lua/bios.lua +++ b/src/main/resources/assets/computercraft/lua/bios.lua @@ -253,7 +253,7 @@ end function print( ... ) local nLinesPrinted = 0 - local nLimit = select("#", ... ) + local nLimit = select("#", ...) for n = 1, nLimit do local s = tostring( select( n, ... ) ) if n < nLimit then @@ -695,7 +695,7 @@ if http then end local function checkOptions( options, body ) - checkKey( options, "url", "string") + checkKey( options, "url", "string" ) if body == false then checkKey( options, "body", "nil" ) else @@ -725,7 +725,7 @@ if http then return nil, err end - http.get = function( _url, _headers, _binary) + http.get = function(_url, _headers, _binary) if type( _url ) == "table" then checkOptions( _url, false ) return wrapRequest( _url.url, _url ) @@ -737,7 +737,7 @@ if http then return wrapRequest( _url, _url, nil, _headers, _binary ) end - http.post = function( _url, _post, _headers, _binary) + http.post = function(_url, _post, _headers, _binary) if type( _url ) == "table" then checkOptions( _url, true ) return wrapRequest( _url.url, _url ) diff --git a/src/main/resources/assets/computercraft/lua/rom/apis/term.lua b/src/main/resources/assets/computercraft/lua/rom/apis/term.lua index 706bd16f6..c6f9c2a9b 100644 --- a/src/main/resources/assets/computercraft/lua/rom/apis/term.lua +++ b/src/main/resources/assets/computercraft/lua/rom/apis/term.lua @@ -43,7 +43,7 @@ end -- Some methods shouldn't go through redirects, so we move them to the main -- term API. -for _, method in ipairs { "nativePaletteColor", "nativePaletteColour"} do +for _, method in ipairs { "nativePaletteColor", "nativePaletteColour" } do term[method] = native[method] native[method] = nil end diff --git a/src/main/resources/assets/computercraft/lua/rom/apis/textutils.lua b/src/main/resources/assets/computercraft/lua/rom/apis/textutils.lua index 38360ea71..de7cd4e95 100644 --- a/src/main/resources/assets/computercraft/lua/rom/apis/textutils.lua +++ b/src/main/resources/assets/computercraft/lua/rom/apis/textutils.lua @@ -346,10 +346,10 @@ function urlEncode( str ) else -- Non-ASCII (encode as UTF-8) return - string.format("%%%02X", 192 + bit32.band( bit32.arshift(n, 6), 31 ) ) .. - string.format("%%%02X", 128 + bit32.band( n, 63 ) ) + string.format("%%%02X", 192 + bit32.band( bit32.arshift(n, 6), 31 )) .. + string.format("%%%02X", 128 + bit32.band( n, 63 )) end - end ) + end) str = string.gsub(str, " ", "+") end return str diff --git a/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/pretty.lua b/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/pretty.lua index cf0007568..2fdaee187 100644 --- a/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/pretty.lua +++ b/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/pretty.lua @@ -393,7 +393,7 @@ end -- @treturn Doc The object formatted as a document. -- @usage Display a table on the screen -- local pretty = require "cc.pretty" --- pretty.print(pretty.pretty({ 1, 2, 3 }) +-- pretty.print(pretty.pretty({ 1, 2, 3 })) local function pretty(obj) return pretty_impl(obj, {}) end diff --git a/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/shell/completion.lua b/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/shell/completion.lua index 865e54dcb..d89c72a91 100644 --- a/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/shell/completion.lua +++ b/src/main/resources/assets/computercraft/lua/rom/modules/main/cc/shell/completion.lua @@ -97,7 +97,7 @@ end -- complete.build( -- { complete.choice, { "get", "put" } }, -- complete.dir, --- } complete.file, many = true } +-- { complete.file, many = true } -- ) local function build(...) local arguments = table.pack(...) diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua b/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua index 5e6cfee1c..0125d5b12 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/edit.lua @@ -15,7 +15,7 @@ end -- Create .lua files by default if not fs.exists( sPath ) and not string.find( sPath, "%." ) then - local sExtension = settings.get("edit.default_extension", "" ) + local sExtension = settings.get("edit.default_extension", "") if sExtension ~= "" and type( sExtension ) == "string" then sPath = sPath .. "." .. sExtension end @@ -85,7 +85,7 @@ end local function save( _sPath ) -- Create intervening folder - local sDir = _sPath:sub(1, _sPath:len() - fs.getName(_sPath):len() ) + local sDir = _sPath:sub(1, _sPath:len() - fs.getName(_sPath):len()) if not fs.exists( sDir ) then fs.makeDir( sDir ) end diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua b/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua index 758e82074..d2f3a5159 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/paint.lua @@ -46,7 +46,7 @@ end -- Create .nfp files by default if not fs.exists( sPath ) and not string.find( sPath, "%." ) then - local sExtension = settings.get("paint.default_extension", "" ) + local sExtension = settings.get("paint.default_extension", "") if sExtension ~= "" and type( sExtension ) == "string" then sPath = sPath .. "." .. sExtension end diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/redirection.lua b/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/redirection.lua index fc6e0f038..3f68e3859 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/redirection.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/fun/advanced/redirection.lua @@ -525,7 +525,7 @@ function InterFace.drawBar() term.setCursorPos( TermW - 8, TermH ) term.setBackgroundColor( colors.black ) term.setTextColour(InterFace.cSpeedD) - write(" <<" ) + write(" <<") if bPaused then term.setTextColour(InterFace.cSpeedA) else diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/fun/adventure.lua b/src/main/resources/assets/computercraft/lua/rom/programs/fun/adventure.lua index 17c2b9a2b..48e06a950 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/fun/adventure.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/fun/adventure.lua @@ -1001,7 +1001,7 @@ function commands.cbreak( _sItem, _sTool ) end end else - print( "You can't break " .. sItem .. " with " .. sTool .. ".") + print("You can't break " .. sItem .. " with " .. sTool .. ".") end elseif tItem.creature == true then diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/fun/dj.lua b/src/main/resources/assets/computercraft/lua/rom/programs/fun/dj.lua index 78b259fe0..5ec03d2ce 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/fun/dj.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/fun/dj.lua @@ -1,7 +1,7 @@ local tArgs = { ... } local function printUsage() - print( "Usages:") + print( "Usages:" ) print( "dj play" ) print( "dj play " ) print( "dj stop" ) diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/fun/worm.lua b/src/main/resources/assets/computercraft/lua/rom/programs/fun/worm.lua index 507763cb4..e02654d1f 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/fun/worm.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/fun/worm.lua @@ -89,7 +89,7 @@ local function drawMenu() term.setTextColour( headingColour ) term.setCursorPos(w - 11, 1) - term.write( "DIFFICULTY ") + term.write( "DIFFICULTY " ) term.setTextColour( textColour ) term.setCursorPos(w, 1) diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/pocket/falling.lua b/src/main/resources/assets/computercraft/lua/rom/programs/pocket/falling.lua index bdc922e4f..330042936 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/pocket/falling.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/pocket/falling.lua @@ -158,7 +158,7 @@ local block_T = { bg = colorass(colors.purple, colors.white), } -local blocks = { block_line, block_square, block_s1, block_s2, block_L1, block_L2, block_T} +local blocks = { block_line, block_square, block_s1, block_s2, block_L1, block_L2, block_T } local points = {4, 10, 30, 120} diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/rednet/chat.lua b/src/main/resources/assets/computercraft/lua/rom/programs/rednet/chat.lua index 4c4ae75c0..ac8f4bc65 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/rednet/chat.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/rednet/chat.lua @@ -387,7 +387,7 @@ elseif sCommand == "join" then promptWindow.setCursorPos( 1, 1 ) promptWindow.clearLine() promptWindow.setTextColor( highlightColour ) - promptWindow.write( ": ") + promptWindow.write( ": " ) promptWindow.setTextColor( textColour ) local sChat = read( nil, tSendHistory ) diff --git a/src/main/resources/assets/computercraft/lua/rom/startup.lua b/src/main/resources/assets/computercraft/lua/rom/startup.lua index dcefffb93..e19eb0317 100644 --- a/src/main/resources/assets/computercraft/lua/rom/startup.lua +++ b/src/main/resources/assets/computercraft/lua/rom/startup.lua @@ -43,7 +43,7 @@ end local function completePastebinPut(shell, text, previous) if previous[2] == "put" then - return fs.complete(text, shell.dir(), true, false ) + return fs.complete( text, shell.dir(), true, false ) end end @@ -106,7 +106,7 @@ if turtle then ) ) shell.setCompletionFunction( "rom/programs/turtle/turn.lua", completion.build( { completion.choice, { "left", "right" }, true, many = true } - )) + ) ) shell.setCompletionFunction( "rom/programs/turtle/equip.lua", completion.build( nil, { completion.choice, { "left", "right" } } diff --git a/src/test/resources/test-rom/mcfly.lua b/src/test/resources/test-rom/mcfly.lua index ac64ad565..20dcd4cd2 100644 --- a/src/test/resources/test-rom/mcfly.lua +++ b/src/test/resources/test-rom/mcfly.lua @@ -356,7 +356,7 @@ function expect_mt:called_with_matching(...) return called_with_check(matches, self, ...) end -local expect = setmetatable( { +local expect = setmetatable({ --- Construct an expectation on the error message calling this function -- produces -- diff --git a/src/test/resources/test-rom/spec/apis/http_spec.lua b/src/test/resources/test-rom/spec/apis/http_spec.lua index a6774a48c..ecaf1d307 100644 --- a/src/test/resources/test-rom/spec/apis/http_spec.lua +++ b/src/test/resources/test-rom/spec/apis/http_spec.lua @@ -1,19 +1,19 @@ describe("The http library", function() describe("http.checkURL", function() it("accepts well formed domains", function() - expect({ http.checkURL("https://google.com")}):same({ true }) + expect({ http.checkURL("https://google.com") }):same({ true }) end) it("rejects malformed URLs", function() - expect({ http.checkURL("google.com")}):same({ false, "Must specify http or https" }) - expect({ http.checkURL("https:google.com")}):same({ false, "URL malformed" }) - expect({ http.checkURL("https:/google.com")}):same({ false, "URL malformed" }) - expect({ http.checkURL("wss://google.com")}):same({ false, "Invalid protocol 'wss'" }) + expect({ http.checkURL("google.com") }):same({ false, "Must specify http or https" }) + expect({ http.checkURL("https:google.com") }):same({ false, "URL malformed" }) + expect({ http.checkURL("https:/google.com") }):same({ false, "URL malformed" }) + expect({ http.checkURL("wss://google.com") }):same({ false, "Invalid protocol 'wss'" }) end) it("rejects local domains", function() - expect({ http.checkURL("http://localhost")}):same({ false, "Domain not permitted" }) - expect({ http.checkURL("http://127.0.0.1")}):same({ false, "Domain not permitted" }) + expect({ http.checkURL("http://localhost") }):same({ false, "Domain not permitted" }) + expect({ http.checkURL("http://127.0.0.1") }):same({ false, "Domain not permitted" }) end) end) end) diff --git a/src/test/resources/test-rom/spec/modules/cc/shell/completion_spec.lua b/src/test/resources/test-rom/spec/modules/cc/shell/completion_spec.lua index ffcd3b7f3..6b2c0aaa1 100644 --- a/src/test/resources/test-rom/spec/modules/cc/shell/completion_spec.lua +++ b/src/test/resources/test-rom/spec/modules/cc/shell/completion_spec.lua @@ -22,7 +22,7 @@ describe("cc.shell.completion", function() local spec = c.build( function() return { "a", "b", "c" } end, nil, - { c.choice, { "d", "e", "f"} } + { c.choice, { "d", "e", "f" } } ) expect(spec(shell, 1, "")):same { "a", "b", "c" } diff --git a/src/test/resources/test-rom/spec/programs/http/pastebin_spec.lua b/src/test/resources/test-rom/spec/programs/http/pastebin_spec.lua index 831d88fc1..61bfe833b 100644 --- a/src/test/resources/test-rom/spec/programs/http/pastebin_spec.lua +++ b/src/test/resources/test-rom/spec/programs/http/pastebin_spec.lua @@ -52,14 +52,14 @@ describe("The pastebin program", function() local file = fs.open( "testup", "w" ) file.close() - expect(capture(stub, "pastebin", "put", "testup" )) + expect(capture(stub, "pastebin", "put", "testup")) :matches { ok = true, output = "Connecting to pastebin.com... Success.\nUploaded as https://pastebin.com/abcde\nRun \"pastebin get abcde\" to download anywhere\n", error = "" } end) it("upload a not existing program to pastebin", function() setup_request() - expect(capture(stub, "pastebin", "put", "nothing" )) + expect(capture(stub, "pastebin", "put", "nothing")) :matches { ok = true, output = "No such file\n", error = "" } end) diff --git a/src/test/resources/test-rom/spec/programs/peripherals_spec.lua b/src/test/resources/test-rom/spec/programs/peripherals_spec.lua index f52961a13..6c9d433bd 100644 --- a/src/test/resources/test-rom/spec/programs/peripherals_spec.lua +++ b/src/test/resources/test-rom/spec/programs/peripherals_spec.lua @@ -2,7 +2,7 @@ local capture = require "test_helpers".capture_program describe("The peripherals program", function() it("says when there are no peripherals", function() - expect(capture(stub, "peripherals" )) + expect(capture(stub, "peripherals")) :matches { ok = true, output = "Attached Peripherals:\nNone\n", error = "" } end) end)