From 738c96a0a87c01fb3701241be17b5b0d308826c2 Mon Sep 17 00:00:00 2001 From: Willem Jan Noort Date: Sun, 9 Jun 2024 13:31:41 +0200 Subject: [PATCH] feat: add typechecks --- .github/workflows/typecheck.yml | 21 +++++++++++++++++++++ .luacheckrc | 3 --- .luarc.json | 7 +++++++ lua/ado/marker.lua | 2 ++ lua/ado/project.lua | 2 +- lua/ado/utils.lua | 3 ++- 6 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/typecheck.yml delete mode 100644 .luacheckrc create mode 100644 .luarc.json diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml new file mode 100644 index 0000000..d80e4ab --- /dev/null +++ b/.github/workflows/typecheck.yml @@ -0,0 +1,21 @@ +name: Type Check Code Base +on: + pull_request: ~ + push: + branches: + - master + +jobs: + build: + name: Type Check Code Base + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Type Check Code Base + uses: mrcjkb/lua-typecheck-action@v0 + with: + directories: lua + configpath: ".luarc.json" diff --git a/.luacheckrc b/.luacheckrc deleted file mode 100644 index 3a09011..0000000 --- a/.luacheckrc +++ /dev/null @@ -1,3 +0,0 @@ -globals = { - "vim", -} diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..5ad79e9 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "runtime.version": "LuaJIT", + "diagnostics.globals": [ + "vim" + ] +} diff --git a/lua/ado/marker.lua b/lua/ado/marker.lua index f8c58d4..b29ae3e 100644 --- a/lua/ado/marker.lua +++ b/lua/ado/marker.lua @@ -7,8 +7,10 @@ local M = { local Path = require("plenary.path") ---Get open file paths with bufnrs +---@diagnostic disable-next-line: undefined-doc-name ---@return table local function get_open_file_paths() + ---@diagnostic disable-next-line: undefined-doc-name ---@type table local open_file_paths = {} local buffers = vim.api.nvim_list_bufs() diff --git a/lua/ado/project.lua b/lua/ado/project.lua index 8d30bbc..6a7b3ab 100644 --- a/lua/ado/project.lua +++ b/lua/ado/project.lua @@ -17,7 +17,7 @@ local function format_project_choice(project) end ---Set project_name in cache file; ----@param project_cache_path Path +---@diagnostic disable-next-line: undefined-doc-name ---@return string|nil err local function set_project_name_cache(project_cache_path) local projects, err = require("ado.api").get_projects() diff --git a/lua/ado/utils.lua b/lua/ado/utils.lua index 063ad01..f050934 100644 --- a/lua/ado/utils.lua +++ b/lua/ado/utils.lua @@ -1,5 +1,6 @@ local M = {} --- Await result of plenary job +---@diagnostic disable-next-line: undefined-doc-name ---@param job Job ---@return unknown function M.await_result(job) @@ -9,7 +10,7 @@ function M.await_result(job) return result end vim.wait(1000, function() - ---@diagnostic disable-next-line: missing-return + ---@diagnostic disable-next-line: missing-return,undefined-field result = job:result() end) end