commitplease
Advanced tools
Comparing version 2.6.0 to 2.6.1
module.exports = function (lines, options, errors) { | ||
var scheme = '<type>"("<scope>"): "<subject>' | ||
var scheme = '<type>(<scope>): <subject>' | ||
var prefix = 'First line must be ' + scheme + '\n' | ||
@@ -9,7 +9,7 @@ | ||
line = line.replace(/^revert: /, '') | ||
prefix = 'First line must be "revert: "' + scheme + '\n' | ||
prefix = 'First line must be revert: ' + scheme + '\n' | ||
} else if (line.startsWith('revert')) { | ||
errors.push( | ||
'If this is a revert of a previous commit, please write:\n' + | ||
'"revert: "<type>"("<scope>"): "<subject>"' | ||
'revert: <type>(<scope>): <subject>' | ||
) | ||
@@ -21,3 +21,3 @@ | ||
if (line.indexOf('(') === -1) { | ||
errors.push(prefix + 'Need an opening parethesis "("') | ||
errors.push(prefix + 'Need an opening parenthesis: (') | ||
@@ -48,3 +48,3 @@ return | ||
if (line.indexOf(')') === -1) { | ||
errors.push(prefix + 'Need a closing parenthesis ")" after <scope>') | ||
errors.push(prefix + 'Need a closing parenthesis after scope: <scope>)') | ||
@@ -65,3 +65,3 @@ return | ||
if (line.indexOf(type + '(' + scope + '):') === -1) { | ||
errors.push(prefix + 'Need a colon ":" after the closing parenthesis ")"') | ||
errors.push(prefix + 'Need a colon after the closing parenthesis: ):') | ||
@@ -74,3 +74,3 @@ return | ||
if (!subject.startsWith(' ')) { | ||
errors.push(prefix + 'Need a space " " after colon ":"') | ||
errors.push(prefix + 'Need a space after colon: ": "') | ||
@@ -95,3 +95,3 @@ return | ||
if (subject[subject.length - 1] === '.') { | ||
errors.push('<subject> must not end with a dot "."') | ||
errors.push('<subject> must not end with a dot') | ||
@@ -98,0 +98,0 @@ return |
module.exports = function (lines, options, errors) { | ||
if (!options.component) { return } | ||
var prefix = 'First line must be <Component>": "<subject>\n' | ||
var prefix = 'First line must be <Component>: <subject>\n' | ||
@@ -9,3 +9,3 @@ var line = lines[0] | ||
if (line.indexOf(':') === -1) { | ||
errors.push(prefix + 'Missing colon ":"') | ||
errors.push(prefix + 'Missing colon :') | ||
@@ -12,0 +12,0 @@ return |
{ | ||
"name": "commitplease", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"description": "Validates strings as commit messages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
44
test.js
@@ -7,25 +7,25 @@ var merge = require('mout/object/merge') | ||
var jqueryColon = | ||
'First line must be <Component>": "<subject>\n' + | ||
'Missing colon ":"' | ||
'First line must be <Component>: <subject>\n' + | ||
'Missing colon :' | ||
var jqueryComponent = | ||
'First line must be <Component>": "<subject>\n' + | ||
'First line must be <Component>: <subject>\n' + | ||
'<Component> invalid, was "Component", must be one of these:\n' + | ||
'Build, Legacy' | ||
var jqueryEmptyComponent = | ||
'First line must be <Component>": "<subject>\n' + | ||
'First line must be <Component>: <subject>\n' + | ||
'<Component> was empty, must be one of these:\n' | ||
var jqueryTestComponent = | ||
'First line must be <Component>": "<subject>\n' + | ||
'First line must be <Component>: <subject>\n' + | ||
'<Component> invalid, was "Test", must be one of these:\n' + | ||
'Build, Legacy' | ||
var jqueryFixComponent = | ||
'First line must be <Component>": "<subject>\n' + | ||
'First line must be <Component>: <subject>\n' + | ||
'<Component> invalid, was "[fix]", must be one of these:\n' + | ||
'Build, Legacy' | ||
var jqueryTmpComponent = | ||
'First line must be <Component>": "<subject>\n' + | ||
'First line must be <Component>: <subject>\n' + | ||
'<Component> invalid, was "[Tmp]", must be one of these:\n' + | ||
'Build, Legacy' | ||
var jqueryEmptySubject = | ||
'First line must be <Component>": "<subject>\n' + | ||
'First line must be <Component>: <subject>\n' + | ||
'<subject> was empty' | ||
@@ -515,28 +515,28 @@ | ||
var angularOpening = | ||
'First line must be <type>"("<scope>"): "<subject>\n' + | ||
'Need an opening parethesis "("' | ||
'First line must be <type>(<scope>): <subject>\n' + | ||
'Need an opening parenthesis: (' | ||
var angularOpeningRevert = | ||
'First line must be "revert: "<type>"("<scope>"): "<subject>\n' + | ||
'Need an opening parethesis "("' | ||
'First line must be revert: <type>(<scope>): <subject>\n' + | ||
'Need an opening parenthesis: (' | ||
var angularClosing = | ||
'First line must be <type>"("<scope>"): "<subject>\n' + | ||
'Need a closing parenthesis ")" after <scope>' | ||
'First line must be <type>(<scope>): <subject>\n' + | ||
'Need a closing parenthesis after scope: <scope>)' | ||
var angularSpace = | ||
'First line must be <type>"("<scope>"): "<subject>\n' + | ||
'Need a space " " after colon ":"' | ||
'First line must be <type>(<scope>): <subject>\n' + | ||
'Need a space after colon: ": "' | ||
var angularScope = | ||
'First line must be <type>"("<scope>"): "<subject>\n' + | ||
'First line must be <type>(<scope>): <subject>\n' + | ||
'Scope does not match \\S+.*' | ||
var angularColon = | ||
'First line must be <type>"("<scope>"): "<subject>\n' + | ||
'Need a colon ":" after the closing parenthesis ")"' | ||
'First line must be <type>(<scope>): <subject>\n' + | ||
'Need a colon after the closing parenthesis: ):' | ||
var angularLowercase = | ||
'<subject> must start with a lowercase letter' | ||
var angularDot = | ||
'<subject> must not end with a dot "."' | ||
'<subject> must not end with a dot' | ||
var angularIfRevert = | ||
'If this is a revert of a previous commit, please write:\n' + | ||
'"revert: "<type>"("<scope>"): "<subject>"' | ||
'revert: <type>(<scope>): <subject>' | ||
var angularEmptyTypeRevert = | ||
'First line must be "revert: "<type>"("<scope>"): "<subject>\n' + | ||
'First line must be revert: <type>(<scope>): <subject>\n' + | ||
'<type> was empty, must be one of these:\n' + | ||
@@ -543,0 +543,0 @@ 'feat, fix, docs, style, refactor, perf, test, chore' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40706