Skip to content

Commit cc594fb

Browse files
committed
Fix: Improve linting rules for testing and code quality
- Remove ignored whitespace warnings - Add proper luassert method definitions - Configure test file linting specifically - Add specialized settings for testing frameworks - Maintain consistency with other plugins
1 parent 3f1c95e commit cc594fb

1 file changed

Lines changed: 32 additions & 5 deletions

File tree

.luacheckrc

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,46 @@ exclude_files = {
3131
"tests/plenary/*",
3232
}
3333

34+
-- Special configuration for test files
35+
files["tests/**/*.lua"] = {
36+
-- Allow common globals used in testing
37+
globals = {
38+
-- Common testing globals
39+
"describe", "it", "before_each", "after_each", "teardown", "pending", "spy", "stub", "mock",
40+
-- Lua standard utilities used in tests
41+
"print", "dofile",
42+
-- Test helpers
43+
"test", "expect",
44+
-- Global test state (allow modification)
45+
"_G",
46+
},
47+
48+
-- Define fields for assert from luassert
49+
read_globals = {
50+
assert = {
51+
fields = {
52+
"is_true", "is_false", "is_nil", "is_not_nil", "equals",
53+
"same", "near", "matches", "has_error",
54+
"truthy", "falsy", "has", "has_no", "is_string", "is_number",
55+
"is_function", "is_table"
56+
}
57+
}
58+
},
59+
60+
-- For test files only, ignore unused arguments as they're often used for mock callbacks
61+
unused_args = false,
62+
}
63+
3464
-- Allow unused self arguments of methods
3565
self = false
3666

3767
-- Don't report unused arguments/locals
3868
unused_args = false
3969
unused = false
4070

41-
-- Ignore warnings related to whitespace
71+
-- We don't ignore any warnings - all code style issues should be fixed
4272
ignore = {
43-
"611", -- Line contains trailing whitespace
44-
"612", -- Line contains trailing whitespace in a comment
45-
"613", -- Line contains trailing whitespace in a string
46-
"614", -- Line contains only whitespace
73+
-- No ignored warnings
4774
}
4875

4976
-- Maximum line length

0 commit comments

Comments
 (0)