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

@ -98,7 +98,7 @@ setup({cfg}) *gitsigns.setup()*
{async}
Parameters: ~
{cfg} (table|nil): Configuration for Gitsigns.
{cfg} (table|nil): Configuration for Gitsigns.
See |gitsigns-usage| for more details.
attach({bufnr}, {ctx}) *gitsigns.attach()*
@ -108,8 +108,8 @@ attach({bufnr}, {ctx}) *gitsigns.attach()*
{async}
Parameters: ~
{bufnr} (integer): Buffer number
{ctx} (table|nil):
{bufnr} (integer): Buffer number
{ctx} (table|nil):
Git context data that may optionally be used to attach to any
buffer that represents a real git object.
• {file}: (string)
@ -130,7 +130,7 @@ detach({bufnr}) *gitsigns.detach()*
provided then the current buffer is used.
Parameters: ~
{bufnr} (integer): Buffer number
{bufnr} (integer): Buffer number
detach_all() *gitsigns.detach_all()*
Detach Gitsigns from all buffers it is attached to.
@ -147,7 +147,7 @@ get_actions() *gitsigns.get_actions()*
Returns: ~
(table|nil): Dictionary of action name to function which when called
(table|nil): Dictionary of action name to function which when called
performs action.
setloclist({nr}, {target}) *gitsigns.setloclist()*
@ -160,9 +160,9 @@ setloclist({nr}, {target}) *gitsigns.setloclist()*
{async}
Parameters: ~
{nr} (integer): Window number or the |window-ID|.
{nr} (integer): Window number or the |window-ID|.
`0` for the current window (default).
{target} (integer|string): See |gitsigns.setqflist()|.
{target} (integer|string): See |gitsigns.setqflist()|.
setqflist({target}, {opts}) *gitsigns.setqflist()*
Populate the quickfix list with hunks. Automatically opens the
@ -172,7 +172,7 @@ setqflist({target}, {opts}) *gitsigns.setqflist()*
{async}
Parameters: ~
{target} (integer|string):
{target} (integer|string):
Specifies which files hunks are collected from.
Possible values.
• [integer]: The buffer with the matching buffer
@ -181,7 +181,7 @@ setqflist({target}, {opts}) *gitsigns.setqflist()*
• `"all"`: All modified files for each git
directory of all attached buffers in addition
to the current working directory.
{opts} (table|nil): Additional options:
{opts} (table|nil): Additional options:
• {use_location_list}: (boolean)
Populate the location list instead of the
quickfix list. Default to `false`.
@ -236,8 +236,8 @@ diffthis({base}, {opts}) *gitsigns.diffthis()*
{async}
Parameters: ~
{base} (string|nil): Revision to diff against. Defaults to index.
{opts} (table|nil): Additional options:
{base} (string|nil): Revision to diff against. Defaults to index.
{opts} (table|nil): Additional options:
• {vertical}: {boolean}. Split window vertically. Defaults to
config.diff_opts.vertical. If running via command line, then
this is taken from the command modifiers.
@ -284,8 +284,8 @@ change_base({base}, {global}) *gitsigns.change_base()*
|gitsigns-revision|.
Parameters: ~
{base} (string|nil): The object/revision to diff against.
{global} (boolean|nil): Change the base of all buffers.
{base} (string|nil): The object/revision to diff against.
{global} (boolean|nil): Change the base of all buffers.
blame_line({opts}) *gitsigns.blame_line()*
Run git blame on the current line and show the results in a
@ -296,7 +296,7 @@ blame_line({opts}) *gitsigns.blame_line()*
{async}
Parameters: ~
{opts} (table|nil): Additional options:
{opts} (table|nil): Additional options:
• {full}: (boolean)
Display full commit message with hunk.
• {ignore_whitespace}: (boolean)
@ -306,11 +306,11 @@ get_hunks({bufnr}) *gitsigns.get_hunks()*
Get hunk array for specified buffer.
Parameters: ~
{bufnr} (integer): Buffer number, if not provided (or 0)
{bufnr} (integer): Buffer number, if not provided (or 0)
will use current buffer.
Returns: ~
(table|nil): Array of hunk objects.
(table|nil): Array of hunk objects.
Each hunk object has keys:
• `"type"`: String with possible values: "add", "change",
"delete"
@ -350,7 +350,7 @@ next_hunk({opts}) *gitsigns.next_hunk()*
at the next hunk.
Parameters: ~
{opts} (table|nil): Configuration table. Keys:
{opts} (table|nil): Configuration table. Keys:
• {wrap}: (boolean)
Whether to loop around file or not. Defaults
to the value 'wrapscan'
@ -402,11 +402,11 @@ reset_hunk({range}, {opts}) *gitsigns.reset_hunk()*
hunk, only the lines within the range will be reset.
Parameters: ~
{range} (table|nil): List-like table of two integers making
{range} (table|nil): List-like table of two integers making
up the line range from which you want to reset the hunks.
If running via command line, then this is taken from the
command modifiers.
{opts} (table|nil): Additional options:
{opts} (table|nil): Additional options:
• {greedy}: (boolean)
Stage all contiguous hunks. Only useful if 'diff_opts'
contains `linematch`. Defaults to `true`.
@ -422,11 +422,11 @@ stage_hunk({range}, {opts}) *gitsigns.stage_hunk()*
{async}
Parameters: ~
{range} (table|nil): List-like table of two integers making
{range} (table|nil): List-like table of two integers making
up the line range from which you want to stage the hunks.
If running via command line, then this is taken from the
command modifiers.
{opts} (table|nil): Additional options:
{opts} (table|nil): Additional options:
• {greedy}: (boolean)
Stage all contiguous hunks. Only useful if 'diff_opts'
contains `linematch`. Defaults to `true`.
@ -435,62 +435,62 @@ toggle_deleted({value}) *gitsigns.toggle_deleted()*
Toggle |gitsigns-config-show_deleted|
Parameters: ~
{value} (boolean|nil): Value to set toggle. If `nil`
{value} (boolean|nil): Value to set toggle. If `nil`
the toggle value is inverted.
Returns: ~
(boolean): Current value of |gitsigns-config-show_deleted|
(boolean): Current value of |gitsigns-config-show_deleted|
toggle_current_line_blame({value}) *gitsigns.toggle_current_line_blame()*
Toggle |gitsigns-config-current_line_blame|
Parameters: ~
{value} (boolean|nil): Value to set toggle. If `nil`
{value} (boolean|nil): Value to set toggle. If `nil`
the toggle value is inverted.
Returns: ~
(boolean): Current value of |gitsigns-config-current_line_blame|
(boolean): Current value of |gitsigns-config-current_line_blame|
toggle_word_diff({value}) *gitsigns.toggle_word_diff()*
Toggle |gitsigns-config-word_diff|
Parameters: ~
{value} (boolean|nil): Value to set toggle. If `nil`
{value} (boolean|nil): Value to set toggle. If `nil`
the toggle value is inverted.
Returns: ~
(boolean): Current value of |gitsigns-config-word_diff|
(boolean): Current value of |gitsigns-config-word_diff|
toggle_linehl({value}) *gitsigns.toggle_linehl()*
Toggle |gitsigns-config-linehl|
Parameters: ~
{value} (boolean|nil): Value to set toggle. If `nil`
{value} (boolean|nil): Value to set toggle. If `nil`
the toggle value is inverted.
Returns: ~
(boolean): Current value of |gitsigns-config-linehl|
(boolean): Current value of |gitsigns-config-linehl|
toggle_numhl({value}) *gitsigns.toggle_numhl()*
Toggle |gitsigns-config-numhl|
Parameters: ~
{value} (boolean|nil): Value to set toggle. If `nil`
{value} (boolean|nil): Value to set toggle. If `nil`
the toggle value is inverted.
Returns: ~
(boolean): Current value of |gitsigns-config-numhl|
(boolean): Current value of |gitsigns-config-numhl|
toggle_signs({value}) *gitsigns.toggle_signs()*
Toggle |gitsigns-config-signbooleancolumn|
Parameters: ~
{value} (boolean|nil): Value to set toggle. If `nil`
{value} (boolean|nil): Value to set toggle. If `nil`
the toggle value is inverted.
Returns: ~
(boolean): Current value of |gitsigns-config-signcolumn|
(boolean): Current value of |gitsigns-config-signcolumn|
==============================================================================

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,