Add luacheck to main workflow

main
Ensar Sarajčić 2022-04-29 09:46:45 +02:00
parent 6bb3a44580
commit ad23da054c
9 changed files with 45 additions and 22 deletions

View File

@ -54,3 +54,11 @@ jobs:
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
args: --check . args: --check .
luacheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run luacheck
uses: lunarmodules/luacheck@v0.26.0
with:
args: symlinks/config/nvim

View File

@ -0,0 +1,8 @@
-- vim: ft=lua tw=80
globals = {
"vim",
}
exclude_files = {
"plugin/packer_compiled.lua",
}

View File

@ -3,7 +3,7 @@ if require("init.first_load")() then
end end
-- Allow `require('impatient')` to fail, in case plugins are not yet installed -- Allow `require('impatient')` to fail, in case plugins are not yet installed
_ = pcall(require, "impatient") local _ = pcall(require, "impatient")
vim.cmd([[filetype plugin indent on]]) vim.cmd([[filetype plugin indent on]])

View File

@ -14,7 +14,7 @@ local function get_pr_url(...)
-- Remove prefix if it is available, for some of common git services -- Remove prefix if it is available, for some of common git services
local common_services = { "github.com", "bitbucket.org", "gitlab.com" } local common_services = { "github.com", "bitbucket.org", "gitlab.com" }
for k, service in pairs(common_services) do for _, service in pairs(common_services) do
if string.find(origin_url, service, 1, true) then if string.find(origin_url, service, 1, true) then
-- Common mechanism for managing multiple SSH keys -- Common mechanism for managing multiple SSH keys
origin_url = string.gsub(origin_url, "://.*" .. service, "://" .. service) origin_url = string.gsub(origin_url, "://.*" .. service, "://" .. service)

View File

@ -23,6 +23,9 @@ null_ls.setup({
-- Lua -- Lua
null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.stylua,
null_ls.builtins.diagnostics.luacheck.with({
extra_args = { "--config", vim.fn.stdpath("config") .. "/.luacheckrc" },
}),
-- Dart -- Dart
null_ls.builtins.formatting.dart_format, null_ls.builtins.formatting.dart_format,
@ -41,6 +44,7 @@ null_ls.setup({
null_ls.builtins.formatting.trim_whitespace, null_ls.builtins.formatting.trim_whitespace,
null_ls.builtins.hover.dictionary, null_ls.builtins.hover.dictionary,
null_ls.builtins.code_actions.gitsigns, null_ls.builtins.code_actions.gitsigns,
null_ls.builtins.code_actions.refactoring,
}, },
on_attach = function(client) on_attach = function(client)
if client.resolved_capabilities.document_formatting then if client.resolved_capabilities.document_formatting then

View File

@ -4,7 +4,7 @@
local M = {} local M = {}
M.on_attach = function(client, bufnr) M.on_attach = function(_, bufnr)
vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc" vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
-- Lsp keymaps -- Lsp keymaps

View File

@ -9,7 +9,7 @@ end
-- Opens up a new tab if current buffer is not empty -- Opens up a new tab if current buffer is not empty
local function new_tab_if_needed() local function new_tab_if_needed()
if vim.api.nvim_buf_get_name("%") ~= "" then if vim.api.nvim_buf_get_name(0) ~= "" then
-- Current buffer is not empty, open up a new tab -- Current buffer is not empty, open up a new tab
vim.cmd("tabnew") vim.cmd("tabnew")
end end
@ -42,9 +42,9 @@ function M.open_scratch_rest_console()
end end
-- Opens up a rest console which can be saved -- cached by name -- Opens up a rest console which can be saved -- cached by name
function M.open_cached_rest_console(...) function M.open_cached_rest_console(args)
local name = select(1, ...) local name = args[0] or args[1]
if select("#", ...) == 0 then if not name then
name = require("common.projects").get_project_id() name = require("common.projects").get_project_id()
end end
open_cached_rest_console(name) open_cached_rest_console(name)
@ -57,9 +57,9 @@ function M.open_named_cached_rest_console(name)
end end
-- Opens up a rest console based on local file path -- Opens up a rest console based on local file path
function M.open_local_rest_console(...) function M.open_local_rest_console(args)
local file = select(1, ...) local file = args[0] or args[1]
if select("#", ...) == 0 then if not file then
file = "default" file = "default"
end end
open_rest_console(file) open_rest_console(file)

View File

@ -6,7 +6,7 @@ local dap = require("dap")
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = "dap-repl", pattern = "dap-repl",
callback = function(args) callback = function(_)
require("dap.ext.autocompl").attach() require("dap.ext.autocompl").attach()
end, end,
}) })

View File

@ -2,15 +2,18 @@
-- - Vim REST Console setup and extra commands - -- - Vim REST Console setup and extra commands -
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
vim.cmd( local vim_rest_console_extensions = require("vim_rest_console_extensions")
[[command! -nargs=0 ScratchRestConsole :lua require('vim_rest_console_extensions').open_scratch_rest_console()]] vim.api.nvim_create_user_command(
) "ScratchRestConsole",
vim.cmd( vim_rest_console_extensions.open_scratch_rest_console,
[[command! -nargs=? RestConsole :lua require('vim_rest_console_extensions').open_cached_rest_console(<f-args>)]] { nargs = 0 }
)
vim.cmd(
[[command! -nargs=? RestConsoleLocal :lua require('vim_rest_console_extensions').open_local_rest_console(<f-args>)]]
)
vim.cmd(
[[command! -nargs=1 RestConsoleCached :lua require('vim_rest_console_extensions').open_named_cached_rest_console(<f-args>)]]
) )
vim.api.nvim_create_user_command("RestConsole", function(args)
vim_rest_console_extensions.open_cached_rest_console(args.fargs)
end, { nargs = "?" })
vim.api.nvim_create_user_command("RestConsoleLocal", function(args)
vim_rest_console_extensions.open_local_rest_console(args.fargs)
end, { nargs = "?" })
vim.api.nvim_create_user_command("RestConsoleCached", function(args)
vim_rest_console_extensions.open_named_cached_rest_console(args.fargs[0] or args.fargs[1])
end, { nargs = 1 })