feat(ci): add lua static analyzer (#438)
This commit is contained in:
parent
8dd5db8923
commit
55c85692bf
@ -1,4 +1,4 @@
|
||||
name: Stylua Check
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -9,7 +9,8 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
format:
|
||||
stylua:
|
||||
name: Check Lua style
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@ -18,3 +19,13 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: latest
|
||||
args: --check ./lua/
|
||||
luacheck:
|
||||
name: Lint Lua
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Luacheck linter
|
||||
uses: lunarmodules/luacheck@v1
|
||||
with:
|
||||
args: ./lua/
|
@ -100,9 +100,6 @@ local conflict_middle = "^======="
|
||||
local conflict_end = "^>>>>>>>"
|
||||
local conflict_ancestor = "^|||||||"
|
||||
|
||||
local DEFAULT_CURRENT_BG_COLOR = 4218238 -- #405d7e
|
||||
local DEFAULT_INCOMING_BG_COLOR = 3229523 -- #314753
|
||||
local DEFAULT_ANCESTOR_BG_COLOR = 6824314 -- #68217A
|
||||
-----------------------------------------------------------------------------//
|
||||
|
||||
--- @return table<string, ConflictBufferCache>
|
||||
@ -340,12 +337,6 @@ local function register_cursor_move_events(bufnr)
|
||||
Config.diff.mappings.prev,
|
||||
Config.diff.mappings.next
|
||||
)
|
||||
local win_width = api.nvim_win_get_width(0)
|
||||
local col = win_width - #hint - math.ceil(win_width * 0.3) - 4
|
||||
|
||||
if col < 0 then
|
||||
col = 0
|
||||
end
|
||||
|
||||
show_keybinding_hint_extmark_id = api.nvim_buf_set_extmark(bufnr, KEYBINDING_NAMESPACE, lnum - 1, -1, {
|
||||
hl_group = "Keyword",
|
||||
@ -642,14 +633,14 @@ function M.choose(side)
|
||||
vim.defer_fn(function()
|
||||
local start = api.nvim_buf_get_mark(0, "<")[1]
|
||||
local finish = api.nvim_buf_get_mark(0, ">")[1]
|
||||
local position = find_position(bufnr, function(line, pos)
|
||||
local position = find_position(bufnr, function(_, pos)
|
||||
local left = pos.current.range_start >= start - 1
|
||||
local right = pos.incoming.range_end <= finish + 1
|
||||
return left and right
|
||||
end)
|
||||
while position ~= nil do
|
||||
M.process_position(bufnr, side, position, false)
|
||||
position = find_position(bufnr, function(line, pos)
|
||||
position = find_position(bufnr, function(_, pos)
|
||||
local left = pos.current.range_start >= start - 1
|
||||
local right = pos.incoming.range_end <= finish + 1
|
||||
return left and right
|
||||
@ -674,7 +665,7 @@ function M.choose(side)
|
||||
while pos ~= nil do
|
||||
M.process_position(bufnr, "theirs", pos, false)
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
pos = find_position(bufnr, function(line, pos)
|
||||
pos = find_position(bufnr, function(line, pos_)
|
||||
return true
|
||||
end)
|
||||
end
|
||||
|
@ -634,7 +634,7 @@ function Sidebar:render_input()
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
if _G.MiniIcons ~= nil then
|
||||
---@diagnostic disable-next-line: undefined-global
|
||||
icon, _, _ = MiniIcons.get("filetype", filetype)
|
||||
icon, _, _ = MiniIcons.get("filetype", filetype) -- luacheck: ignore
|
||||
else
|
||||
local ok, devicons = pcall(require, "nvim-web-devicons")
|
||||
if ok then
|
||||
@ -1571,14 +1571,13 @@ function Sidebar:create_input()
|
||||
end
|
||||
|
||||
function Sidebar:get_selected_code_size()
|
||||
local selected_code_lines_count = 0
|
||||
local selected_code_max_lines_count = 10
|
||||
|
||||
local selected_code_size = 0
|
||||
|
||||
if self.code.selection ~= nil then
|
||||
local selected_code_lines = vim.split(self.code.selection.content, "\n")
|
||||
selected_code_lines_count = #selected_code_lines
|
||||
local selected_code_lines_count = #selected_code_lines
|
||||
selected_code_size = math.min(selected_code_lines_count, selected_code_max_lines_count)
|
||||
end
|
||||
|
||||
|
@ -190,7 +190,7 @@ function M.get_visual_selection_and_range()
|
||||
start_line, end_line = end_line, start_line
|
||||
start_col, end_col = end_col, start_col
|
||||
end
|
||||
local content = ""
|
||||
local content = "" -- luacheck: ignore
|
||||
local range = Range.new({ line = start_line, col = start_col }, { line = end_line, col = end_col })
|
||||
-- Check if it's a single-line selection
|
||||
if start_line == end_line then
|
||||
@ -221,11 +221,11 @@ end
|
||||
|
||||
---Wrapper around `api.nvim_buf_get_lines` which defaults to the current buffer
|
||||
---@param start integer
|
||||
---@param _end integer
|
||||
---@param end_ integer
|
||||
---@param buf integer?
|
||||
---@return string[]
|
||||
function M.get_buf_lines(start, _end, buf)
|
||||
return api.nvim_buf_get_lines(buf or 0, start, _end, false)
|
||||
function M.get_buf_lines(start, end_, buf)
|
||||
return api.nvim_buf_get_lines(buf or 0, start, end_, false)
|
||||
end
|
||||
|
||||
---Get cursor row and column as (1, 0) based
|
||||
|
Loading…
x
Reference in New Issue
Block a user