Skip to content

Commit 47dde7b

Browse files
committed
reporting: use lineWrap() for quality scores too
Guess I forgot this from 2fe8fa0 PR-URL: #181
1 parent fa8ca8a commit 47dde7b

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

lib/report/module.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,17 @@ function moduleReport (report) {
145145
L(chalk`{${COLORS.light1} ┌───┬─${'─'.repeat(maxLength)}─┐}`)
146146
}
147147

148-
if (title.length > maxLength) {
149-
const words = title.split(' ')
150-
const lines = ['', '']
151-
for (const word of words) {
152-
if ((lines[0] + word).length > maxLength - 10) lines[1] += ` ${word}`
153-
else lines[0] += `${word} `
154-
}
155-
L(chalk`{${COLORS.light1} │} {${COLORS.yellow} !} {${COLORS.light1} │}` +
156-
chalk`{white ${lines[0]}} ${' '.repeat(maxLength - lines[0].length)}{${COLORS.light1} │}`)
157-
L(chalk`{${COLORS.light1} │} {${COLORS.red} } {${COLORS.light1} │}` +
158-
chalk`{white ${lines[1]}} ${' '.repeat(maxLength - lines[1].length)}{${COLORS.light1} │}`)
159-
} else {
148+
const lines = lineWrap(title, maxLength)
149+
150+
{
151+
const line = lines.shift()
160152
L(chalk`{${COLORS.light1} │} {${COLORS.yellow} !} {${COLORS.light1} │}` +
161-
chalk`{white ${title}} ${' '.repeat(maxLength - title.length)}{${COLORS.light1} │}`)
153+
chalk`{white ${line}} ${' '.repeat(maxLength - line.length)}{${COLORS.light1} │}`)
154+
}
155+
156+
for (const line of lines) {
157+
L(chalk`{${COLORS.light1} │} {${COLORS.light1} │}` +
158+
chalk`{white ${line}} ${' '.repeat(maxLength - line.length)}{${COLORS.light1} │}`)
162159
}
163160

164161
if (ind === codeQuality.length - 1) {

0 commit comments

Comments
 (0)