diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-04-26 06:24:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-26 06:24:07 -0700 |
| commit | c48fac0936f24a5a2dbea9c8379ec9414a45eb8b (patch) | |
| tree | e87f7363131e3e78f6b35ce73dfedb890d70a03d | |
| parent | docs: update configs.md (diff) | |
| download | nvim-lspconfig-c48fac0936f24a5a2dbea9c8379ec9414a45eb8b.tar nvim-lspconfig-c48fac0936f24a5a2dbea9c8379ec9414a45eb8b.tar.gz nvim-lspconfig-c48fac0936f24a5a2dbea9c8379ec9414a45eb8b.tar.bz2 nvim-lspconfig-c48fac0936f24a5a2dbea9c8379ec9414a45eb8b.tar.lz nvim-lspconfig-c48fac0936f24a5a2dbea9c8379ec9414a45eb8b.tar.xz nvim-lspconfig-c48fac0936f24a5a2dbea9c8379ec9414a45eb8b.tar.zst nvim-lspconfig-c48fac0936f24a5a2dbea9c8379ec9414a45eb8b.zip | |
ci: cleanup #3782
| -rw-r--r-- | .github/ci/lint.sh | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/.github/ci/lint.sh b/.github/ci/lint.sh index 4f4f49b5..7af3eb36 100644 --- a/.github/ci/lint.sh +++ b/.github/ci/lint.sh @@ -17,7 +17,7 @@ _fail() { _check_generated_docs() { if ! git diff "${REF_BRANCH}"..."${PR_BRANCH}" --exit-code -- doc/configs.md doc/configs.txt; then _fail '`configs.md` or `configs.txt` will be regenerated by the docgen CI process. Edit the Lua source file instead.' \ - ' For details on generating documentation, see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs' + 'For details on generating documentation, see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#generating-docs' fi } @@ -30,18 +30,14 @@ _check_legacy_configs() { # Enforce buffer-local commands. _check_cmd_buflocal() { if git grep -P 'nvim_create_user_command' -- 'lsp/*.lua' ; then - echo - echo 'Define commands with nvim_buf_create_user_command (buffer-local), not nvim_create_user_command' - exit 1 + _fail 'Define commands with nvim_buf_create_user_command (buffer-local), not nvim_create_user_command' fi } # Check that "@brief" docstring is the first line of each "lsp/*.lua" config. _check_brief_placement() { if find ./lsp -type f -name "*.lua" -exec awk 'NR==1 && !/brief/{print FILENAME}' {} \; | grep --color=never '.' ; then - echo - echo '`@brief` docstring must be at the top of the config source file' - exit 1 + _fail '`@brief` docstring must be at the top of the config source file' fi } @@ -49,37 +45,27 @@ _check_brief_placement() { _check_lsp_cmd_prefix() { local exclude='tinymist' if git grep -P 'nvim_buf_create_user_command' -- 'lsp/*.lua' | grep -v "$exclude" | grep --color -v Lsp ; then - echo - echo 'Command names must start with "Lsp" prefix' - exit 1 + _fail 'Command names must start with "Lsp" prefix' fi } # Enforce client:exec_cmd(). _check_exec_cmd() { if git grep -P 'workspace.executeCommand' -- 'lsp/*.lua' ; then - echo - echo 'Use client:exec_cmd() instead of calling request("workspace/executeCommand") directly. Example: lsp/pyright.lua' - exit 1 + _fail 'Use client:exec_cmd() instead of calling request("workspace/executeCommand") directly. Example: lsp/pyright.lua' fi } # Disallow util functions in Nvim 0.11+ (lsp/) configs. _check_deprecated_in_nvim_0_11() { if git grep -P 'is_descendant' -- 'lsp/*.lua' ; then - echo - echo 'Use vim.fs.relpath() instead of util.path.is_descendant()' - exit 1 + _fail 'Use vim.fs.relpath() instead of util.path.is_descendant()' fi if git grep -P 'search_ancestors' -- 'lsp/*.lua' ; then - echo - echo 'Use vim.iter(vim.fs.parents(fname)):find(…) instead of util.path.search_ancestors(fname,…)' - exit 1 + _fail 'Use vim.iter(vim.fs.parents(fname)):find(…) instead of util.path.search_ancestors(fname,…)' fi if git grep -P 'validate_bufnr' -- 'lsp/*.lua' ; then - echo - echo 'Do not use util.validate_bufnr(). Nvim stdlib already treats bufnr=0 as "current buffer".' - exit 1 + _fail 'Do not use util.validate_bufnr(). Nvim stdlib already treats bufnr=0 as "current buffer".' fi } @@ -88,19 +74,14 @@ _check_deprecated_utils() { SEARCH_PATTERN='(path\.dirname|fn\.cwd)' if git diff --pickaxe-all -U0 -G "${SEARCH_PATTERN}" "${REF_BRANCH}" "${PR_BRANCH}" -- '*.lua' | grep -Ev '(configs|utils)\.lua$' | grep -E "^\+.*${SEARCH_PATTERN}" ; then - echo - echo 'String "dirname" found. There is a high risk that this might contradict the directive:' - echo '"Do not use vim.fn.cwd or util.path.dirname in root_dir".' - echo "see: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#adding-a-server-to-lspconfig." - exit 1 + _fail 'Do not use vim.fn.cwd or util.path.dirname in root_dir.' \ + "See: https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md#new-config" fi SEARCH_PATTERN='(util\.path\.dirname|util\.path\.sanitize|util\.path\.exists|util\.path\.is_file|util\.path\.is_dir|util\.path\.join|util\.path\.iterate_parents|util\.find_mercurial_ancestor|util\.find_node_modules_ancestor|util\.find_package_json_ancestor|util\.find_git_ancestor|util\.get_lsp_clients|util\.get_active_client_by_name)' if git diff --pickaxe-all -U0 -G "${SEARCH_PATTERN}" "${REF_BRANCH}" "${PR_BRANCH}" -- '*.lua' | grep -Ev '\.lua$' | grep -E "^\+.*${SEARCH_PATTERN}" ; then - echo - echo 'Do not use deprecated util functions: '"${SEARCH_PATTERN}" - exit 1 + _fail 'Do not use deprecated util functions: '"${SEARCH_PATTERN}" fi } |
