FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

rules: only check case of first word after subsystem by richardlau · Pull Request #48 · nodejs/core-validate-commit · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion lib/rules/title-format.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = {
}
}

const result = /^(.+?): [A-Z]/.exec(context.title)
const result = /^([^:]+?): [A-Z]/.exec(context.title)
if (result) {
context.report({
id: id
Expand Down
38 changes: 38 additions & 0 deletions test/rules/title-format.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,43 @@ test('rule: title-format', (t) => {
tt.end()
})

t.test('first word after subsystem should be in lowercase', (tt) => {
tt.plan(2)
const context = makeCommit('test: Some message')

context.report = (opts) => {
tt.pass('called report')
tt.strictSame(opts, {
id: 'title-format'
, message: 'First word after subsystem(s) in title should be lowercase.'
, string: 'test: Some message'
, line: 0
, column: 7
, level: 'fail'
})
}

Rule.validate(context)
tt.end()
})

t.test('colon in message followed by uppercase word', (tt) => {
tt.plan(2)
const context = makeCommit('test: some message: Message')

context.report = (opts) => {
tt.pass('called report')
tt.strictSame(opts, {
id: 'title-format'
, message: 'Title is formatted correctly.'
, string: ''
, level: 'pass'
})
}

Rule.validate(context)
tt.end()
})

t.end()
})

Back | FazBrowse Home | New Git URL