Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachase committed May 10, 2020
1 parent 3285876 commit a184193
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 25 deletions.
51 changes: 51 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"Lua.runtime.version": "Lua 5.2",
"Lua.diagnostics.disable": [
"unused-local",
"lowercase-global",
"undefined-global",
"unused-function"
],
"Lua.diagnostics.severity": {
"redefined-local": "Warning"
},
"Lua.diagnostics.globals": [
"printError",
"sleep",
"read",
"write",
"print",
"colours",
"colors",
"commands",
"disk",
"fs",
"gps",
"help",
"http",
"paintutils",
"parallel",
"peripheral",
"rednet",
"redstone",
"keys",
"settings",
"shell",
"multishell",
"term",
"textutils",
"turtle",
"pocket",
"vector",
"bit32",
"window",
"_CC_DEFAULT_SETTINGS",
"_HOST",
"_VERSION",
"_"
],
"Lua.workspace.ignoreDir": [
".vscode",
"vendor"
]
}
32 changes: 16 additions & 16 deletions pproc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ local function attemptSub(line)

lineP = lineP .. attemptSub(scope[i][2])

for p = 1, #modded do
local indER = modded[p]
for pp = 1, #modded do
local indER = modded[pp]
if tempHold[indER] then
scope[indER] = tempHold[indER]
else
Expand Down Expand Up @@ -310,8 +310,8 @@ while #lines > 0 do
local command = trimS(inst:sub(12))
local inStr = command:match("%b\"\"")
if inStr then
local fn = inStr:sub(2, #inStr - 1)
local Ihandle = outAPI.open(fn, "rb")
local fun = inStr:sub(2, #inStr - 1)
local Ihandle = outAPI.open(fun, "rb")
if Ihandle then
local Idata = Ihandle:read("*all") .. "\n"
local Ilines = {"[["}
Expand All @@ -328,7 +328,7 @@ while #lines > 0 do

lines = Ilines
else
erf("Preprocessor parse error: (Line " .. lineI .. ")\nCannot find `" .. fn .. "'\n")
erf("Preprocessor parse error: (Line " .. lineI .. ")\nCannot find `" .. fun .. "'\n")
end
else
erf("Preprocessor parse error: (Line " .. lineI .. ")\nUnknown include strategy\n")
Expand All @@ -337,8 +337,8 @@ while #lines > 0 do
local command = trimS(inst:sub(8))
local inStr = command:match("%b\"\"")
if inStr then
local fn = inStr:sub(2, #inStr - 1)
local Ihandle = outAPI.open(fn, "rb")
local fun = inStr:sub(2, #inStr - 1)
local Ihandle = outAPI.open(fun, "rb")
if Ihandle then
local Idata = Ihandle:read("*all") .. "\n"
local Ilines = {}
Expand All @@ -353,7 +353,7 @@ while #lines > 0 do

lines = Ilines
else
erf("Preprocessor parse error: (Line " .. lineI .. ")\nCannot find `" .. fn .. "'\n")
erf("Preprocessor parse error: (Line " .. lineI .. ")\nCannot find `" .. fun .. "'\n")
end
else
erf("Preprocessor parse error: (Line " .. lineI .. ")\nUnknown include strategy\n")
Expand All @@ -363,10 +363,10 @@ while #lines > 0 do
local inStr = command:match("%b\"\"")

if inStr then
local fn = inStr:sub(2, #inStr - 1)
local asStr = command:match("[aA][sS] (%S+)") or fn:match("[^%.]+")
local fun = inStr:sub(2, #inStr - 1)
local asStr = command:match("[aA][sS] (%S+)") or fun:match("[^%.]+")

local Ihandle = outAPI.open(fn, "rb")
local Ihandle = outAPI.open(fun, "rb")
if Ihandle then
local Idata = Ihandle:read("*all") .. "\n"
local Ilines = {
Expand All @@ -386,7 +386,7 @@ while #lines > 0 do

lines = Ilines
else
erf("Preprocessor parse error: (Line " .. lineI .. ")\nCannot find `" .. fn .. "'\n")
erf("Preprocessor parse error: (Line " .. lineI .. ")\nCannot find `" .. fun .. "'\n")
end
else
erf("Preprocessor parse error: (Line " .. lineI .. ")\nUnknown require strategy\n")
Expand Down Expand Up @@ -469,9 +469,9 @@ while #lines > 0 do
erf("Preprocessor parse error: (Line " .. lineI .. ")\n`if' ppc is disabled\n")
else
local command = trimS(inst:sub(3))
local fn, er = loadStr("return (" .. command .. ")")
local fun, er = loadStr("return (" .. command .. ")")

if not fn then
if not fun then
er = er and er:sub(er:find(":") + 4) or "Invalid conditional"
erf("Preprocessor parse error: (Line " .. lineI .. ")\n" .. er .. "\n")
else
Expand All @@ -481,9 +481,9 @@ while #lines > 0 do
if tonumber(val) then val = tonumber(scope[i][2]) end
fscope[scope[i][1]] = val
end
setfenv(fn, fscope)
setfenv(fun, fscope)

local succ, sret = pcall(fn)
local succ, sret = pcall(fun)

if not succ then
sret = sret and sret:sub(sret:find(":") + 4) or "Invalid conditional"
Expand Down
4 changes: 2 additions & 2 deletions src/styles/xml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function xmlutils.parse(buffer)

local nChar, eChar, propName = buffer:find("([a-zA-Z0-9%_%-%:]+)")
if nChar == 1 then
local nextNtWhite = buffer:find("%S", eChar + 1)
local nextNtWhite, propMatch = (buffer:find("%S", eChar + 1))
if not nextNtWhite then
error("Unexpected EOF")
end
Expand All @@ -127,7 +127,7 @@ function xmlutils.parse(buffer)

buffer = buffer:sub(eqP + 1)

local nextNtWhite, _, propMatch = buffer:find("(%S)")
nextNtWhite, _, propMatch = buffer:find("(%S)")

if tonumber(propMatch) then
-- Gon be a num
Expand Down
14 changes: 7 additions & 7 deletions vendor/k.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ local function url(call)
end

local function api_request(cb, api, data)
local success, url, handle = await(r.request, url(api) .. (api:find("%%?") and "?cc" or "&cc"), {["Content-Type"]="application/json"}, data and json.encode(data))
local success, _url, handle = await(r.request, url(api) .. (api:find("%%?") and "?cc" or "&cc"), {["Content-Type"]="application/json"}, data and json.encode(data))
if success then
cb(success, json.decode(handle.readAll()))
handle.close()
Expand Down Expand Up @@ -245,7 +245,7 @@ wsEvents.failure = function(id)
end

wsEvents.message = function(id, data)
local data = json.decode(data)
data = json.decode(data)
--print("msg:"..tostring(data.ok)..":"..tostring(data.type)..":"..tostring(data.id))
--prints(data)
-- handle events and responses
Expand All @@ -258,7 +258,7 @@ wsEvents.message = function(id, data)
end

if data.event then
local evs = discoverEvents(id, data.event)
evs = discoverEvents(id, data.event)
for i, v in ipairs(evs) do
v(data)
end
Expand Down Expand Up @@ -315,12 +315,12 @@ function connect(cb, privatekey, preconnect)
asserttype(cb, "callback", "function")
asserttype(privatekey, "privatekey", "string", true)
asserttype(preconnect, "preconnect", "function", true)
local url
local wsurl
if privatekey then
local success, auth = await(authorize_websocket, privatekey)
url = success and auth or wsEndpoint
wsurl = success and auth or wsEndpoint
end
local id = w.open(wsEvents, url)
local id = w.open(wsEvents, wsurl)
if preconnect then
preconnect(id, barebonesMixinHandle(id, {}))
end
Expand Down Expand Up @@ -369,7 +369,7 @@ local g = string.gsub
sha256 = loadstring(g(g(g(g(g(g(g(g('Sa=XbandSb=XbxWSc=XlshiftSd=unpackSe=2^32SYf(g,h)Si=g/2^hSj=i%1Ui-j+j*eVSYk(l,m)Sn=l/2^mUn-n%1VSo={0x6a09e667Tbb67ae85T3c6ef372Ta54ff53aT510e527fT9b05688cT1f83d9abT5be0cd19}Sp={0x428a2f98T71374491Tb5c0fbcfTe9b5dba5T3956c25bT59f111f1T923f82a4Tab1c5ed5Td807aa98T12835b01T243185beT550c7dc3T72be5d74T80deb1feT9bdc06a7Tc19bf174Te49b69c1Tefbe4786T0fc19dc6T240ca1ccT2de92c6fT4a7484aaT5cb0a9dcT76f988daT983e5152Ta831c66dTb00327c8Tbf597fc7Tc6e00bf3Td5a79147T06ca6351T14292967T27b70a85T2e1b2138T4d2c6dfcT53380d13T650a7354T766a0abbT81c2c92eT92722c85Ta2bfe8a1Ta81a664bTc24b8b70Tc76c51a3Td192e819Td6990624Tf40e3585T106aa070T19a4c116T1e376c08T2748774cT34b0bcb5T391c0cb3T4ed8aa4aT5b9cca4fT682e6ff3T748f82eeT78a5636fT84c87814T8cc70208T90befffaTa4506cebTbef9a3f7Tc67178f2}SYq(r,q)if e-1-r[1]<q then r[2]=r[2]+1;r[1]=q-(e-1-r[1])-1 else r[1]=r[1]+qVUrVSYs(t)Su=#t;t[#t+1]=0x80;while#t%64~=56Zt[#t+1]=0VSv=q({0,0},u*8)fWw=2,1,-1Zt[#t+1]=a(k(a(v[w]TFF000000),24)TFF)t[#t+1]=a(k(a(v[w]TFF0000),16)TFF)t[#t+1]=a(k(a(v[w]TFF00),8)TFF)t[#t+1]=a(v[w]TFF)VUtVSYx(y,w)Uc(y[w]W0,24)+c(y[w+1]W0,16)+c(y[w+2]W0,8)+(y[w+3]W0)VSYz(t,w,A)SB={}fWC=1,16ZB[C]=x(t,w+(C-1)*4)VfWC=17,64ZSD=B[C-15]SE=b(b(f(B[C-15],7),f(B[C-15],18)),k(B[C-15],3))SF=b(b(f(B[C-2],17),f(B[C-2],19)),k(B[C-2],10))B[C]=(B[C-16]+E+B[C-7]+F)%eVSG,h,H,I,J,j,K,L=d(A)fWC=1,64ZSM=b(b(f(J,6),f(J,11)),f(J,25))SN=b(a(J,j),a(Xbnot(J),K))SO=(L+M+N+p[C]+B[C])%eSP=b(b(f(G,2),f(G,13)),f(G,22))SQ=b(b(a(G,h),a(G,H)),a(h,H))SR=(P+Q)%e;L,K,j,J,I,H,h,G=K,j,J,(I+O)%e,H,h,G,(O+R)%eVA[1]=(A[1]+G)%e;A[2]=(A[2]+h)%e;A[3]=(A[3]+H)%e;A[4]=(A[4]+I)%e;A[5]=(A[5]+J)%e;A[6]=(A[6]+j)%e;A[7]=(A[7]+K)%e;A[8]=(A[8]+L)%eUAVUY(t)t=t W""t=type(t)=="string"and{t:byte(1,-1)}Wt;t=s(t)SA={d(o)}fWw=1,#t,64ZA=z(t,w,A)VU("%08x"):rep(8):format(d(A))V',"S"," local "),"T",",0x"),"U"," return "),"V"," end "),"W","or "),"X","bit32."),"Y","function "),"Z"," do "))()

function makeaddressbyte(byte)
local byte = 48 + math.floor(byte / 7)
byte = 48 + math.floor(byte / 7)
return string.char(byte + 39 > 122 and 101 or byte > 57 and byte + 39 or byte)
end

Expand Down

0 comments on commit a184193

Please sign in to comment.