Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async (message, rules = {}, opts = {}) => {
// Found a wildcard match, skip
if (
isIgnored(message, {defaults: opts.defaultIgnores, ignores: opts.ignores})
) {
return {
valid: true,
errors: [],
warnings: [],
input: message
};
}
// Parse the commit message
const parsed = await parse(message, undefined, opts.parserOpts);
const mergedImplementations = Object.assign({}, implementations);
if (opts.plugins) {
values(opts.plugins).forEach(plugin => {
if (plugin.rules) {
Object.keys(plugin.rules).forEach(ruleKey => {
mergedImplementations[ruleKey] = plugin.rules[ruleKey];
});
}
});
}
// Find invalid rules configs
const missing = Object.keys(rules).filter(
name => typeof mergedImplementations[name] !== 'function'
);