Skip to content

Commit 789eb98

Browse files
committed
fix lint issues
1 parent f257168 commit 789eb98

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

lua/gh-co/co.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ end
99
local function buildEscapedPattern(rawPattern)
1010
-- Escape Lua pattern special characters except *
1111
local escaped = string.gsub(rawPattern, "([%-%+%?%(%)])", "%%%1")
12-
12+
1313
-- Handle ** first (before single *) - use placeholder to avoid conflicts
1414
escaped = string.gsub(escaped, "%*%*", "__DOUBLESTAR__")
15-
15+
1616
-- Convert remaining * to match any character except /
1717
escaped = string.gsub(escaped, "%*", "[^/]*")
18-
18+
1919
-- Replace placeholder with pattern that matches any path including /
2020
escaped = string.gsub(escaped, "__DOUBLESTAR__", ".*")
21-
21+
2222
-- Special handling for **/name patterns - they should match directories
2323
if string.match(rawPattern, "%*%*/[^/]+$") then
2424
-- **/logs should match files within logs directories
2525
escaped = escaped .. "/"
2626
end
27-
27+
2828
-- Handle trailing slash - directory patterns should match everything within
2929
if string.match(escaped, "/$") then
3030
-- Remove trailing slash and match anything that starts with this path
@@ -34,7 +34,7 @@ local function buildEscapedPattern(rawPattern)
3434
-- Anchor non-directory patterns to match exactly
3535
escaped = escaped .. "$"
3636
end
37-
37+
3838
return escaped
3939
end
4040

@@ -126,7 +126,7 @@ CO.matchFilesToCodeowner = function(filePaths)
126126
break -- Since sorted by length, we can break early
127127
end
128128
end
129-
129+
130130
local codeownersList = mapCodeowners(mostSpecificMatches)
131131
return codeownersList
132132
end

lua/gh-co/co.test.lua

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function TestCO:testGlobalPattern() -- luacheck: ignore 212
8686
return lines[i]
8787
end
8888
end
89-
89+
9090
local result = CO.matchFilesToCodeowner({"README.md", "src/main.js"})
9191
lu.assertEquals(result, {"@global-owner1", "@global-owner2"})
9292
end
@@ -101,7 +101,7 @@ function TestCO:testJavaScriptPattern() -- luacheck: ignore 212
101101
return lines[i]
102102
end
103103
end
104-
104+
105105
local result = CO.matchFilesToCodeowner({"app.js", "utils.js"})
106106
lu.assertEquals(result, {"@js-owner"})
107107
end
@@ -116,7 +116,7 @@ function TestCO:testGoPattern() -- luacheck: ignore 212
116116
return lines[i]
117117
end
118118
end
119-
119+
120120
local result = CO.matchFilesToCodeowner({"main.go", "server.go"})
121121
lu.assertEquals(result, {"docs@example.com"})
122122
end
@@ -131,7 +131,7 @@ function TestCO:testTxtPattern() -- luacheck: ignore 212
131131
return lines[i]
132132
end
133133
end
134-
134+
135135
local result = CO.matchFilesToCodeowner({"README.txt", "notes.txt"})
136136
lu.assertEquals(result, {"@octo-org/octocats"})
137137
end
@@ -146,7 +146,7 @@ function TestCO:testBuildLogsDirectoryPattern() -- luacheck: ignore 212
146146
return lines[i]
147147
end
148148
end
149-
149+
150150
local result = CO.matchFilesToCodeowner({"/build/logs/app.log", "/build/logs/error.log"})
151151
lu.assertEquals(result, {"@doctocat"})
152152
end
@@ -161,7 +161,7 @@ function TestCO:testDocsWildcardPattern() -- luacheck: ignore 212
161161
return lines[i]
162162
end
163163
end
164-
164+
165165
local result = CO.matchFilesToCodeowner({"docs/README.md", "docs/guide.txt"})
166166
lu.assertEquals(result, {"docs@example.com"})
167167
end
@@ -176,7 +176,7 @@ function TestCO:testDocsWildcardDoesNotMatchSubdirectories() -- luacheck: ignore
176176
return lines[i]
177177
end
178178
end
179-
179+
180180
-- Debug: Test what the pattern should do
181181
-- docs/* should match "docs/readme.md" but NOT "docs/sub/readme.md"
182182
local result = CO.matchFilesToCodeowner({"docs/sub/readme.md"})
@@ -197,15 +197,15 @@ function TestCO:testCombinedWithGlobalPattern() -- luacheck: ignore 212
197197
return lines[i]
198198
end
199199
end
200-
200+
201201
-- JS files should match specific owner (*.js overrides *)
202202
local result1 = CO.matchFilesToCodeowner({"app.js"})
203203
lu.assertEquals(result1, {"@js-owner"})
204-
204+
205205
-- Docs files should match docs owner (docs/* overrides *)
206206
local result2 = CO.matchFilesToCodeowner({"docs/README.md"})
207207
lu.assertEquals(result2, {"docs@example.com"})
208-
208+
209209
-- Files with no specific pattern should fall back to global owner
210210
local result3 = CO.matchFilesToCodeowner({"README.py"})
211211
lu.assertEquals(result3, {"@global-owner"})
@@ -221,7 +221,7 @@ function TestCO:testAppsDirectoryPattern() -- luacheck: ignore 212
221221
return lines[i]
222222
end
223223
end
224-
224+
225225
local result = CO.matchFilesToCodeowner({"apps/web/index.js", "apps/mobile/main.kt"})
226226
lu.assertEquals(result, {"@octocat"})
227227
end
@@ -236,7 +236,7 @@ function TestCO:testRootDocsDirectoryPattern() -- luacheck: ignore 212
236236
return lines[i]
237237
end
238238
end
239-
239+
240240
local result = CO.matchFilesToCodeowner({"/docs/api.md", "/docs/guides/setup.md"})
241241
lu.assertEquals(result, {"@doctocat"})
242242
end
@@ -251,7 +251,7 @@ function TestCO:testRootScriptsDirectoryPattern() -- luacheck: ignore 212
251251
return lines[i]
252252
end
253253
end
254-
254+
255255
local result = CO.matchFilesToCodeowner({"/scripts/deploy.sh", "/scripts/test.py"})
256256
lu.assertEquals(result, {"@doctocat", "@octocat"})
257257
end
@@ -266,7 +266,7 @@ function TestCO:testDoubleStarLogsPattern() -- luacheck: ignore 212
266266
return lines[i]
267267
end
268268
end
269-
269+
270270
local result = CO.matchFilesToCodeowner({"build/logs/error.log", "app/server/logs/access.log", "logs/debug.log"})
271271
lu.assertEquals(result, {"@octocat"})
272272
end
@@ -284,7 +284,7 @@ function TestCO:testAppsWithEmptyGithubSubdirectory() -- luacheck: ignore 212
284284
return lines[i]
285285
end
286286
end
287-
287+
288288
-- Files in /apps/github should have no owners (empty pattern overrides /apps/)
289289
local githubResult = CO.matchFilesToCodeowner({"/apps/github/readme.md"})
290290
lu.assertEquals(githubResult, {})
@@ -303,7 +303,7 @@ function TestCO:testAppsWithGithubSubdirectoryOwner() -- luacheck: ignore 212
303303
return lines[i]
304304
end
305305
end
306-
306+
307307
-- Files in /apps/github should have @doctocat (overrides /apps/)
308308
local githubResult = CO.matchFilesToCodeowner({"/apps/github/readme.md"})
309309
lu.assertEquals(githubResult, {"@doctocat"})

0 commit comments

Comments
 (0)