build: add doc and lint check

This commit is contained in:
Lewis Russell 2023-09-23 11:01:18 +01:00 committed by Lewis Russell
parent bd0f4d518d
commit e308a4f5dd
5 changed files with 101 additions and 44 deletions

View File

@ -21,7 +21,7 @@ jobs:
matrix:
neovim_branch:
- 'v0.8.3'
- 'v0.9.1'
- 'v0.9.2'
- 'nightly'
env:
@ -42,3 +42,27 @@ jobs:
- name: Run Test
run: make test
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download stylua
run: make stylua
- name: Lint
run: make stylua-check
doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Nvim
run: make nvim
- name: Doc Check
run: make doc-check

View File

@ -7,11 +7,15 @@ NVIM_RUNNER_VERSION := v0.9.1
NVIM_TEST_VERSION ?= v0.9.1
ifeq ($(shell uname -s),Darwin)
NVIM_PLATFORM ?= macos
UNAME ?= MACOS
else
NVIM_PLATFORM ?= linux64
UNAME ?= LINUX
endif
NVIM_PLATFORM_MACOS := macos
NVIM_PLATFORM_LINUX := linux64
NVIM_PLATFORM ?= $(NVIM_PLATFORM_$(UNAME))
NVIM_URL := https://github.com/neovim/neovim/releases/download
NVIM_RUNNER := nvim-runner-$(NVIM_RUNNER_VERSION)
@ -60,9 +64,38 @@ test: $(NVIM_RUNNER) $(NVIM_TEST) .luarocks/bin/busted
-@stty sane
.PHONY: gen_help
gen_help:
@./gen_help.lua
gen_help: $(NVIM_RUNNER)
@$(NVIM_RUNNER)/bin/nvim -l ./gen_help.lua
@echo Updated help
STYLUA_PLATFORM_MACOS := macos-aarch64
STYLUA_PLATFORM_LINUX := linux-x86_64
STYLUA_PLATFORM := $(STYLUA_PLATFORM_$(UNAME))
STYLUA_VERSION := v0.18.2
STYLUA_ZIP := stylua-$(STYLUA_PLATFORM).zip
STYLUA_URL_BASE := https://github.com/JohnnyMorganz/StyLua/releases/download
STYLUA_URL := $(STYLUA_URL_BASE)/$(STYLUA_VERSION)/$(STYLUA_ZIP)
.INTERMEDIATE: $(STYLUA_ZIP)
$(STYLUA_ZIP):
wget $(STYLUA_URL)
stylua: $(STYLUA_ZIP)
unzip $<
.PHONY: stylua-check
stylua-check: stylua
./stylua --check lua/**/*.lua
.PHONY: stylua-run
stylua-run: stylua
./stylua lua/**/*.lua lua/*.lua
.PHONY: build
build: gen_help
build: gen_help stylua-run
.PHONY: doc-check
doc-check: gen_help
git diff --exit-code -- doc

View File

@ -220,7 +220,7 @@ local function render_param_or_return(name, ty, desc, name_pad)
local r = {} --- @type string[]
local desc1 = desc[1] == '' and '' or ' ' .. desc[1]
r[#r + 1] = string.format(' %s(%s): %s', name_str, ty, desc1)
r[#r + 1] = string.format(' %s(%s):%s', name_str, ty, desc1)
local remain_desc = trim_lines(vim.list_slice(desc, 2))
for _, d in ipairs(remain_desc) do

View File

@ -1105,7 +1105,7 @@ local function hunks_to_qflist(buf_or_filename, hunks, qflist)
end
end
---@param target? 'all'|'attached'|integer
---@param target 'all'|'attached'|integer|nil
---@return table[]?
local function buildqflist(target)
target = target or current_buf()
@ -1160,7 +1160,7 @@ end
--- Attributes: ~
--- {async}
---
--- @param target? integer|string
--- @param target integer|string
--- Specifies which files hunks are collected from.
--- Possible values.
--- • [integer]: The buffer with the matching buffer
@ -1225,9 +1225,9 @@ end
--- Attributes: ~
--- {async}
---
--- @param nr? integer Window number or the |window-ID|.
--- @param nr integer Window number or the |window-ID|.
--- `0` for the current window (default).
--- @param target? integer|string See |gitsigns.setqflist()|.
--- @param target integer|string See |gitsigns.setqflist()|.
M.setloclist = function(nr, target)
M.setqflist(target, {
nr = nr,