Skip to content

rules: only check case of first word after subsystem #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rules/title-format.js
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
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()
})