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:
token: ${{ secrets.GITHUB_TOKEN }}
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
-- 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]])

View File

@ -14,7 +14,7 @@ local function get_pr_url(...)
-- Remove prefix if it is available, for some of common git services
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
-- Common mechanism for managing multiple SSH keys
origin_url = string.gsub(origin_url, "://.*" .. service, "://" .. service)

View File

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

View File

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

View File

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

View File

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

View File

@ -2,15 +2,18 @@
-- - Vim REST Console setup and extra commands -
-------------------------------------------------------------------------------
vim.cmd(
[[command! -nargs=0 ScratchRestConsole :lua require('vim_rest_console_extensions').open_scratch_rest_console()]]
)
vim.cmd(
[[command! -nargs=? RestConsole :lua require('vim_rest_console_extensions').open_cached_rest_console(<f-args>)]]
)
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>)]]
local vim_rest_console_extensions = require("vim_rest_console_extensions")
vim.api.nvim_create_user_command(
"ScratchRestConsole",
vim_rest_console_extensions.open_scratch_rest_console,
{ nargs = 0 }
)
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 })