Skip to content

Commit

Permalink
Merge pull request #434 from chrisfilo/enh/cr_test
Browse files Browse the repository at this point in the history
Test for CR new lines
  • Loading branch information
chrisgorgo authored Mar 13, 2018
2 parents 17caae2 + 79dc0c8 commit 7bd54b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/issues/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,10 @@ module.exports = {
key: 'FILENAME_COLUMN',
severity: 'error',
reason: "_scans.tsv files must have a 'filename' column."
},
69: {
key: 'WRONG_NEW_LINE',
severity: 'error',
reason: "All TSV files must use Line Feed '\\n' characters to denote new lines. This files uses Carriage Return '\\r'."
}
};
10 changes: 10 additions & 0 deletions validators/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ var utils = require('../utils');
var TSV = function TSV (file, contents, fileList, callback) {

var issues = [];
if ((contents.includes('\r')) && (!contents.includes('\n'))) {
issues.push(new Issue({
file: file,
evidence: contents,
code: 69
}));
callback(issues, null);
return;
}

var rows = contents.split('\n');
var headers = rows[0].split('\t');

Expand Down

0 comments on commit 7bd54b4

Please sign in to comment.