aboutsummaryrefslogtreecommitdiff
path: root/scripts/lintcommit.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-01-14 23:13:48 -0700
committerJosh Rahm <joshuarahm@gmail.com>2023-01-14 23:13:48 -0700
commit7a6e249a32f79331bfb5e29bc0cabcf89a026081 (patch)
tree27a7354ec18448e4090ac91581534baa7b537254 /scripts/lintcommit.lua
parent442d4e54c30b8e193e3f6e4d32b43e96815bccd7 (diff)
parent6134c1e8a39a5e61d0593613343a5923a86e3545 (diff)
downloadrneovim-7a6e249a32f79331bfb5e29bc0cabcf89a026081.tar.gz
rneovim-7a6e249a32f79331bfb5e29bc0cabcf89a026081.tar.bz2
rneovim-7a6e249a32f79331bfb5e29bc0cabcf89a026081.zip
Merge remote-tracking branch 'upstream/master' into usermarks
Diffstat (limited to 'scripts/lintcommit.lua')
-rw-r--r--scripts/lintcommit.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua
index 16326cfe66..87a8e62503 100644
--- a/scripts/lintcommit.lua
+++ b/scripts/lintcommit.lua
@@ -86,11 +86,28 @@ local function validate_commit(commit_message)
vim.inspect(allowed_types))
end
- -- Check if scope is empty
+ -- Check if scope is appropriate
if before_colon:match("%(") then
local scope = vim.trim(before_colon:match("%((.*)%)"))
+
if scope == '' then
- return [[Scope can't be empty.]]
+ return [[Scope can't be empty]]
+ end
+
+ if vim.startswith(scope, "nvim_") then
+ return [[Scope should be "api" instead of "nvim_..."]]
+ end
+
+ local alternative_scope = {
+ ['filetype.vim'] = 'filetype',
+ ['filetype.lua'] = 'filetype',
+ ['tree-sitter'] = 'treesitter',
+ ['ts'] = 'treesitter',
+ ['hl'] = 'highlight',
+ }
+
+ if alternative_scope[scope] then
+ return ('Scope should be "%s" instead of "%s"'):format(alternative_scope[scope], scope)
end
end