Skip to content

Commit

Permalink
Merge pull request #503 from protofire/fix-list-all-rules
Browse files Browse the repository at this point in the history
fix: list-all-rules
  • Loading branch information
dbale-altoros authored Oct 9, 2023
2 parents 354ae8b + 8418c47 commit 7708347
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions solhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,20 @@ function getFormatter(formatter) {
}

function listRules() {
if (process.argv.length !== 3) {
const args = process.argv.slice(2)
let configPath = '.solhint.json'
const configFileIndex = args.findIndex((arg) => arg === '-c' || arg === '--config')
if (configFileIndex !== -1) {
configPath = args[configFileIndex + 1]
if (!configPath || configPath.startsWith('-')) {
console.error('Error: Invalid configuration file path after -c or --config flag.')
process.exit(1)
}
} else if (args.length !== 1) {
console.log('Error!! no additional parameters after list-rules command')
process.exit(1)
}

const configPath = '.solhint.json'
if (!fs.existsSync(configPath)) {
console.log('Error!! Configuration does not exists')
process.exit(1)
Expand Down

0 comments on commit 7708347

Please sign in to comment.