Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Merge pull request #10 from charles-mills/prev #21

Merge pull request #10 from charles-mills/prev

Merge pull request #10 from charles-mills/prev #21

Workflow file for this run

name: GLuaLint
on:
push:
branches:
- main
paths:
- '**.lua'
pull_request:
types: [closed]
branches:
- main
paths:
- '**.lua'
jobs:
lint:
# Only run if PR was merged or direct push to main
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install GLuaFixer
run: |
wget https://github.com/FPtje/GLuaFixer/releases/download/1.29.0/glualint-1.29.0-x86_64-linux.zip
unzip glualint-1.29.0-x86_64-linux.zip
chmod +x glualint
sudo mv glualint /usr/local/bin/
- name: Create GLuaFixer config
run: |
cat > .glualint.json << 'EOF'
{
"lint_maxScopeDepth": 7,
"lint_syntaxErrors": true,
"lint_syntaxInconsistencies": true,
"lint_deprecated": true,
"lint_trailingWhitespace": true,
"lint_whitespaceStyle": true,
"lint_beginnerMistakes": true,
"lint_emptyBlocks": true,
"lint_shadowing": true,
"lint_gotos": true,
"lint_goto_identifier": 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_inconsistentVariableStyle": false,
"lint_spaceBeforeComma": false,
"lint_spaceAfterComma": true,
"lint_spaceBetweenParens": false,
"lint_spaceBetweenBrackets": false,
"lint_spaceBetweenBraces": false,
"lint_ignoreFiles": ["lua/entities/gmod_wire_expression2/core/custom/*.lua", "lua/includes/modules/pon.lua", "lua/radio/client/stations/*.lua"],
"prettyprint_spaceBetweenParens": false,
"prettyprint_spaceBetweenBrackets": false,
"prettyprint_spaceBetweenBraces": false,
"prettyprint_spaceAfterLabel": false,
"prettyprint_spaceBeforeComma": false,
"prettyprint_spaceAfterComma": true,
"prettyprint_semicolons": false,
"prettyprint_cStyle": false,
"prettyprint_removeRedundantParens": true,
"prettyprint_minimizeParens": false,
"prettyprint_assumeOperatorAssociativity": true,
"prettyprint_indentation": " ",
"log_format": "github"
}
EOF
- name: Run GLuaFixer
run: |
# Create logs directory
mkdir -p logs
# Process each file
find lua -name "*.lua" -not -path "lua/radio/client/stations/*" | while read -r file; do
echo "Linting $file"
glualint "$file" 2> "logs/$(basename "$file").log" || echo "Linting failed for $file"
done
- name: Upload error logs
if: always()
uses: actions/upload-artifact@v3
with:
name: glualint-logs
path: logs/
retention-days: 5