From 9d9ec680320c0b7220cfd6fd913ff1aab2ec7a77 Mon Sep 17 00:00:00 2001 From: jmhickman Date: Wed, 3 Aug 2022 10:47:25 -0500 Subject: [PATCH 1/2] Update divide_before_multiply.py Missing space in string causes formatting issues when this detector is included in `--checklist` output. --- slither/detectors/statements/divide_before_multiply.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slither/detectors/statements/divide_before_multiply.py b/slither/detectors/statements/divide_before_multiply.py index 5a5132fdd2..7691c3a178 100644 --- a/slither/detectors/statements/divide_before_multiply.py +++ b/slither/detectors/statements/divide_before_multiply.py @@ -189,7 +189,7 @@ def _detect(self): nodes.sort(key=lambda x: x.node_id) for node in nodes: - info += ["\t-", node, "\n"] + info += ["\t- ", node, "\n"] res = self.generate_result(info) results.append(res) From d956569474d23cee36e8ef628134843d81ccc78d Mon Sep 17 00:00:00 2001 From: Josselin Feist Date: Mon, 3 Oct 2022 12:09:02 +0200 Subject: [PATCH 2/2] Update tests --- ...ide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json | 6 +++--- ...ide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json | 6 +++--- ...ide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json | 6 +++--- ...vide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json index d164f9c606..9c2064da9c 100644 --- a/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json +++ b/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json @@ -110,10 +110,10 @@ } } ], - "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#3)\n", - "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L3)\n", + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t- (a / b) * c (tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t- [(a / b) * c](tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L3)\n", "first_markdown_element": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L2-L4", - "id": "fe40e2f72824d1270402b09af057ec7364af1ad2f8c48ef4df72fc27012b3186", + "id": "e0d9e5f7d421dadadf4b22750bde5233357fa2a413478117848de6e44ba9c314", "check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium" diff --git a/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json index 6aee4f301f..895721fd4a 100644 --- a/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json +++ b/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json @@ -110,10 +110,10 @@ } } ], - "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#3)\n", - "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L3)\n", + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t- (a / b) * c (tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t- [(a / b) * c](tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L3)\n", "first_markdown_element": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L2-L4", - "id": "a484421df5c9ebf3dc3d8bcec6701ab3065e03b21e294c4972142c4503f2fccb", + "id": "201417019df7d5dedc2b65c695ccdce8dbd171768bb64e4bae44c2b6e81bb96b", "check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium" diff --git a/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json index 2639708b2b..c250c523c4 100644 --- a/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json +++ b/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json @@ -110,10 +110,10 @@ } } ], - "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#3)\n", - "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L3)\n", + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t- (a / b) * c (tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t- [(a / b) * c](tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L3)\n", "first_markdown_element": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L2-L4", - "id": "9010aa3fdf8f7689d4c4d4ea0bcd771668212100e5427e48644ed7337de03a6d", + "id": "c84a7841250790acbb447d31715ca8f7818170927909d599cbc08f49ce8a665d", "check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium" diff --git a/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json index 69310a7410..7c68d8531d 100644 --- a/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json +++ b/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json @@ -110,10 +110,10 @@ } } ], - "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#3)\n", - "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L3)\n", + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t- (a / b) * c (tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t- [(a / b) * c](tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L3)\n", "first_markdown_element": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L2-L4", - "id": "9bc6cb85ece6cd57fa946707784180957080ad5f9575abc17af218f0d2801f77", + "id": "1978edf9df9f9dc18d8c90bb008cca4bb4b0e811fd840a337ce006fcf38c7e82", "check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"