diff --git a/slither/detectors/all_detectors.py b/slither/detectors/all_detectors.py index 4151759f0d..ff1c352c31 100644 --- a/slither/detectors/all_detectors.py +++ b/slither/detectors/all_detectors.py @@ -98,3 +98,4 @@ from .statements.tautological_compare import TautologicalCompare from .statements.return_bomb import ReturnBomb from .functions.out_of_order_retryable import OutOfOrderRetryable +from .statements.unused_import import UnusedImport diff --git a/slither/detectors/statements/unused_import.py b/slither/detectors/statements/unused_import.py new file mode 100644 index 0000000000..fe29a91d8f --- /dev/null +++ b/slither/detectors/statements/unused_import.py @@ -0,0 +1,75 @@ +from typing import List +from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification, Output + +# pylint: disable=protected-access,too-many-nested-blocks +class UnusedImport(AbstractDetector): + """ + Detector unused imports. + """ + + ARGUMENT = "unused-import" + HELP = "Detects unused imports" + IMPACT = DetectorClassification.INFORMATIONAL + CONFIDENCE = DetectorClassification.HIGH + + WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#unused-imports" + + WIKI_TITLE = "Unused Imports" + WIKI_DESCRIPTION = "Importing a file that is not used in the contract likely indicates a mistake. The import should be removed until it is needed." + + # region wiki_exploit_scenario + WIKI_EXPLOIT_SCENARIO = """ + ```solidity + import {A} from "./A.sol"; + contract B {} + ``` + B either should import from A and it was forgotten or the import is not needed and should be removed. + """ + # endregion wiki_exploit_scenario + WIKI_RECOMMENDATION = ( + "Remove the unused import. If the import is needed later, it can be added back." + ) + + def _detect(self) -> List[Output]: + results: List[Output] = [] + # This is computed lazily and then memoized so we need to trigger the computation. + self.slither._compute_offsets_to_ref_impl_decl() + + for unit in self.slither.compilation_units: + for filename, scope in unit.scopes.items(): + unused = [] + for i in scope.imports: + # `scope.imports` contains all transitive imports so we need to filter out imports not explicitly imported in the file. + # Otherwise, we would recommend removing an import that is used by a leaf contract and cause compilation errors. + if i.scope != scope: + continue + + import_path = self.slither.crytic_compile.filename_lookup(i.filename) + + use_found = False + # Search through all references to the imported file + for _, refs in self.slither._offset_to_references[import_path].items(): + for ref in refs: + # If there is a reference in this file to the imported file, it is used. + if ref.filename == filename: + use_found = True + break + + if use_found: + break + + if not use_found: + unused.append(f"{i.source_mapping.content} ({i.source_mapping})") + + if len(unused) > 0: + unused_list = "\n\t-" + "\n\t-".join(unused) + + results.append( + self.generate_result( + [ + f"The following unused import(s) in {filename.used} should be removed: {unused_list}\n", + ] + ) + ) + + return results diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_C_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_C_sol__0.txt new file mode 100644 index 0000000000..f5556857be --- /dev/null +++ b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_C_sol__0.txt @@ -0,0 +1,6 @@ +The following unused import(s) in tests/e2e/detectors/test_data/unused-imports/0.8.16/B.sol should be removed: + -import "./A.sol"; (tests/e2e/detectors/test_data/unused-imports/0.8.16/B.sol#4) + +The following unused import(s) in tests/e2e/detectors/test_data/unused-imports/0.8.16/C.sol should be removed: + -import "./B.sol"; (tests/e2e/detectors/test_data/unused-imports/0.8.16/C.sol#4) + diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantContractLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantContractLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantContractLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantContractLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantTopLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantTopLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantTopLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ConstantTopLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ContractUsedInContractTest1_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ContractUsedInContractTest1_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ContractUsedInContractTest2_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ContractUsedInContractTest2_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ContractUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_ContractUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomErrorTopLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomErrorTopLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomEventContractLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomEventContractLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomEventContractLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomEventContractLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest1_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest1_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest2_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest2_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest3_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest3_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest4_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedInContractTest4_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedTopLevelTest1_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedTopLevelTest1_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedTopLevelTest2_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeContractLevelUsedTopLevelTest2_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest1_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest1_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest2_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest2_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest3_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest3_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest4_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedInContractTest4_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedTopLevelTest1_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedTopLevelTest1_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedTopLevelTest2_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_CustomTypeTopLevelUsedTopLevelTest2_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumContractLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumContractLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumContractLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumContractLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumTopLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumTopLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumTopLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_EnumTopLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionContractLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionContractLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionContractLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionContractLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionTopLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionTopLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionTopLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_FunctionTopLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_LibraryUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_LibraryUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_LibraryUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_LibraryUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructContractLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructContractLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructContractLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructContractLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructTopLevelUsedInContractTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructTopLevelUsedInContractTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructTopLevelUsedTopLevelTest_sol__0.txt b/tests/e2e/detectors/snapshots/detectors__detector_UnusedImport_0_8_16_StructTopLevelUsedTopLevelTest_sol__0.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/A.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/A.sol new file mode 100644 index 0000000000..e090793414 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/A.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +library A +{ + function a() public + { + + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/B.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/B.sol new file mode 100644 index 0000000000..0c51c99354 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/B.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./A.sol"; + +contract B +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/C.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/C.sol new file mode 100644 index 0000000000..cc978727bd --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/C.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./B.sol"; + +contract C +{ + constructor() + { + A.a(); + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/C.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/C.sol-0.8.16.zip new file mode 100644 index 0000000000..53f094deda Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/C.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevel.sol new file mode 100644 index 0000000000..d19dc26573 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevel.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +library ConstantContractLevel +{ + uint constant public CONSTANT = 0; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedInContractTest.sol new file mode 100644 index 0000000000..e63e3aea9c --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedInContractTest.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./ConstantContractLevel.sol"; + +contract ConstantContractLevelUsedInContractTest +{ + uint private v = ConstantContractLevel.CONSTANT; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..c9493124fa Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..b8ce9dd61d --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedTopLevelTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./ConstantContractLevel.sol"; + +uint constant __ = ConstantContractLevel.CONSTANT; + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..9be3aa487d Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantContractLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevel.sol new file mode 100644 index 0000000000..ed89e14da8 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevel.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +uint constant ConstantTopLevel = 0; + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedInContractTest.sol new file mode 100644 index 0000000000..916ba3a0fd --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedInContractTest.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./ConstantTopLevel.sol"; + +contract ConstantTopLevelUsedInContractTest +{ + uint private v = ConstantTopLevel; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..9dc9110335 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..a3466c3832 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedTopLevelTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./ConstantTopLevel.sol"; + +uint constant __ = ConstantTopLevel; + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy_ +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..ef39a1f2e7 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/ConstantTopLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/Contract.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/Contract.sol new file mode 100644 index 0000000000..0b2b326616 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/Contract.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +contract Contract +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest1.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest1.sol new file mode 100644 index 0000000000..733c0b05bf --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest1.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./Contract.sol"; + +contract ContractUsedInContractTest1 +{ + Contract c; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest1.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest1.sol-0.8.16.zip new file mode 100644 index 0000000000..e17f06327a Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest1.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest2.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest2.sol new file mode 100644 index 0000000000..96ccbb8d3a --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest2.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./Contract.sol"; + +contract ContractUsedInContractTest2 is Contract +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest2.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest2.sol-0.8.16.zip new file mode 100644 index 0000000000..af70ee5ecf Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedInContractTest2.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedTopLevelTest.sol new file mode 100644 index 0000000000..0c2adb4cd9 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedTopLevelTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./Contract.sol"; + +Contract constant c = Contract(address(0x0)); + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..a7db8fce0d Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/ContractUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevel.sol new file mode 100644 index 0000000000..5d2322b821 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevel.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +error err(); + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevelUsedInContractTest.sol new file mode 100644 index 0000000000..7bb05a98e1 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevelUsedInContractTest.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomErrorTopLevel.sol"; + +contract CustomErrorTopLevelUsedInContractTest +{ + constructor() + { + f(); + } + + function f() private pure + { + revert err(); + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..772d1d9c6d Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomErrorTopLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevel.sol new file mode 100644 index 0000000000..2114efa6d0 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevel.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +library CustomEventContractLevel +{ + event CustomEvent(); +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedInContractTest.sol new file mode 100644 index 0000000000..ae56e313f5 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedInContractTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomEventContractLevel.sol"; + +contract CustomEventContractLevelUsedInContractTest +{ + function f() public + { + emit CustomEventContractLevel.CustomEvent(); + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..c3a61506a8 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..712126b5f9 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedTopLevelTest.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomEventContractLevel.sol"; + +function f() +{ + emit CustomEventContractLevel.CustomEvent(); +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..d6a9a738bb Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomEventContractLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevel.sol new file mode 100644 index 0000000000..10e1b5df4f --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevel.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +contract CustomTypeContractLevel +{ + type CustomType is uint; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest1.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest1.sol new file mode 100644 index 0000000000..90f0d473cd --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest1.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeContractLevel.sol"; + +contract CustomTypeContractLevelUsedInContractTest1 +{ + CustomTypeContractLevel.CustomType private v; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest1.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest1.sol-0.8.16.zip new file mode 100644 index 0000000000..8ef93e5563 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest1.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest2.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest2.sol new file mode 100644 index 0000000000..f34e9003e9 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest2.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeContractLevel.sol"; + +contract CustomTypeContractLevelUsedInContractTest2 +{ + function f(CustomTypeContractLevel.CustomType) public + { + + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest2.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest2.sol-0.8.16.zip new file mode 100644 index 0000000000..ce2244ac8e Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest2.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest3.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest3.sol new file mode 100644 index 0000000000..d22fd9ce64 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest3.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeContractLevel.sol"; + +contract CustomTypeContractLevelUsedInContractTest3 +{ + modifier m() + { + CustomTypeContractLevel.CustomType ___; + _; + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest3.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest3.sol-0.8.16.zip new file mode 100644 index 0000000000..3c8b0acc49 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest3.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest4.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest4.sol new file mode 100644 index 0000000000..c010923b8d --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest4.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeContractLevel.sol"; + +contract CustomTypeContractLevelUsedInContractTest4 +{ + struct CustomStruct + { + CustomTypeContractLevel.CustomType ___; + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest4.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest4.sol-0.8.16.zip new file mode 100644 index 0000000000..8b86e24848 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedInContractTest4.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest1.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest1.sol new file mode 100644 index 0000000000..d745e645b7 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest1.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeContractLevel.sol"; + +struct CustomTypeContractLevelUsedTopLevelTest1 +{ + CustomTypeContractLevel.CustomType __; +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest1.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest1.sol-0.8.16.zip new file mode 100644 index 0000000000..af1a8f9b95 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest1.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest2.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest2.sol new file mode 100644 index 0000000000..3e6d5bac05 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest2.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeContractLevel.sol"; + +CustomTypeContractLevel.CustomType constant __ = CustomTypeContractLevel.CustomType.wrap(0); + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest2.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest2.sol-0.8.16.zip new file mode 100644 index 0000000000..f7c8452f8e Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeContractLevelUsedTopLevelTest2.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevel.sol new file mode 100644 index 0000000000..92bfe9e969 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevel.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +type CustomType is uint; + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest1.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest1.sol new file mode 100644 index 0000000000..7f543ee48e --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest1.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeTopLevel.sol"; + +contract CustomTypeTopLevelUsedInContractTest1 +{ + CustomType private v; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest1.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest1.sol-0.8.16.zip new file mode 100644 index 0000000000..bd27a67ef5 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest1.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest2.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest2.sol new file mode 100644 index 0000000000..04c0e201bc --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest2.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeTopLevel.sol"; + +contract CustomTypeTopLevelUsedInContractTest2 +{ + function f(CustomType) public + { + + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest2.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest2.sol-0.8.16.zip new file mode 100644 index 0000000000..e16787e063 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest2.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest3.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest3.sol new file mode 100644 index 0000000000..7abe65f932 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest3.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeTopLevel.sol"; + +contract CustomTypeTopLevelUsedInContractTest3 +{ + modifier m() + { + CustomType v; + _; + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest3.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest3.sol-0.8.16.zip new file mode 100644 index 0000000000..126ec2aada Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest3.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest4.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest4.sol new file mode 100644 index 0000000000..ef0d8110ac --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest4.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeTopLevel.sol"; + +contract CustomTypeTopLevelUsedInContractTest4 +{ + struct CustomStruct + { + CustomType ___; + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest4.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest4.sol-0.8.16.zip new file mode 100644 index 0000000000..c60e44f4e3 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedInContractTest4.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest1.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest1.sol new file mode 100644 index 0000000000..895bc00a1d --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest1.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeTopLevel.sol"; + +struct CustomTypeTopLevelUsedTopLevelTest1 +{ + CustomType __; +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy_ +{ + +} diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest1.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest1.sol-0.8.16.zip new file mode 100644 index 0000000000..ea2f57b93b Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest1.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest2.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest2.sol new file mode 100644 index 0000000000..b0e6a96ca7 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest2.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./CustomTypeTopLevel.sol"; + +CustomType constant __ = CustomType.wrap(0); + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy_ +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest2.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest2.sol-0.8.16.zip new file mode 100644 index 0000000000..5ba1891554 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/CustomTypeTopLevelUsedTopLevelTest2.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevel.sol new file mode 100644 index 0000000000..11ca02b8c7 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevel.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +contract EnumContractLevel +{ + enum CustomEnum + { + __ + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedInContractTest.sol new file mode 100644 index 0000000000..a16cbc4578 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedInContractTest.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./EnumContractLevel.sol"; + +contract EnumContractLevelUsedInContractTest +{ + uint private v = uint(EnumContractLevel.CustomEnum.__); +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..f3a580e4ee Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..c47b2765e6 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedTopLevelTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./EnumContractLevel.sol"; + +uint constant __ = uint(EnumContractLevel.CustomEnum.__); + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..39bc0132fb Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumContractLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevel.sol new file mode 100644 index 0000000000..d061c79e8e --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevel.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +enum EnumTopLevel +{ + __ +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedInContractTest.sol new file mode 100644 index 0000000000..6672d2d060 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedInContractTest.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./EnumTopLevel.sol"; + +contract EnumTopLevelUsedInContractTest +{ + uint private v = uint(EnumTopLevel.__); +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..defd5c3af5 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..c1cdf1015a --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedTopLevelTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./EnumTopLevel.sol"; + +uint constant __ = uint(EnumTopLevel.__); + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy_ +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..402c363c0d Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/EnumTopLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevel.sol new file mode 100644 index 0000000000..6a083b696d --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevel.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +library FunctionContractLevel +{ + function f() public pure + { + + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedInContractTest.sol new file mode 100644 index 0000000000..25b1c9b4cc --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedInContractTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./FunctionContractLevel.sol"; + +contract FunctionContractLevelUsedInContractTest +{ + function f2() private pure + { + FunctionContractLevel.f(); + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..504d983a9d Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..1b4a7dd3b5 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedTopLevelTest.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./FunctionContractLevel.sol"; + +function f2() pure +{ + FunctionContractLevel.f(); +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..b4155f69b2 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionContractLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevel.sol new file mode 100644 index 0000000000..3d9c4d7718 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevel.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +function f() +{ + +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedInContractTest.sol new file mode 100644 index 0000000000..c8dbb487ce --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedInContractTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./FunctionTopLevel.sol"; + +contract FunctionTopLevelUsedInContractTest +{ + function f2() public + { + f(); + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..58afb6a625 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..85b14a5b1c --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedTopLevelTest.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./FunctionTopLevel.sol"; + +function f2() +{ + f(); +} + +contract Dummy_ // dummy contract needed, since otherwise f() call won't be analysed for some reason +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..136b6e6fe2 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/FunctionTopLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/Library.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/Library.sol new file mode 100644 index 0000000000..5a55dc2156 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/Library.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +library L +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedInContractTest.sol new file mode 100644 index 0000000000..6ecfd3c3f9 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedInContractTest.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./Library.sol"; + +contract LibraryUsedInContractTest +{ + using L for uint; +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..33ac2597f3 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedTopLevelTest.sol new file mode 100644 index 0000000000..059ad17762 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedTopLevelTest.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +// Top level UsingForDirective not supported yet in Slither. +// The following code may be uncommented when the support is added. +/* +import "./Library.sol"; + +using L for uint; +*/ + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..9929912ad2 Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/LibraryUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevel.sol new file mode 100644 index 0000000000..5b1bf60eef --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevel.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +contract StructContractLevel +{ + struct CustomStruct + { + uint __; + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedInContractTest.sol new file mode 100644 index 0000000000..839e36b7e0 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedInContractTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./StructContractLevel.sol"; + +contract StructContractLevelUsedInContractTest +{ + struct CustomStruct + { + StructContractLevel.CustomStruct __; + } +} diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..10ff1fdb4a Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..0b3a733c0a --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedTopLevelTest.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./StructContractLevel.sol"; + +struct CustomStruct +{ + StructContractLevel.CustomStruct __; +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..c2d7968aea Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructContractLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevel.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevel.sol new file mode 100644 index 0000000000..e9d27d520f --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevel.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +struct StructTopLevel +{ + uint __; +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy +{ + +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedInContractTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedInContractTest.sol new file mode 100644 index 0000000000..4025e2c134 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedInContractTest.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./StructTopLevel.sol"; + +contract StructTopLevelUsedInContractTest +{ + struct CustomStruct + { + StructTopLevel __; + } +} \ No newline at end of file diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedInContractTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedInContractTest.sol-0.8.16.zip new file mode 100644 index 0000000000..826a8cb8fc Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedInContractTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedTopLevelTest.sol b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedTopLevelTest.sol new file mode 100644 index 0000000000..b2b16b43f7 --- /dev/null +++ b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedTopLevelTest.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: Unlicense +pragma solidity 0.8.16; + +import "./StructTopLevel.sol"; + +struct CustomStruct +{ + StructTopLevel __; +} + +// dummy contract, so that "No contract were found ..." message is not being thrown by Slither +contract Dummy_ +{ + +} diff --git a/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedTopLevelTest.sol-0.8.16.zip b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedTopLevelTest.sol-0.8.16.zip new file mode 100644 index 0000000000..5a490dae6f Binary files /dev/null and b/tests/e2e/detectors/test_data/unused-import/0.8.16/StructTopLevelUsedTopLevelTest.sol-0.8.16.zip differ diff --git a/tests/e2e/detectors/test_detectors.py b/tests/e2e/detectors/test_detectors.py index 611db02929..5604b57dd6 100644 --- a/tests/e2e/detectors/test_detectors.py +++ b/tests/e2e/detectors/test_detectors.py @@ -1684,6 +1684,191 @@ def id_test(test_item: Test): "out_of_order_retryable.sol", "0.8.20", ), + Test( + all_detectors.UnusedImport, + "ConstantContractLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "ConstantContractLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "ConstantTopLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "ConstantTopLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "ContractUsedInContractTest1.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "ContractUsedInContractTest2.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "ContractUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomErrorTopLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomEventContractLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomEventContractLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeContractLevelUsedInContractTest1.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeContractLevelUsedInContractTest2.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeContractLevelUsedInContractTest3.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeContractLevelUsedInContractTest4.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeContractLevelUsedTopLevelTest1.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeContractLevelUsedTopLevelTest2.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeTopLevelUsedInContractTest1.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeTopLevelUsedInContractTest2.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeTopLevelUsedInContractTest3.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeTopLevelUsedInContractTest4.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeTopLevelUsedTopLevelTest1.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "CustomTypeTopLevelUsedTopLevelTest2.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "EnumContractLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "EnumContractLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "EnumTopLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "EnumTopLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "FunctionContractLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "FunctionContractLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "FunctionTopLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "FunctionTopLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "LibraryUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "LibraryUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "StructContractLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "StructContractLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "StructTopLevelUsedInContractTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "StructTopLevelUsedTopLevelTest.sol", + "0.8.16", + ), + Test( + all_detectors.UnusedImport, + "C.sol", + "0.8.16", + ), ] GENERIC_PATH = "/GENERIC_PATH"