aboutsummaryrefslogtreecommitdiff
path: root/scripts/lintcommit.lua
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-04-14 10:39:57 +0200
committerGitHub <noreply@github.com>2023-04-14 10:39:57 +0200
commit4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4 (patch)
tree17dadca32fa46116a9c576fc651a61bc5da8ece4 /scripts/lintcommit.lua
parent72a327cad20fa2dbb214177cc48c533543d5b9e8 (diff)
downloadrneovim-4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4.tar.gz
rneovim-4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4.tar.bz2
rneovim-4d04feb6629cb049cb2a13ba35f0c8d3c6b67ff4.zip
feat(lua): vim.tbl_contains supports general tables and predicates (#23040)
* feat(lua): vim.tbl_contains supports general tables and predicates Problem: `vim.tbl_contains` only works for list-like tables (integer keys without gaps) and primitive values (in particular, not for nested tables). Solution: Rename `vim.tbl_contains` to `vim.list_contains` and add new `vim.tbl_contains` that works for general tables and optionally allows `value` to be a predicate function that is checked for every key.
Diffstat (limited to 'scripts/lintcommit.lua')
-rw-r--r--scripts/lintcommit.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua
index f9a4631b7e..7f3dffd22c 100644
--- a/scripts/lintcommit.lua
+++ b/scripts/lintcommit.lua
@@ -88,7 +88,7 @@ local function validate_commit(commit_message)
-- Check if type is correct
local type = vim.split(before_colon, "(", {plain = true})[1]
local allowed_types = {'build', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'test', 'vim-patch'}
- if not vim.tbl_contains(allowed_types, type) then
+ if not vim.list_contains(allowed_types, type) then
return string.format(
[[Invalid commit type "%s". Allowed types are:
%s.