mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
ci(lintcommit): fix empty and period check with multiple colons (#26312)
This commit is contained in:
parent
73691b6c3d
commit
65de1a22c4
@ -74,7 +74,11 @@ local function validate_commit(commit_message)
|
|||||||
if after_idx > vim.tbl_count(commit_split) then
|
if after_idx > vim.tbl_count(commit_split) then
|
||||||
return [[Commit message does not include colons.]]
|
return [[Commit message does not include colons.]]
|
||||||
end
|
end
|
||||||
local after_colon = commit_split[after_idx]
|
local after_colon = ''
|
||||||
|
while after_idx <= vim.tbl_count(commit_split) do
|
||||||
|
after_colon = after_colon .. commit_split[after_idx]
|
||||||
|
after_idx = after_idx + 1
|
||||||
|
end
|
||||||
|
|
||||||
-- Check if commit introduces a breaking change.
|
-- Check if commit introduces a breaking change.
|
||||||
if vim.endswith(before_colon, "!") then
|
if vim.endswith(before_colon, "!") then
|
||||||
@ -239,11 +243,14 @@ function M._test()
|
|||||||
['refactor(): empty scope'] = false,
|
['refactor(): empty scope'] = false,
|
||||||
['ci( ): whitespace as scope'] = false,
|
['ci( ): whitespace as scope'] = false,
|
||||||
['ci: period at end of sentence.'] = false,
|
['ci: period at end of sentence.'] = false,
|
||||||
|
['ci: period: at end of sentence.'] = false,
|
||||||
['ci: Capitalized first word'] = false,
|
['ci: Capitalized first word'] = false,
|
||||||
['ci: UPPER_CASE First Word'] = true,
|
['ci: UPPER_CASE First Word'] = true,
|
||||||
['unknown: using unknown type'] = false,
|
['unknown: using unknown type'] = false,
|
||||||
['feat: foo:bar'] = true,
|
['feat: foo:bar'] = true,
|
||||||
|
['feat: :foo:bar'] = true,
|
||||||
['feat(something): foo:bar'] = true,
|
['feat(something): foo:bar'] = true,
|
||||||
|
['feat(something): :foo:bar'] = true,
|
||||||
['feat(:grep): read from pipe'] = true,
|
['feat(:grep): read from pipe'] = true,
|
||||||
['feat(:grep/:make): read from pipe'] = true,
|
['feat(:grep/:make): read from pipe'] = true,
|
||||||
['feat(:grep): foo:bar'] = true,
|
['feat(:grep): foo:bar'] = true,
|
||||||
|
Loading…
Reference in New Issue
Block a user