diff --git a/slither/utils/output.py b/slither/utils/output.py index 01132c5a9..7c1789aff 100644 --- a/slither/utils/output.py +++ b/slither/utils/output.py @@ -120,6 +120,9 @@ def _convert_to_id(d): else: return f'{str(d)} ({d.source_mapping_str})' + if isinstance(d, Pragma): + return f'{d} ({d.source_mapping_str})' + if hasattr(d, 'canonical_name'): return f'{d.canonical_name}' diff --git a/tests/expected_json/old_solc.sol.json.solc-version.json b/tests/expected_json/old_solc.sol.json.solc-version.json index 6a466b562..b04dc42c2 100644 --- a/tests/expected_json/old_solc.sol.json.solc-version.json +++ b/tests/expected_json/old_solc.sol.json.solc-version.json @@ -31,11 +31,11 @@ ], "description": "Pragma version0.4.21 (None) allows old versions\n", "markdown": "Pragma version[0.4.21](None) allows old versions\n", - "id": "328ceb03806c74c48201abc80cb5625f6c8f47711913161dc99748ee6a99b64f", + "id": "42d3e653dc8967543a723ca7014488c207b3e5e2d5774021d0932326e2483cb5", "check": "solc-version", "impact": "Informational", "confidence": "High" } ] } -} \ No newline at end of file +} diff --git a/tests/expected_json/pragma.0.4.24.pragma.json b/tests/expected_json/pragma.0.4.24.pragma.json index 855d1a84e..433d79c50 100644 --- a/tests/expected_json/pragma.0.4.24.pragma.json +++ b/tests/expected_json/pragma.0.4.24.pragma.json @@ -60,11 +60,11 @@ ], "description": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- ^0.4.23 (tests/pragma.0.4.23.sol#1)\n\t- ^0.4.24 (tests/pragma.0.4.24.sol#1)\n", "markdown": "Different versions of Solidity is used in :\n\t- Version used: ['^0.4.23', '^0.4.24']\n\t- [^0.4.23](tests/pragma.0.4.23.sol#L1)\n\t- [^0.4.24](tests/pragma.0.4.24.sol#L1)\n", - "id": "ab9edf8af725d611d1eaeb16713c0f2e9f51804dc985b1bc823bd87645713fb7", + "id": "05e3d32f70e37f2745b5defe65910aaf477ed4eef1e8d3d6a22dcb14c0634cb4", "check": "pragma", "impact": "Informational", "confidence": "High" } ] } -} \ No newline at end of file +} diff --git a/tests/expected_json/solc_version_incorrect.solc-version.json b/tests/expected_json/solc_version_incorrect.solc-version.json index 121466f3e..d555cbd70 100644 --- a/tests/expected_json/solc_version_incorrect.solc-version.json +++ b/tests/expected_json/solc_version_incorrect.solc-version.json @@ -34,7 +34,7 @@ ], "description": "Pragma version^0.4.23 (tests/solc_version_incorrect.sol#2) allows old versions\n", "markdown": "Pragma version[^0.4.23](tests/solc_version_incorrect.sol#L2) allows old versions\n", - "id": "c88d5b50c78f468b95732feb91693016824f78333adab2fdcca3152eec2bfa73", + "id": "10a41e5fb84308a2a6123319b07b40eb1922f1a430a42ddf29e669fe4a929f32", "check": "solc-version", "impact": "Informational", "confidence": "High" @@ -73,11 +73,11 @@ ], "description": "Pragma version>=0.4.0<0.6.0 (tests/solc_version_incorrect.sol#3) allows old versions\n", "markdown": "Pragma version[>=0.4.0<0.6.0](tests/solc_version_incorrect.sol#L3) allows old versions\n", - "id": "dfd3e70c2367b0c8eca5afa86d1773b9c7aa1d0a155e3a0495188800c41fe390", + "id": "59afb064cee0498173127c1e2d23bd60852c1bc4de3d3c673026b3d2faa04134", "check": "solc-version", "impact": "Informational", "confidence": "High" } ] } -} \ No newline at end of file +} diff --git a/tests/expected_json/solc_version_incorrect_05.ast.json.solc-version.json b/tests/expected_json/solc_version_incorrect_05.ast.json.solc-version.json index d04fb3bbb..d332f6677 100644 --- a/tests/expected_json/solc_version_incorrect_05.ast.json.solc-version.json +++ b/tests/expected_json/solc_version_incorrect_05.ast.json.solc-version.json @@ -32,7 +32,7 @@ ], "description": "Pragma version^0.5.5 (None) is known to contain severe issue (https://solidity.readthedocs.io/en/v0.5.8/bugs.html)\n", "markdown": "Pragma version[^0.5.5](None) is known to contain severe issue (https://solidity.readthedocs.io/en/v0.5.8/bugs.html)\n", - "id": "8bcf06a2e2c13723dbc16f843f73830ebdb86b7e8ee599524a0b9824bb89381c", + "id": "fa84bcbd40d52d8846dcd54be4cada287e43c5461898c9acbf089ca8a478f6e5", "check": "solc-version", "impact": "Informational", "confidence": "High" @@ -65,11 +65,11 @@ ], "description": "Pragma version0.5.7 (None) necessitates versions too recent to be trusted. Consider deploying with 0.5.3\n", "markdown": "Pragma version[0.5.7](None) necessitates versions too recent to be trusted. Consider deploying with 0.5.3\n", - "id": "997cf0cfc722f31f7566c3fd180c01b0c7466a19df7c65ee590e9f3778cf62ee", + "id": "5889f3ae12e005170e40681552a9752c2900f44ce9ab0e6d721dc78f89ae05fa", "check": "solc-version", "impact": "Informational", "confidence": "High" } ] } -} \ No newline at end of file +}