Skip to content

Commit

Permalink
warn for 50 < title <= 72 (#18)
Browse files Browse the repository at this point in the history
* warn for 50 < title <= 72
* deps bump (tap 10.7 works better on Windows)
  • Loading branch information
refack authored and joyeecheung committed Jan 15, 2018
1 parent 235c8a3 commit ba50cbb
Show file tree
Hide file tree
Showing 6 changed files with 3,967 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: node_js
node_js:
- "6"
- "8"
- "9"
sudo: false
4 changes: 3 additions & 1 deletion lib/format-pretty.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ function formatMessage(msg) {
const m = msg.message
const icon = msg.level === 'fail'
? utils.X
: utils.CHECK
: msg.level === 'warn'
? utils.WARN
: utils.CHECK
return ` ${icon} ${line} ${utils.rightPad(m, 40)} ${id}`
}

Expand Down
20 changes: 18 additions & 2 deletions lib/rules/title-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,37 @@ module.exports = {
}
, defaults: {
length: 50
, max_length: 72
}
, options: {
length: 50
, max_length: 72
}
, validate: (context, rule) => {
const max = rule.options.max_length
if (context.title.length > max) {
context.report({
id: id
, message: `Title must be <= ${max} columns.`
, string: context.title
, maxLength: max
, line: 0
, column: max
, level: 'fail'
})
return
}

const len = rule.options.length
if (context.title.length > len) {
context.report({
id: id
, message: `Title must be <= ${len} columns.`
, message: `Title should be <= ${len} columns.`
, string: context.title
, maxLength: len
, line: 0
, column: len
, level: 'fail'
, level: 'warn'
})
return
}
Expand Down
Loading

0 comments on commit ba50cbb

Please sign in to comment.