Skip to content

Commit

Permalink
chore: add linting
Browse files Browse the repository at this point in the history
  • Loading branch information
danielefongo committed Apr 24, 2024
1 parent 174040c commit 63b4a4d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,32 @@ jobs:
files: luacov.report.out, luacov.stats.out
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

linting:
runs-on: ubuntu-latest
name: linting

steps:
- name: checkout
uses: actions/checkout@v4

- name: update
run: |
sudo apt-get update
- name: install luacheck
run: |
sudo apt-get update
sudo apt-get install -y luarocks
sudo luarocks install luacheck
- name: run luacheck
run: |
sudo make lint
- name: run stylua
uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --color always --check lua
8 changes: 8 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cache = true

std = luajit
codes = true

read_globals = {
"vim",
}
3 changes: 3 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
test:
bash ./test $(test)

.PHONY: lint
lint:
luacheck lua/microscope

.PHONY: stylua
stylua:
stylua --color always --check lua

.PHONY: stylua-fix
stylua-fix:
stylua lua

.PHONY: testcov
testcov:
TEST_COV=1 $(MAKE) --no-print-directory test
Expand Down
4 changes: 2 additions & 2 deletions lua/microscope/utils/ansiline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ return function(input, truncate_len)
local skipped_chars = 0
local idx = 1

local ansi_start = 1
local ansi_end = 1
local ansi_start
local ansi_end
local new_ansi_end

while true do
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ You can also explore the already published plugins:
luarocks install luacov
luarocks install luacov-console
luarocks install luacov-html
luarocks install luacheck
cargo install stylua
```

- Run tests
Expand All @@ -779,4 +781,6 @@ You can also explore the already published plugins:
make testcov
# with coverage + html report
make testcov-html
# lint + stylua checks
make stylua lint
```

0 comments on commit 63b4a4d

Please sign in to comment.