Skip to content

Commit

Permalink
Deprecate compiler-gt-0_4 and compiler-fixed rules
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Aug 7, 2019
1 parent e2d30f8 commit 14c7200
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 14 deletions.
5 changes: 4 additions & 1 deletion lib/config/config-validator.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const chalk = require('chalk')
const _ = require('lodash')
const ajv = require('../common/ajv')
const configSchema = require('./config-schema')
Expand Down Expand Up @@ -41,7 +42,9 @@ const formatErrors = errors =>

const deprecatedDisableValue = _.once(() => {
console.warn(
'[Solhint] Disabling rules with `false` or `0` is deprecated. Please use `"off"` instead.'
chalk.yellow(
'[Solhint] Warning: Disabling rules with `false` or `0` is deprecated. Please use `"off"` instead.'
)
)
})

Expand Down
12 changes: 11 additions & 1 deletion lib/rules/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const chalk = require('chalk')
const _ = require('lodash')
const security = require('./security/index')
const naming = require('./naming/index')
Expand All @@ -22,7 +23,16 @@ module.exports = function checkers(reporter, configVals, inputSrc, fileName) {

const allRules = [...coreRules(meta), ...pluginsRules(plugins, meta)]

return allRules.filter(coreRule => ruleEnabled(coreRule, rules))
const enabledRules = allRules.filter(coreRule => ruleEnabled(coreRule, rules))

// show warnings for deprecated rules
for (const rule of enabledRules) {
if (rule.meta && rule.meta.deprecated) {
console.warn(chalk.yellow(`[solhint] Warning: rule '${rule.ruleId}' is deprecated.`))
}
}

return enabledRules
}

function coreRules(meta) {
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/security/compiler-fixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const meta = {
recommended: true,
defaultSetup: 'warn',

deprecated: true,

schema: []
}

Expand Down
2 changes: 2 additions & 0 deletions lib/rules/security/compiler-gt-0_4.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const meta = {
recommended: true,
defaultSetup: 'warn',

deprecated: true,

schema: []
}

Expand Down
16 changes: 4 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"ajv": "^6.6.1",
"antlr4": "4.7.1",
"chalk": "^2.4.2",
"commander": "2.18.0",
"cosmiconfig": "^5.0.7",
"eslint": "^5.6.0",
Expand Down

0 comments on commit 14c7200

Please sign in to comment.