Skip to content

Commit 8d7f1ae

Browse files
committed
chore: fix ci
1 parent be1b55b commit 8d7f1ae

87 files changed

Lines changed: 2512 additions & 1263 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.luacheckrc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ignore = {
1111
"122", -- Indirectly setting a readonly global
1212
"431", -- Shadowing upvalue (acceptable in local scopes)
1313
"512", -- Loop is executed at most once (intentional in utils.object.first)
14+
"631", -- Line too long (stylua handles line length)
1415
}
1516

1617
globals = {
@@ -26,8 +27,12 @@ exclude_files = {
2627
"lua/vgit/vendor/*",
2728
}
2829

29-
files["tests/"] = {
30-
ignore = { "143" },
30+
local test_settings = {
31+
ignore = {
32+
"143", -- accessing undefined field of global (assert.are.same, assert.is_true, etc.)
33+
"211", -- unused variable (common in tests: local eq = ..., local _, err = ...)
34+
"231", -- variable never accessed in for loop (common in destructured returns)
35+
},
3136
read_globals = {
3237
"describe",
3338
"it",
@@ -39,3 +44,6 @@ files["tests/"] = {
3944
"mock",
4045
},
4146
}
47+
48+
files["tests/"] = test_settings
49+
files["lua/**/*_spec.lua"] = test_settings

.styluaignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lua/vgit/features/screens/ProjectDiffView.lua
2+
lua/vgit/git/git_status.lua

lua/vgit/cli/commands/branch_spec.lua

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,24 @@ local eq = assert.are.same
33
-- Mock the event module to avoid async issues in tests
44
local mock_event = {
55
await = function() end,
6-
async = function(fn) return fn end,
7-
debounce = function(fn) return fn, function() end end,
8-
debounce_async = function(fn) return fn, function() end end,
6+
async = function(fn)
7+
return fn
8+
end,
9+
debounce = function(fn)
10+
return fn, function() end
11+
end,
12+
debounce_async = function(fn)
13+
return fn, function() end
14+
end,
915
on = function() end,
1016
emit = function() end,
11-
custom_on = function() return function() end end,
17+
custom_on = function()
18+
return function() end
19+
end,
1220
buffer_on = function() end,
13-
promisify = function(fn) return fn end,
21+
promisify = function(fn)
22+
return fn
23+
end,
1424
group = 'VGitGroup',
1525
register_module = function() end,
1626
}
@@ -51,14 +61,16 @@ describe('branch_command:', function()
5161
{ name = 'feature', hash = 'def456' },
5262
{ name = 'main', hash = 'abc123' },
5363
{ name = 'develop', hash = 'ghi789' },
54-
}, nil
64+
},
65+
nil
5566
end,
5667
current_branch = function()
5768
return 'main', nil
5869
end,
5970
}
6071
end,
61-
}, nil
72+
},
73+
nil
6274
end,
6375
}
6476

@@ -105,7 +117,9 @@ describe('branch_command:', function()
105117

106118
save_package('vgit.core.console')
107119
package.loaded['vgit.core.console'] = {
108-
error = function(msg) error_msg = msg end,
120+
error = function(msg)
121+
error_msg = msg
122+
end,
109123
info = function() end,
110124
}
111125

@@ -133,7 +147,8 @@ describe('branch_command:', function()
133147
end,
134148
}
135149
end,
136-
}, nil
150+
},
151+
nil
137152
end,
138153
}
139154

@@ -145,7 +160,9 @@ describe('branch_command:', function()
145160
save_package('vgit.core.console')
146161
package.loaded['vgit.core.console'] = {
147162
error = function() end,
148-
info = function(msg) info_msg = msg end,
163+
info = function(msg)
164+
info_msg = msg
165+
end,
149166
}
150167

151168
package.loaded['vgit.cli.commands.branch'] = nil
@@ -172,7 +189,8 @@ describe('branch_command:', function()
172189
end,
173190
}
174191
end,
175-
}, nil
192+
},
193+
nil
176194
end,
177195
}
178196

@@ -183,7 +201,9 @@ describe('branch_command:', function()
183201

184202
save_package('vgit.core.console')
185203
package.loaded['vgit.core.console'] = {
186-
error = function(msg) error_msg = msg end,
204+
error = function(msg)
205+
error_msg = msg
206+
end,
187207
info = function() end,
188208
}
189209

lua/vgit/cli/commands/diff.lua

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ local diff_command = {}
1414

1515
local function format_ref_for_display(ref)
1616
-- Only truncate if it looks like a full commit hash (40 hex chars)
17-
if ref:match('^[a-f0-9]+$') and #ref == 40 then
18-
return ref:sub(1, 7)
19-
end
17+
if ref:match('^[a-f0-9]+$') and #ref == 40 then return ref:sub(1, 7) end
2018
return ref
2119
end
2220

@@ -153,9 +151,9 @@ diff_command.execute = event.async(function(args)
153151
opts.ambiguous = nil
154152
end
155153

156-
local base_ref, compare_ref, is_range, ref_err
154+
local base_ref, compare_ref, _, ref_err
157155
if #opts.refs > 0 then
158-
base_ref, compare_ref, is_range, ref_err = normalize_refs(opts.refs)
156+
base_ref, compare_ref, _, ref_err = normalize_refs(opts.refs)
159157
if ref_err then
160158
console.error(ref_err)
161159
return
@@ -231,9 +229,7 @@ diff_command.execute = event.async(function(args)
231229
to = 'index'
232230
-- Look up old_filename from git status for renames
233231
local file_status = git_status.ls(repo:get_path(), filename)
234-
if file_status and file_status.old_filename then
235-
old_filename = file_status.old_filename
236-
end
232+
if file_status and file_status.old_filename then old_filename = file_status.old_filename end
237233
else
238234
-- Unstaged changes: index vs disk (working tree changes)
239235
from = 'index'
@@ -321,9 +317,7 @@ diff_command.execute = event.async(function(args)
321317

322318
local entries = {}
323319
for i = 1, #funcs do
324-
if results[i] then
325-
table.insert(entries, results[i])
326-
end
320+
if results[i] then table.insert(entries, results[i]) end
327321
end
328322

329323
if #entries == 0 then

lua/vgit/cli/commands/show.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ function show_command.parse_args(args)
1919
table.insert(opts.flags, arg)
2020
else
2121
-- First non-flag arg is the commit
22-
if not opts.commit then
23-
opts.commit = arg
24-
end
22+
if not opts.commit then opts.commit = arg end
2523
end
2624
end
2725

2826
-- Default to HEAD if no commit specified
29-
if not opts.commit then
30-
opts.commit = 'HEAD'
31-
end
27+
if not opts.commit then opts.commit = 'HEAD' end
3228

3329
return opts
3430
end
@@ -115,9 +111,7 @@ show_command.execute = event.async(function(args)
115111

116112
local entries = {}
117113
for i = 1, #funcs do
118-
if results[i] then
119-
table.insert(entries, results[i])
120-
end
114+
if results[i] then table.insert(entries, results[i]) end
121115
end
122116

123117
if #entries == 0 then

lua/vgit/cli/commands/status.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ status_command.execute = event.async(function()
3939
local cursor_lnum = Window(0):get_lnum()
4040

4141
local current_filename = nil
42-
if buf_name and buf_name ~= '' then
43-
current_filename = fs.make_relative(repo:get_path(), buf_name)
44-
end
42+
if buf_name and buf_name ~= '' then current_filename = fs.make_relative(repo:get_path(), buf_name) end
4543

4644
local transformed_data = {
4745
type = 'status',

lua/vgit/core/Config.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@ end
1414
function Config:get(key)
1515
assert(type(key) == 'string', 'type error :: expected string')
1616
local value = self.data[key]
17-
if value == nil then
18-
error(string.format('key "%s" does not exist', tostring(key)))
19-
end
17+
if value == nil then error(string.format('key "%s" does not exist', tostring(key))) end
2018

2119
return value
2220
end
2321

2422
function Config:set(key, value)
25-
if self.data[key] == nil then
26-
error(string.format('key "%s" does not exist', tostring(key)))
27-
end
23+
if self.data[key] == nil then error(string.format('key "%s" does not exist', tostring(key))) end
2824
if type(self.data[key]) ~= type(value) then
2925
error(string.format('type error :: expected %s', type(self.data[key])))
3026
end

lua/vgit/core/assertion.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
local assertion = {}
22

33
function assertion.assert(cond, msg)
4-
if not cond then error(debug.traceback(msg)) end
54
if type(cond) == 'function' then cond = cond() end
5+
if not cond then error(debug.traceback(msg)) end
66

77
return assertion
88
end

0 commit comments

Comments
 (0)