Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new feature --ignore-path option #58

Merged
merged 11 commits into from
Sep 6, 2018
17 changes: 15 additions & 2 deletions solhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function init() {
.usage('[options] <file> [...other_files]')
.option('-f, --formatter [name]', 'report formatter name (stylish, table, tap, unix)')
.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 @@ -81,13 +82,25 @@ 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