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 18, 2024
1 parent 2a46b78 commit 7f474a0
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 44 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" }
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ repos:
args: ["--write-changes"]
exclude: CHANGELOG\.rst|\.(svg|pyc|drawio|dcf|eds)$|lazy-lock.json|example.lua

# - repo: https://github.com/Calinou/pre-commit-luacheck
# rev: v1.0.0
# hooks:
# - id: luacheck
- repo: https://github.com/Calinou/pre-commit-luacheck
rev: v1.0.0
hooks:
- id: luacheck

# - repo: https://github.com/JohnnyMorganz/StyLua
# rev: v0.19.1
# hooks:
# - id: stylua # or stylua-system / stylua-github
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.19.1
hooks:
- id: stylua # or stylua-system / stylua-github

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.38.0
Expand Down
2 changes: 1 addition & 1 deletion lua/config/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup

-- hightlight on yank
-- highlight on yank
autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
Expand Down
38 changes: 19 additions & 19 deletions lua/config/general.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ vim.g.loaded_netrw = 1 -- disable netrw
-- opt
local options = {
clipboard = "unnamedplus", -- connection to the system clipboard
colorcolumn = "120", -- show vertical column
expandtab = true, -- enable the use of space in tab
hlsearch = true, --
incsearch = true, --
ignorecase = true, -- case insensitive searching
number = true, -- show line numbers
relativenumber = false, -- relative numbers
scrolloff = 15, -- stop scrolling at the top and bottom until the end
shiftwidth = 2, -- number of spaces in indentation
sidescrolloff = 8, -- same for the sides
smartindent = true, --
softtabstop = 2, --
signcolumn = "yes", --
swapfile = false, -- no annoying swap file
tabstop = 2, -- number of spaces for tab
termguicolors = true, --
undofile = true, --
updatetime = 50, --
wrap = false, --
colorcolumn = "120", -- show vertical column
expandtab = true, -- enable the use of space in tab
hlsearch = true, --
incsearch = true, --
ignorecase = true, -- case insensitive searching
number = true, -- show line numbers
relativenumber = false, -- relative numbers
scrolloff = 15, -- stop scrolling at the top and bottom until the end
shiftwidth = 2, -- number of spaces in indentation
sidescrolloff = 8, -- same for the sides
smartindent = true, --
softtabstop = 2, --
signcolumn = "yes", --
swapfile = false, -- no annoying swap file
tabstop = 2, -- number of spaces for tab
termguicolors = true, --
undofile = true, --
updatetime = 50, --
wrap = false, --
}

for k, v in pairs(options) do
Expand Down
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 7f474a0

Please sign in to comment.