Skip to content

Commit

Permalink
Update lint.yml, with linting and formatting with luacheck and stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
cschindlbeck committed Jan 15, 2024
1 parent 1064e39 commit a4fbaa2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
name: lint

on:
pull_request:
branches:
- main
on: [push]
# on:
# pull_request:
# branches:
# - main

jobs:
lint:
runs-on: [ubuntu-latest]
steps:
# - name: Checkout sources
# uses: actions/checkout@v2
# - name: Setup luacheck
# run: |
# sudo apt update &&
# sudo apt install -y lua5.1 luarocks &&
# sudo luarocks install luacheck
# - name: Run luacheck
# run: |
# luacheck lua/*
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v3
- name: Checkout code
uses: actions/checkout@v2
- name: Setup
run: |
sudo apt-get update
sudo apt-get install luarocks
sudo luarocks install luacheck
- name: Lint
run: luacheck lua/

format:
runs-on: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run stylua
uses: JohnnyMorganz/stylua-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes
Expand Down
6 changes: 6 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
globals = {
"vim",
}
-- max_string_line_length = false
max_line_length = 140
exclude_files = { "**/*example.lua" }
4 changes: 4 additions & 0 deletions stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2

0 comments on commit a4fbaa2

Please sign in to comment.