Updated: GLua lint fixing syntax check

This commit is contained in:
Deyan Dobromirov 2020-06-11 18:24:38 +03:00
parent 358aafea6e
commit 6b36a1696e
7 changed files with 31 additions and 34 deletions

View File

@ -4,20 +4,20 @@
"lint_syntaxInconsistencies": true, "lint_syntaxInconsistencies": true,
"lint_deprecated": true, "lint_deprecated": true,
"lint_trailingWhitespace": true, "lint_trailingWhitespace": true,
"lint_whitespaceStyle": true, "lint_whitespaceStyle": false,
"lint_beginnerMistakes": true, "lint_beginnerMistakes": true,
"lint_emptyBlocks": true, "lint_emptyBlocks": true,
"lint_shadowing": true, "lint_shadowing": false,
"lint_gotos": true, "lint_gotos": true,
"lint_doubleNegations": true, "lint_doubleNegations": true,
"lint_redundantIfStatements": true, "lint_redundantIfStatements": false,
"lint_redundantParentheses": true, "lint_redundantParentheses": false,
"lint_duplicateTableKeys": true, "lint_duplicateTableKeys": true,
"lint_profanity": true, "lint_profanity": true,
"lint_unusedVars": true, "lint_unusedVars": false,
"lint_unusedParameters": false, "lint_unusedParameters": false,
"lint_unusedLoopVars": false, "lint_unusedLoopVars": false,
"lint_ignoreFiles": [], "lint_ignoreFiles": ["data/hooks/pre-commit.lua", "lua/entities/gmod_wire_expression2/core/custom/trackasmlib_wire.lua"],
"prettyprint_spaceAfterParens": false, "prettyprint_spaceAfterParens": false,
"prettyprint_spaceAfterBrackets": false, "prettyprint_spaceAfterBrackets": false,

View File

@ -14,4 +14,4 @@ jobs:
wget -O glualint.zip https://github.com/FPtje/GLuaFixer/releases/download/1.11.1/glualint-1.11.1-linux.zip wget -O glualint.zip https://github.com/FPtje/GLuaFixer/releases/download/1.11.1/glualint-1.11.1-linux.zip
unzip glualint.zip unzip glualint.zip
- name: Lint - name: Lint
run: ./glualint . run: ./glualint --config .github/workflows/glualint.json

View File

@ -14,7 +14,7 @@ function trim(s) return s:match("^%s*(.-)%s*$") end
local sLog = tostring(arg[4]):gsub("\\","/") local sLog = tostring(arg[4]):gsub("\\","/")
local fLog, sE = io.open(sLog,"a+") local fLog, sE = io.open(sLog,"a+")
if(fLog) then io.output(fLog) end if(fLog) then io.output(fLog) else io.output("Error: "..sE) end
io.write(fSta:format("START")) io.write(fSta:format("START"))
@ -79,5 +79,3 @@ if(fLog) then
fLog:flush() fLog:flush()
fLog:close() fLog:close()
end end

View File

@ -1,2 +1,6 @@
.git .git
.svn .svn
.github
.gitattributes
.gitignore
data

View File

@ -75,7 +75,7 @@ local gtInitLogs = {"*Init", false, 0}
------ CONFIGURE ASMLIB ------ ------ CONFIGURE ASMLIB ------
asmlib.InitBase("track","assembly") asmlib.InitBase("track","assembly")
asmlib.SetOpVar("TOOL_VERSION","7.611") asmlib.SetOpVar("TOOL_VERSION","7.613")
asmlib.SetIndexes("V" , "x", "y", "z") asmlib.SetIndexes("V" , "x", "y", "z")
asmlib.SetIndexes("A" ,"pitch","yaw","roll") asmlib.SetIndexes("A" ,"pitch","yaw","roll")
asmlib.SetIndexes("WV",1,2,3) asmlib.SetIndexes("WV",1,2,3)
@ -181,8 +181,7 @@ local gsCbcHash = "_init" -- This keeps suffix related to the file
gsVarName = asmlib.GetAsmConvar("maxtrmarg", "NAM") gsVarName = asmlib.GetAsmConvar("maxtrmarg", "NAM")
cvarsRemoveChangeCallback(gsVarName, gsVarName..gsCbcHash) cvarsRemoveChangeCallback(gsVarName, gsVarName..gsCbcHash)
cvarsAddChangeCallback(gsVarName, function(sVar, vOld, vNew) cvarsAddChangeCallback(gsVarName, function(sVar, vOld, vNew)
local nM = (tonumber(vNew) or 0) local nM = (tonumber(vNew) or 0); nM = ((nM > 0) and nM or 0)
nM = ((nM > 0) and nM or 0)
asmlib.SetOpVar("TRACE_MARGIN", nM) asmlib.SetOpVar("TRACE_MARGIN", nM)
end, gsVarName..gsCbcHash) end, gsVarName..gsCbcHash)
@ -432,11 +431,10 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
local scrW, scrH = surfaceScreenWidth(), surfaceScreenHeight() local scrW, scrH = surfaceScreenWidth(), surfaceScreenHeight()
local actMonitor = asmlib.MakeScreen(0,0,scrW,scrH,conPalette,"GAME") local actMonitor = asmlib.MakeScreen(0,0,scrW,scrH,conPalette,"GAME")
if(not actMonitor) then asmlib.LogInstance("Invalid screen",gtArgsLogs); return nil end if(not actMonitor) then asmlib.LogInstance("Invalid screen",gtArgsLogs); return nil end
local vBs = asmlib.NewXY(4,4) local vBs, nR = asmlib.NewXY(4,4), (gnRatio-1)
local nN = conWorkMode:GetSize() local nN = conWorkMode:GetSize()
local nDr = asmlib.GetOpVar("DEG_RAD") local nDr = asmlib.GetOpVar("DEG_RAD")
local sM = asmlib.GetOpVar("MISS_NOAV") local sM = asmlib.GetOpVar("MISS_NOAV")
local nR = (asmlib.GetOpVar("GOLDEN_RATIO")-1)
local vCn = asmlib.NewXY(mathFloor(scrW/2),mathFloor(scrH/2)) local vCn = asmlib.NewXY(mathFloor(scrW/2),mathFloor(scrH/2))
-- Calculate dependent parameters -- Calculate dependent parameters
local vFr = asmlib.NewXY(vCn.y*nR) -- Far radius vector local vFr = asmlib.NewXY(vCn.y*nR) -- Far radius vector
@ -498,9 +496,8 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
function(oPly,oCom,oArgs) gtArgsLogs[1] = "*OPEN_EXTERNDB" function(oPly,oCom,oArgs) gtArgsLogs[1] = "*OPEN_EXTERNDB"
local scrW = surfaceScreenWidth() local scrW = surfaceScreenWidth()
local scrH = surfaceScreenHeight() local scrH = surfaceScreenHeight()
local nRat = asmlib.GetOpVar("GOLDEN_RATIO")
local sVer = asmlib.GetOpVar("TOOL_VERSION") local sVer = asmlib.GetOpVar("TOOL_VERSION")
local xyPos, nAut = asmlib.NewXY(scrW/4,scrH/4), (nRat - 1) local xyPos, nAut = asmlib.NewXY(scrW/4,scrH/4), (gnRatio - 1)
local xyDsz, xyTmp = asmlib.NewXY(5,5), asmlib.NewXY() local xyDsz, xyTmp = asmlib.NewXY(5,5), asmlib.NewXY()
local xySiz = asmlib.NewXY(nAut * scrW, nAut * scrH) local xySiz = asmlib.NewXY(nAut * scrW, nAut * scrH)
local pnFrame = vguiCreate("DFrame"); if(not IsValid(pnFrame)) then local pnFrame = vguiCreate("DFrame"); if(not IsValid(pnFrame)) then
@ -542,7 +539,7 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
xyPos.x, xyPos.y = xyDsz.x, xyDsz.y xyPos.x, xyPos.y = xyDsz.x, xyDsz.y
xySiz.x = (nW - 6 * xyDsz.x) xySiz.x = (nW - 6 * xyDsz.x)
xySiz.y = ((nH - 6 * xyDsz.y) - 52) xySiz.y = ((nH - 6 * xyDsz.y) - 52)
local wAct = mathFloor(((nRat - 1) / 6) * xySiz.x) local wAct = mathFloor(((gnRatio - 1) / 6) * xySiz.x)
local wUse = mathFloor(xySiz.x - wAct) local wUse = mathFloor(xySiz.x - wAct)
local pnListView = vguiCreate("DListView") local pnListView = vguiCreate("DListView")
if(not IsValid(pnListView)) then pnFrame:Close() if(not IsValid(pnListView)) then pnFrame:Close()
@ -724,7 +721,6 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
------ Screen resolution and configuration ------- ------ Screen resolution and configuration -------
local scrW = surfaceScreenWidth() local scrW = surfaceScreenWidth()
local scrH = surfaceScreenHeight() local scrH = surfaceScreenHeight()
local nRatio = asmlib.GetOpVar("GOLDEN_RATIO")
local sVersion = asmlib.GetOpVar("TOOL_VERSION") local sVersion = asmlib.GetOpVar("TOOL_VERSION")
local xyZero = {x = 0, y = 20} -- The start location of left-top local xyZero = {x = 0, y = 20} -- The start location of left-top
local xyDelta = {x = 10, y = 10} -- Distance between panels local xyDelta = {x = 10, y = 10} -- Distance between panels
@ -732,9 +728,9 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
local xyPos = {x = 0, y = 0} -- Current panel position local xyPos = {x = 0, y = 0} -- Current panel position
local xyTmp = {x = 0, y = 0} -- Temporary coordinate local xyTmp = {x = 0, y = 0} -- Temporary coordinate
------------ Frame -------------- ------------ Frame --------------
xySiz.x = (scrW / nRatio) -- This defines the size of the frame xySiz.x = (scrW / gnRatio) -- This defines the size of the frame
xyPos.x, xyPos.y = (scrW / 4), (scrH / 4) xyPos.x, xyPos.y = (scrW / 4), (scrH / 4)
xySiz.y = mathFloor(xySiz.x / (1 + nRatio)) xySiz.y = mathFloor(xySiz.x / (1 + gnRatio))
pnFrame:SetTitle(asmlib.GetPhrase("tool."..gsToolNameL..".pn_routine_hd").." "..oPly:Nick().." {"..sVersion.."}") pnFrame:SetTitle(asmlib.GetPhrase("tool."..gsToolNameL..".pn_routine_hd").." "..oPly:Nick().." {"..sVersion.."}")
pnFrame:SetVisible(true) pnFrame:SetVisible(true)
pnFrame:SetDraggable(true) pnFrame:SetDraggable(true)
@ -748,8 +744,8 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
end end
------------ Button -------------- ------------ Button --------------
xyTmp.x, xyTmp.y = pnFrame:GetSize() xyTmp.x, xyTmp.y = pnFrame:GetSize()
xySiz.x = (xyTmp.x / (8.5 * nRatio)) -- Display properly the name xySiz.x = (xyTmp.x / (8.5 * gnRatio)) -- Display properly the name
xySiz.y = (xySiz.x / (1.5 * nRatio)) -- Used by combo-box and text-box xySiz.y = (xySiz.x / (1.5 * gnRatio)) -- Used by combo-box and text-box
xyPos.x = xyZero.x + xyDelta.x xyPos.x = xyZero.x + xyDelta.x
xyPos.y = xyZero.y + xyDelta.y xyPos.y = xyZero.y + xyDelta.y
local pnButton = vguiCreate("DButton") local pnButton = vguiCreate("DButton")
@ -766,7 +762,7 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
xyPos.x, xyPos.y = pnButton:GetPos() xyPos.x, xyPos.y = pnButton:GetPos()
xyTmp.x, xyTmp.y = pnButton:GetSize() xyTmp.x, xyTmp.y = pnButton:GetSize()
xyPos.x = xyPos.x + xyTmp.x + xyDelta.x xyPos.x = xyPos.x + xyTmp.x + xyDelta.x
xySiz.x, xySiz.y = (nRatio * xyTmp.x), xyTmp.y xySiz.x, xySiz.y = (gnRatio * xyTmp.x), xyTmp.y
local pnComboBox = vguiCreate("DComboBox") local pnComboBox = vguiCreate("DComboBox")
if(not IsValid(pnComboBox)) then pnFrame:Close() if(not IsValid(pnComboBox)) then pnFrame:Close()
asmlib.LogInstance("Combo invalid",gtArgsLogs); return nil end asmlib.LogInstance("Combo invalid",gtArgsLogs); return nil end
@ -788,7 +784,7 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
------------ ModelPanel -------------- ------------ ModelPanel --------------
xyTmp.x, xyTmp.y = pnFrame:GetSize() xyTmp.x, xyTmp.y = pnFrame:GetSize()
xyPos.x, xyPos.y = pnComboBox:GetPos() xyPos.x, xyPos.y = pnComboBox:GetPos()
xySiz.x = (xyTmp.x / (1.9 * nRatio)) -- Display the model properly xySiz.x = (xyTmp.x / (1.9 * gnRatio)) -- Display the model properly
xyPos.x = xyTmp.x - xySiz.x - xyDelta.x xyPos.x = xyTmp.x - xySiz.x - xyDelta.x
xySiz.y = xyTmp.y - xyPos.y - xyDelta.y xySiz.y = xyTmp.y - xyPos.y - xyDelta.y
-------------------------------------- --------------------------------------
@ -866,7 +862,7 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
pnListView.OnRowSelected = function(pnSelf, nIndex, pnLine) gtArgsLogs[1] = "OPEN_FRAME.ListView" pnListView.OnRowSelected = function(pnSelf, nIndex, pnLine) gtArgsLogs[1] = "OPEN_FRAME.ListView"
local uiMod = tostring(pnLine:GetColumnText(5) or asmlib.GetOpVar("MISS_NOMD")) -- Actually the model in the table local uiMod = tostring(pnLine:GetColumnText(5) or asmlib.GetOpVar("MISS_NOMD")) -- Actually the model in the table
local uiAct = (tonumber(pnLine:GetColumnText(2)) or 0); pnModelPanel:SetModel(uiMod) -- Active points amount local uiAct = (tonumber(pnLine:GetColumnText(2)) or 0); pnModelPanel:SetModel(uiMod) -- Active points amount
local uiBox = asmlib.CacheBoxLayout(pnModelPanel:GetEntity(),0,nRatio,nRatio-1); if(not asmlib.IsHere(uiBox)) then local uiBox = asmlib.CacheBoxLayout(pnModelPanel:GetEntity(),0,gnRatio,gnRatio-1); if(not asmlib.IsHere(uiBox)) then
asmlib.LogInstance("ListView.OnRowSelected Box invalid for <"..uiMod..">",gtArgsLogs); return nil end asmlib.LogInstance("ListView.OnRowSelected Box invalid for <"..uiMod..">",gtArgsLogs); return nil end
pnModelPanel:SetLookAt(uiBox.Eye); pnModelPanel:SetCamPos(uiBox.Cam) pnModelPanel:SetLookAt(uiBox.Eye); pnModelPanel:SetCamPos(uiBox.Cam)
local pointid, pnextid = asmlib.GetAsmConvar("pointid","INT"), asmlib.GetAsmConvar("pnextid","INT") local pointid, pnextid = asmlib.GetAsmConvar("pointid","INT"), asmlib.GetAsmConvar("pnextid","INT")

View File

@ -112,7 +112,7 @@ local timerStart = timer and timer.Start
local timerSimple = timer and timer.Simple local timerSimple = timer and timer.Simple
local timerExists = timer and timer.Exists local timerExists = timer and timer.Exists
local timerCreate = timer and timer.Create local timerCreate = timer and timer.Create
local timerDestroy = timer and timer.Destroy local timerRemove = timer and timer.Remove
local tableEmpty = table and table.Empty local tableEmpty = table and table.Empty
local tableMaxn = table and table.maxn local tableMaxn = table and table.maxn
local tableGetKeys = table and table.GetKeys local tableGetKeys = table and table.GetKeys
@ -2165,7 +2165,7 @@ function CreateTable(sTable,defTab,bDelete,bReload)
timerCreate(tmID, tmLif, 1, function() timerCreate(tmID, tmLif, 1, function()
LogInstance("["..tmID.."]("..tmLif..") > Dead",tabDef.Nick) LogInstance("["..tmID.."]("..tmLif..") > Dead",tabDef.Nick)
if(tmDie) then oSpot[kKey] = nil; LogInstance("Killed <"..kKey..">",tabDef.Nick) end if(tmDie) then oSpot[kKey] = nil; LogInstance("Killed <"..kKey..">",tabDef.Nick) end
timerStop(tmID); timerDestroy(tmID) timerStop(tmID); timerRemove(tmID)
if(tmCol) then collectgarbage(); LogInstance("Garbage collected",tabDef.Nick) end if(tmCol) then collectgarbage(); LogInstance("Garbage collected",tabDef.Nick) end
end); timerStart(tmID); return oSpot[kKey] end); timerStart(tmID); return oSpot[kKey]
else LogInstance("Mode mismatch <"..smTM..">",tabDef.Nick); return oSpot[kKey] end else LogInstance("Mode mismatch <"..smTM..">",tabDef.Nick); return oSpot[kKey] end
@ -3018,7 +3018,7 @@ function SynchronizeDSV(sTable, tData, bRepl, sPref, sDelim)
if(bRepl) then -- Replace the data when enabled overwrites the file data if(bRepl) then -- Replace the data when enabled overwrites the file data
if(tData[vK]) then -- Update the file with the new data if(tData[vK]) then -- Update the file with the new data
fData[vK] = tRec; fData[vK].Size = #tRec end fData[vK] = tRec; fData[vK].Size = #tRec end
else --[[ Do not modify fData ]] end end
end end
local tSort = Sort(tableGetKeys(fData)); if(not tSort) then local tSort = Sort(tableGetKeys(fData)); if(not tSort) then
LogInstance("("..fPref.."@"..sTable..") Sorting failed"); return false end LogInstance("("..fPref.."@"..sTable..") Sorting failed"); return false end

View File

@ -451,14 +451,13 @@ end
function TOOL:GetWorkingMode() -- Put cases in new mode resets here function TOOL:GetWorkingMode() -- Put cases in new mode resets here
local workmode = mathClamp(self:GetClientNumber("workmode") or 0, 1, conWorkMode:GetSize()) local workmode = mathClamp(self:GetClientNumber("workmode") or 0, 1, conWorkMode:GetSize())
-- Perform various actions to stabilize data across working modes -- Perform various actions to stabilize data across working modes
if (workmode == 1) then self:IntersectClear(true) -- Reset ray list in snap mode if(workmode == 1) then self:IntersectClear(true) end -- Reset ray list in snap mode
elseif(workmode == 2) then --[[ Nothing to reset in intersect mode ]] end
return workmode, tostring(conWorkMode:Select(workmode) or gsNoAV):sub(1,6) return workmode, tostring(conWorkMode:Select(workmode) or gsNoAV):sub(1,6)
end -- Reset settings server-side where available and return the value end -- Reset settings server-side where available and return the value
function TOOL:GetStatus(stTr,vMsg,hdEnt) function TOOL:GetStatus(stTr,vMsg,hdEnt)
local iMaxlog = asmlib.GetOpVar("LOG_MAXLOGS") local iMaxlog = asmlib.GetOpVar("LOG_MAXLOGS")
if(not (iMaxlog > 0)) then return "Status N/A" end if(iMaxlog <= 0) then return "Status N/A" end
local ply, sDelim = self:GetOwner(), "\n" local ply, sDelim = self:GetOwner(), "\n"
local iCurLog = asmlib.GetOpVar("LOG_CURLOGS") local iCurLog = asmlib.GetOpVar("LOG_CURLOGS")
local bFleLog = asmlib.IsFlag("en_logging_file") local bFleLog = asmlib.IsFlag("en_logging_file")