diff --git a/config/rulesets/solium-all.js b/config/rulesets/solium-all.js index 7b258fd..582fe71 100644 --- a/config/rulesets/solium-all.js +++ b/config/rulesets/solium-all.js @@ -22,7 +22,7 @@ module.exports = { "indentation": "warning", "arg-overflow": "warning", "whitespace": "warning", - "magic-number": "warning", + "magic-to-const": "warning", "function-whitespace": "error", "semicolon-whitespace": "error", "comma-whitespace": "error", diff --git a/config/rulesets/solium-recommended.js b/config/rulesets/solium-recommended.js index d8fe997..b7f02d5 100644 --- a/config/rulesets/solium-recommended.js +++ b/config/rulesets/solium-recommended.js @@ -25,7 +25,7 @@ module.exports = { "operator-whitespace": "warning", "emit": "warning", "no-constant": "warning", - "magic-number": "warning", + "magic-to-const": "warning", "lbrace": "off", "mixedcase": "off", diff --git a/config/solium.json b/config/solium.json index 77e0df9..9c8792f 100644 --- a/config/solium.json +++ b/config/solium.json @@ -99,7 +99,7 @@ "description": "Ensure that no empty blocks {} exist" }, - "magic-number": { + "magic-to-const": { "enabled": true, "recommended": true, "type": "warning", diff --git a/docs/user-guide.rst b/docs/user-guide.rst index 0cae248..ec31f9c 100644 --- a/docs/user-guide.rst +++ b/docs/user-guide.rst @@ -347,7 +347,7 @@ For eg- your choice of indentation might be Tab or 4 spaces or 2 spaces. What in +----------------------------+--------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------------+-------+ | quotes | Ensure that all strings use only 1 style - either double quotes or single quotes | Single option - either "double" or "single" | double | YES | +----------------------------+--------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------------+-------+ -| magic-number | Ensure that magic numbers are extracted to constants | - | | | +| magic-to-const | Ensure that magic numbers are extracted to constants | - | | | +----------------------------+--------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------------+-------+ | blank-lines | Ensure that there is exactly a 2-line gap between Contract and Funtion declarations | - | | YES | +----------------------------+--------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+-----------------+-------+ diff --git a/lib/rules/magic-number.js b/lib/rules/magic-to-const.js similarity index 100% rename from lib/rules/magic-number.js rename to lib/rules/magic-to-const.js diff --git a/test/lib/rules/magic-number/magic-number.js b/test/lib/rules/magic-to-const/magic-to-const.js similarity index 81% rename from test/lib/rules/magic-number/magic-number.js rename to test/lib/rules/magic-to-const/magic-to-const.js index e55ce52..3a5b5c1 100644 --- a/test/lib/rules/magic-number/magic-number.js +++ b/test/lib/rules/magic-to-const/magic-to-const.js @@ -12,11 +12,11 @@ let rejectionCases = wrappers.rejectionCases; let userConfig = { "custom-rules-filename": null, "rules": { - "magic-number": true + "magic-to-const": true } }; -acceptanceCases("magic-number", userConfig, +acceptanceCases("magic-to-const", userConfig, [ "uint constant x = 123;", "uint a = 1; uint b = 0; uint c = -1;", @@ -25,7 +25,7 @@ acceptanceCases("magic-number", userConfig, ] ); -rejectionCases("magic-number", userConfig, +rejectionCases("magic-to-const", userConfig, [ "uint a = 5;" ]