Skip to content

Commit

Permalink
Merge pull request #58 from Cambalab/add-contribution-ignore-path
Browse files Browse the repository at this point in the history
Add new feature --ignore-path option
  • Loading branch information
Franco Victorio authored Sep 6, 2018
2 parents 9e7f851 + 0cacb5b commit 3eeb38a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions solhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function init() {
.usage('[options] <file> [...other_files]')
.option('-f, --formatter [name]', 'report formatter name (stylish, table, tap, unix)')
.option('-w, --max-warnings [maxWarningsNumber]', 'number of warnings to trigger nonzero exit code')
.option('-q, --quiet', 'report errors only')
.option('-q, --quiet', 'report errors only - default: false')
.option('--ignore-path [file_name]', 'file to use as your .solhintignore')
.description('Linter for Solidity programming language')
.action(execMainAction);

Expand Down Expand Up @@ -99,13 +100,22 @@ function writeSampleConfigFile() {
}

const readIgnore = _.memoize(function () {
let ignoreFile = '.solhintignore';
try {
if(program.ignorePath) {
ignoreFile = program.ignorePath;
}

return fs
.readFileSync('.solhintignore')
.readFileSync(ignoreFile)
.toString()
.split('\n')
.map(i => i.trim());
} catch (e) {

} catch (e){
if (program.ignorePath && e.code == 'ENOENT') {
console.error(`\nERROR: ${ignoreFile} is not a valid path.`);
}
return [];
}
});
Expand Down

0 comments on commit 3eeb38a

Please sign in to comment.