Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump super-linter/super-linter from 4.9.2 to 6.6.0 #2480

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
pull_request:
branches: [master, dev]
paths:
- "**/*.py"
- "**.py"
schedule:
# run CI every day even if no PRs/merges occur
- cron: '0 12 * * *'
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
cp pyproject.toml .github/linters

- name: Black
uses: super-linter/super-linter/slim@v4.9.2
uses: super-linter/super-linter/slim@v6.6.0
if: always()
env:
# run linter on everything to catch preexisting problems
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
echo "::add-matcher::.github/workflows/matchers/yamllint.json"

- name: Lint everything else
uses: super-linter/super-linter/slim@v6.1.1
uses: super-linter/super-linter/slim@v6.6.0
if: always()
env:
# run linter on everything to catch preexisting problems
Expand All @@ -57,6 +57,7 @@ jobs:
VALIDATE_PYTHON_PYLINT: false
VALIDATE_PYTHON_BLACK: false
VALIDATE_PYTHON_ISORT: false
VALIDATE_PYTHON_RUFF: false
VALIDATE_JSON: false
VALIDATE_JAVASCRIPT_ES: false
VALIDATE_JAVASCRIPT_STANDARD: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
echo "::add-matcher::.github/workflows/matchers/pylint.json"

- name: Pylint
uses: super-linter/super-linter/slim@v6.1.1
uses: super-linter/super-linter/slim@v6.6.0
if: always()
env:
# Run linters only on new files for pylint to speed up the CI
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
],
extras_require={
"lint": [
"black==22.3.0",
"pylint==3.0.3",
"black==24.4.2",
"pylint==3.2.2",
],
"test": [
"pytest",
Expand Down
3 changes: 3 additions & 0 deletions slither/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""
.. include:: ../README.md
"""

from .slither import Slither

__all__ = ["Slither"]
8 changes: 4 additions & 4 deletions slither/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ def _process(
###################################################################################


def get_detectors_and_printers() -> Tuple[
List[Type[AbstractDetector]], List[Type[AbstractPrinter]]
]:
def get_detectors_and_printers() -> (
Tuple[List[Type[AbstractDetector]], List[Type[AbstractPrinter]]]
):
detectors_ = [getattr(all_detectors, name) for name in dir(all_detectors)]
detectors = [d for d in detectors_ if inspect.isclass(d) and issubclass(d, AbstractDetector)]

Expand Down Expand Up @@ -825,7 +825,7 @@ def main_impl(

default_log = logging.INFO if not args.debug else logging.DEBUG

for (l_name, l_level) in [
for l_name, l_level in [
("Slither", default_log),
("Contract", default_log),
("Function", default_log),
Expand Down
9 changes: 9 additions & 0 deletions slither/all_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
"""
This module import all slither exceptions
"""

# pylint: disable=unused-import
from slither.slithir.exceptions import SlithIRError
from slither.solc_parsing.exceptions import ParsingError, VariableNotFound
from slither.core.exceptions import SlitherCoreError
from slither.exceptions import SlitherException

__all__ = [
"SlithIRError",
"ParsingError",
"VariableNotFound",
"SlitherCoreError",
"SlitherException",
]
11 changes: 6 additions & 5 deletions slither/analyses/data_dependency/data_dependency.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Compute the data depenency between all the SSA variables
"""

from collections import defaultdict
from typing import Union, Set, Dict, TYPE_CHECKING, List

Expand Down Expand Up @@ -380,8 +381,8 @@ def propagate_function(
transitive_close_dependencies(function, context_key, context_key_non_ssa)
# Propage data dependency
data_depencencies = function.context[context_key]
for (key, values) in data_depencencies.items():
if not key in contract.context[context_key]:
for key, values in data_depencencies.items():
if key not in contract.context[context_key]:
contract.context[context_key][key] = set(values)
else:
contract.context[context_key][key].union(values)
Expand Down Expand Up @@ -413,7 +414,7 @@ def propagate_contract(contract: Contract, context_key: str, context_key_non_ssa


def add_dependency(lvalue: Variable, function: Function, ir: Operation, is_protected: bool) -> None:
if not lvalue in function.context[KEY_SSA]:
if lvalue not in function.context[KEY_SSA]:
function.context[KEY_SSA][lvalue] = set()
if not is_protected:
function.context[KEY_SSA_UNPROTECTED][lvalue] = set()
Expand Down Expand Up @@ -493,9 +494,9 @@ def convert_to_non_ssa(
) -> Dict[SUPPORTED_TYPES, Set[SUPPORTED_TYPES]]:
# Need to create new set() as its changed during iteration
ret: Dict[SUPPORTED_TYPES, Set[SUPPORTED_TYPES]] = {}
for (k, values) in data_depencies.items():
for k, values in data_depencies.items():
var = convert_variable_to_non_ssa(k)
if not var in ret:
if var not in ret:
ret[var] = set()
ret[var] = ret[var].union({convert_variable_to_non_ssa(v) for v in values})

Expand Down
1 change: 1 addition & 0 deletions slither/analyses/write/are_variables_written.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Detect if all the given variables are written in all the paths of the function
"""

from collections import defaultdict
from typing import Dict, Set, List, Any, Optional

Expand Down
2 changes: 2 additions & 0 deletions slither/core/cfg/node.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Node module
"""

from enum import Enum
from typing import Optional, List, Set, Dict, Tuple, Union, TYPE_CHECKING

Expand Down Expand Up @@ -106,6 +107,7 @@ class NodeType(Enum):

# endregion


# I am not sure why, but pylint reports a lot of "no-member" issue that are not real (Josselin)
# pylint: disable=no-member
class Node(SourceMapping): # pylint: disable=too-many-public-methods
Expand Down
26 changes: 26 additions & 0 deletions slither/core/declarations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,29 @@
from .custom_error_top_level import CustomErrorTopLevel
from .custom_error import CustomError
from .solidity_import_placeholder import SolidityImportPlaceHolder

__all__ = [
"Contract",
"Enum",
"Event",
"EventContract",
"EventTopLevel",
"Function",
"Import",
"Modifier",
"Pragma",
"SolidityVariable",
"SolidityVariableComposed",
"SolidityFunction",
"Structure",
"EnumContract",
"EnumTopLevel",
"StructureContract",
"StructureTopLevel",
"FunctionContract",
"FunctionTopLevel",
"CustomErrorContract",
"CustomErrorTopLevel",
"CustomError",
"SolidityImportPlaceHolder",
]
12 changes: 7 additions & 5 deletions slither/core/declarations/contract.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""""
Contract module
"""

import logging
from collections import defaultdict
from pathlib import Path
Expand Down Expand Up @@ -32,6 +33,7 @@
from slither.utils.type_helpers import LibraryCallType, HighLevelCallType, InternalCallType
from slither.core.declarations import (
Enum,
Event,
EventContract,
Modifier,
EnumContract,
Expand Down Expand Up @@ -527,9 +529,9 @@ def state_variables_used_in_reentrant_targets(

if self._state_variables_used_in_reentrant_targets is None:
reentrant_functions = [f for f in self.functions_entry_points if f.is_reentrant]
variables_used: Dict[
StateVariable, Set[Union[StateVariable, "Function"]]
] = defaultdict(set)
variables_used: Dict[StateVariable, Set[Union[StateVariable, "Function"]]] = (
defaultdict(set)
)
for function in reentrant_functions:
for ir in function.all_slithir_operations():
state_variables = [v for v in ir.used if isinstance(v, StateVariable)]
Expand Down Expand Up @@ -1454,7 +1456,7 @@ def add_constructor_variables(self) -> None:
from slither.core.declarations.function_contract import FunctionContract

if self.state_variables:
for (idx, variable_candidate) in enumerate(self.state_variables):
for idx, variable_candidate in enumerate(self.state_variables):
if variable_candidate.expression and not variable_candidate.is_constant:

constructor_variable = FunctionContract(self.compilation_unit)
Expand Down Expand Up @@ -1484,7 +1486,7 @@ def add_constructor_variables(self) -> None:
counter += 1
break

for (idx, variable_candidate) in enumerate(self.state_variables):
for idx, variable_candidate in enumerate(self.state_variables):
if variable_candidate.expression and variable_candidate.is_constant:

constructor_variable = FunctionContract(self.compilation_unit)
Expand Down
3 changes: 2 additions & 1 deletion slither/core/declarations/function.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Function module
"""

import logging
from abc import abstractmethod, ABCMeta
from collections import namedtuple
Expand Down Expand Up @@ -619,7 +620,7 @@ def nodes_ordered_dominators(self) -> List["Node"]:

for node in self.nodes:
# if node.type == NodeType.OTHER_ENTRYPOINT:
if not node in self._nodes_ordered_dominators:
if node not in self._nodes_ordered_dominators:
self._compute_nodes_ordered_dominators(node)

return self._nodes_ordered_dominators
Expand Down
1 change: 1 addition & 0 deletions slither/core/declarations/function_contract.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Function module
"""

from typing import Dict, TYPE_CHECKING, List, Tuple, Optional

from slither.core.declarations.contract_level import ContractLevel
Expand Down
1 change: 1 addition & 0 deletions slither/core/declarations/function_top_level.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Function module
"""

from typing import Dict, List, Tuple, TYPE_CHECKING, Optional

from slither.core.declarations import Function
Expand Down
1 change: 1 addition & 0 deletions slither/core/declarations/modifier.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Modifier module
"""

from .function_contract import FunctionContract


Expand Down
1 change: 1 addition & 0 deletions slither/core/declarations/solidity_import_placeholder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Special variable to model import with renaming
"""

from typing import Union

from slither.core.declarations import Import
Expand Down
1 change: 1 addition & 0 deletions slither/core/dominators/node_dominator_tree.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Nodes of the dominator tree
"""

from typing import TYPE_CHECKING, Set, List

if TYPE_CHECKING:
Expand Down
26 changes: 26 additions & 0 deletions slither/core/expressions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,29 @@
from .tuple_expression import TupleExpression
from .type_conversion import TypeConversion
from .unary_operation import UnaryOperation, UnaryOperationType
from .expression import Expression

__all__ = [
"AssignmentOperation",
"AssignmentOperationType",
"BinaryOperation",
"BinaryOperationType",
"CallExpression",
"ConditionalExpression",
"ElementaryTypeNameExpression",
"Expression",
"Identifier",
"IndexAccess",
"Literal",
"MemberAccess",
"NewArray",
"NewContract",
"NewElementaryType",
"SuperCallExpression",
"SuperIdentifier",
"SelfIdentifier",
"TupleExpression",
"TypeConversion",
"UnaryOperation",
"UnaryOperationType",
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This expression does nothing, if a contract used it, its probably a bug
"""

from slither.core.expressions.expression import Expression
from slither.core.solidity_types.type import Type
from slither.core.solidity_types.elementary_type import ElementaryType
Expand Down
25 changes: 20 additions & 5 deletions slither/core/scope/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ def bytecode_init(
Returns:

"""
getter: Callable[[SourceUnit], Dict[str, str]] = lambda x: x.bytecodes_init

def getter(x: SourceUnit) -> Dict[str, str]:
return x.bytecodes_init

return self._generic_source_unit_getter(
crytic_compile_compilation_unit, contract_name, getter
)
Expand All @@ -152,7 +155,10 @@ def bytecode_runtime(
Returns:

"""
getter: Callable[[SourceUnit], Dict[str, str]] = lambda x: x.bytecodes_runtime

def getter(x: SourceUnit) -> Dict[str, str]:
return x.bytecodes_runtime

return self._generic_source_unit_getter(
crytic_compile_compilation_unit, contract_name, getter
)
Expand All @@ -170,7 +176,10 @@ def srcmap_init(
Returns:

"""
getter: Callable[[SourceUnit], Dict[str, List[str]]] = lambda x: x.srcmaps_init

def getter(x: SourceUnit) -> Dict[str, List[str]]:
return x.srcmaps_init

return self._generic_source_unit_getter(
crytic_compile_compilation_unit, contract_name, getter
)
Expand All @@ -188,7 +197,10 @@ def srcmap_runtime(
Returns:

"""
getter: Callable[[SourceUnit], Dict[str, List[str]]] = lambda x: x.srcmaps_runtime

def getter(x: SourceUnit) -> Dict[str, List[str]]:
return x.srcmaps_runtime

return self._generic_source_unit_getter(
crytic_compile_compilation_unit, contract_name, getter
)
Expand All @@ -204,7 +216,10 @@ def abi(self, crytic_compile_compilation_unit: CompilationUnit, contract_name: s
Returns:

"""
getter: Callable[[SourceUnit], Dict[str, List[str]]] = lambda x: x.abis

def getter(x: SourceUnit) -> Dict[str, List[str]]:
return x.abis

return self._generic_source_unit_getter(
crytic_compile_compilation_unit, contract_name, getter
)
Expand Down
Loading