Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
.nyc_output/
.idea/
2 changes: 1 addition & 1 deletion lib/reporter/cli_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const chalk = require('chalk');
const cliui = require('cliui');
const Reporter = require('./reporter');

const DEFAULT_TOTAL_WIDTH = 110;
const DEFAULT_TOTAL_WIDTH = process.stdout.columns;
const ISSUE_COL0_WIDTH = 5;
const ISSUE_COL1_WIDTH = 14;
const ISSUE_TITLE_WIDTH_MAX = 40;
Expand Down
32 changes: 14 additions & 18 deletions test/cli_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ describe('cli_reporter', () => {
describe('#constructor(opts)', () => {
it('sets defaults with no options given', () => {
let reporter = new CliReporter();
expect(reporter.ui.width).to.equal(110);
expect(reporter.ui.width).to.equal(process.stdout.columns);
expect(reporter.ui.wrap).to.equal(true);
expect(reporter.issueTitleWidth).to.equal(22);
expect(reporter.issueTitleWidth).to.equal(40);
expect(reporter.styles['Deprecation']).to.be.a('function');
expect(reporter.styles['Possible Bug']).to.be.a('function');
expect(reporter.styles['Clarity']).to.be.a('function');
Expand All @@ -28,9 +28,9 @@ describe('cli_reporter', () => {

it('doesn\'t blow up when width is NaN', () => {
let reporter = new CliReporter({ width: 'hello' });
expect(reporter.ui.width).to.equal(110);
expect(reporter.ui.width).to.equal(process.stdout.columns);
expect(reporter.ui.wrap).to.equal(true);
expect(reporter.issueTitleWidth).to.equal(22);
expect(reporter.issueTitleWidth).to.equal(40);
});
});

Expand Down Expand Up @@ -112,22 +112,18 @@ describe('cli_reporter', () => {
'Issues: 4',
'',
'Line 5: ' + chalk.magenta('FROM ubuntu'),
'Issue Category Title Description',
' ' + chalk.cyan('1') + ' ' + chalk.cyan.inverse('Clarity') + ' ' + chalk.cyan('Base Image Missing') + ' ' + chalk.gray('Base images should specify a tag to use.'),
' ' + chalk.cyan('Tag'),
'Issue Category Title Description',
' ' + chalk.cyan('1') + ' ' + chalk.cyan.inverse('Clarity') + ' ' + chalk.cyan('Base Image Missing Tag') + ' ' + chalk.gray('Base images should specify a tag to use.'),
'',
'Line 6: ' + chalk.magenta('FROM ubuntu:latest'),
'Issue Category Title Description',
' ' + chalk.yellow('2') + ' ' + chalk.yellow.inverse('Possible Bug') + ' ' + chalk.yellow('First Command Must') + ' ' + chalk.gray('The first instruction in a Dockerfile must specify the base image'),
' ' + chalk.yellow('Be FROM') + ' ' + chalk.gray('using a FROM command. Additionally, FROM cannot appear later in a'),
' ' + chalk.gray('Dockerfile.'),
' ' + chalk.cyan('3') + ' ' + chalk.cyan.inverse('Clarity') + ' ' + chalk.cyan('Base Image Latest') + ' ' + chalk.gray('Base images should not use the latest tag.'),
' ' + chalk.cyan('Tag'),
'Issue Category Title Description',
' ' + chalk.yellow('2') + ' ' + chalk.yellow.inverse('Possible Bug') + ' ' + chalk.yellow('First Command Must Be FROM') + ' ' + chalk.gray('The first instruction in a Dockerfile must specify the base image using a FROM command. Additionally, FROM cannot appear'),
' ' + chalk.gray('later in a Dockerfile.'),
' ' + chalk.cyan('3') + ' ' + chalk.cyan.inverse('Clarity') + ' ' + chalk.cyan('Base Image Latest Tag') + ' ' + chalk.gray('Base images should not use the latest tag.'),
'',
'Line 25: ' + chalk.magenta('EXPOSE 80:80'),
'Issue Category Title Description',
' ' + chalk.red('4') + ' ' + chalk.red.inverse('Deprecation') + ' ' + chalk.red('Expose Only') + ' ' + chalk.gray('Using `EXPOSE` to specify a host port is not allowed.'),
' ' + chalk.red('Container Port'),
'Issue Category Title Description',
' ' + chalk.red('4') + ' ' + chalk.red.inverse('Deprecation') + ' ' + chalk.red('Expose Only Container Port') + ' ' + chalk.gray('Using `EXPOSE` to specify a host port is not allowed.'),
''
]);
});
Expand All @@ -151,8 +147,8 @@ describe('cli_reporter', () => {
'Issues: 1',
'',
'Line 5: ' + chalk.magenta('RUN apt-get update && \\'),
'Issue Category Title Description',
' ' + chalk.cyan('1') + ' ' + chalk.cyan.inverse('Hello') + ' ' + chalk.cyan('Hello World!') + ' ' + chalk.gray('This is a test.'),
'Issue Category Title Description',
' ' + chalk.cyan('1') + ' ' + chalk.cyan.inverse('Hello') + ' ' + chalk.cyan('Hello World!') + ' ' + chalk.gray('This is a test.'),
''
]);
});
Expand Down