Add linter

This commit is contained in:
thecraftianman 2024-05-16 13:32:23 -04:00
parent 657993c026
commit 8d17b0dbdd
4 changed files with 54 additions and 4 deletions

17
.github/workflows/glualint.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: GLuaLint
on:
push:
paths:
- 'lua/**'
- '!lua/entities/gmod_wire_expression2/**'
pull_request:
paths:
- 'lua/**'
- '!lua/entities/gmod_wire_expression2/**'
jobs:
Lint:
uses: FPtje/GLuaFixer/.github/workflows/glualint.yml@master
with:
config: "./.glualint.json"

View File

@ -12,9 +12,9 @@ jobs:
- uses: CFC-Servers/gmod-upload@master
with:
id: 3154971187
changelog: "Deployment via Github to latest changes"
changelog: "${{ github.event.head_commit.message }}"
title: "Contraption Framework"
type: "ServerContent"
type: "tool"
tag1: "build"
env:
STEAM_USERNAME: ${{ secrets.ACF_STEAM_ACCOUNT }}

33
.glualint.json Normal file
View File

@ -0,0 +1,33 @@
{
"lint_maxScopeDepth": 10,
"lint_syntaxErrors": true,
"lint_syntaxInconsistencies": true,
"lint_deprecated": true,
"lint_trailingWhitespace": true,
"lint_whitespaceStyle": true,
"lint_beginnerMistakes": true,
"lint_emptyBlocks": true,
"lint_shadowing": false,
"lint_gotos": true,
"lint_doubleNegations": true,
"lint_redundantIfStatements": true,
"lint_redundantParentheses": true,
"lint_duplicateTableKeys": true,
"lint_profanity": true,
"lint_unusedVars": true,
"lint_unusedParameters": true,
"lint_unusedLoopVars": true,
"lint_ignoreFiles": ["lua/entities/gmod_wire_expression2/core/custom/*.lua"],
"prettyprint_spaceAfterParens": false,
"prettyprint_spaceAfterBrackets": false,
"prettyprint_spaceAfterBraces": false,
"prettyprint_spaceAfterLabel": false,
"prettyprint_spaceBeforeComma": false,
"prettyprint_spaceAfterComma": true,
"prettyprint_semicolons": false,
"prettyprint_cStyle": false,
"prettyprint_rejectInvalidCode": false,
"prettyprint_indentation": "\t",
"log_format": "auto"
}

View File

@ -4,7 +4,7 @@ local function floodFill(source, sinkIndex)
local open = source:GetLinks()
while next(open) do
local entIndex, entLink = next(open)
local entIndex = next(open) -- entIndex, entLink
open[entIndex] = nil
closed[entIndex] = true
@ -13,7 +13,7 @@ local function floodFill(source, sinkIndex)
if entIndex == sinkIndex then return true, closed end
for neighborIndex, neighborLink in pairs(Entity(entIndex)._links) do
for neighborIndex, _ in pairs(Entity(entIndex)._links) do -- neighborIndex, neighborLink
if not closed[neighborIndex] then
open[neighborIndex] = true
end