Skip to content

Commit

Permalink
Add automatic linting with GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodachi94 committed Dec 10, 2022
1 parent a8421ab commit bf05ba8
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .cc-tweaked.selene.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
base: lua52

globals:
package.cpath:
removed: true
collectgarbage:
removed: true
_HOST:
property: read-only
_CC_DEFAULT_SETTINGS:
property: read-only
_CC_DISABLE_LUA51_FEATURES:
property: read-only
sleep:
property: read-only
args:
- type: number
required: true
write:
property: read-only
args:
- type: string
required: true
printError:
property: read-only
args:
- type: "..."
required: true
read:
property: read-only
args:
- type: string
required: false
- type: table
required: false
- type: function
required: false
- type: string
required: false
colors:
property: read-only
colours:
property: read-only
commands:
property: read-only
disk:
property: read-only
fs:
property: read-only
gps:
property: read-only
help:
property: read-only
http:
property: read-only
io:
property: read-only
keys:
property: read-only
multishell:
property: read-only
os:
property: read-only
paintutils:
property: read-only
parallel:
property: read-only
peripheral:
property: read-only
pocket:
property: read-only
rednet:
property: read-only
redstone:
property: read-only
settings:
property: read-only
shell:
property: read-only
term:
property: read-only
textutils:
property: read-only
turtle:
property: read-only
vector:
property: read-only
window:
property: read-only
41 changes: 41 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Linting

on:
push:
paths: ["**.lua", ".github/workflows/lint.yaml"]
pull_request:
paths: ["**.lua", ".github/workflows/lint.yaml"]
workflow_dispatch:

jobs:
lint-selene:
name: Lint Lua with Selene
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: NTBBloodbath/selene-action@v1.0.0
with:
# Github secret token
token: ${{ secrets.GITHUB_TOKEN }}
# selene arguments
args: . --config .selene.toml
# selene version
version: 0.23.1

# Multiple linters never hurt :)
lint-illuaminate:
name: Lint Lua with Illuaminate
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Lint Lua code
run: |
test -d bin || mkdir bin
test -f bin/illuaminate || wget -q -Obin/illuaminate https://squiddev.cc/illuaminate/linux-x86-64/illuaminate
chmod +x bin/illuaminate
bin/illuaminate lint
5 changes: 5 additions & 0 deletions .selene.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
std = ".cc-tweaked.selene"
exclude = ["./unicorn/semver.lua"]

[lints]
incorrect_standard_library_use = "allow" # Workaround for https://github.com/Kampfkarren/selene/issues/467

0 comments on commit bf05ba8

Please sign in to comment.