From bb8ad1800123f79005e8166b81d6637ffc1d89ae Mon Sep 17 00:00:00 2001 From: careworry Date: Thu, 18 Apr 2024 19:19:13 +0800 Subject: [PATCH] chore: fix some typos in comments Signed-off-by: careworry --- slither/core/declarations/function.py | 8 ++++---- slither/detectors/naming_convention/naming_convention.py | 2 +- slither/detectors/statements/divide_before_multiply.py | 4 ++-- slither/slithir/convert.py | 2 +- slither/tools/kspec_coverage/analysis.py | 2 +- tests/unit/slithir/test_ssa_generation.py | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/slither/core/declarations/function.py b/slither/core/declarations/function.py index 958a7d219..be215bd1f 100644 --- a/slither/core/declarations/function.py +++ b/slither/core/declarations/function.py @@ -1593,7 +1593,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu write_var = [x for x in write_var if x] write_var = [item for sublist in write_var for item in sublist] write_var = list(set(write_var)) - # Remove dupplicate if they share the same string representation + # Remove duplicate if they share the same string representation write_var = [ next(obj) for i, obj in groupby(sorted(write_var, key=lambda x: str(x)), lambda x: str(x)) @@ -1604,7 +1604,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu write_var = [x for x in write_var if x] write_var = [item for sublist in write_var for item in sublist] write_var = list(set(write_var)) - # Remove dupplicate if they share the same string representation + # Remove duplicate if they share the same string representation write_var = [ next(obj) for i, obj in groupby(sorted(write_var, key=lambda x: str(x)), lambda x: str(x)) @@ -1614,7 +1614,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu read_var = [x.variables_read_as_expression for x in self.nodes] read_var = [x for x in read_var if x] read_var = [item for sublist in read_var for item in sublist] - # Remove dupplicate if they share the same string representation + # Remove duplicate if they share the same string representation read_var = [ next(obj) for i, obj in groupby(sorted(read_var, key=lambda x: str(x)), lambda x: str(x)) @@ -1624,7 +1624,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu read_var = [x.variables_read for x in self.nodes] read_var = [x for x in read_var if x] read_var = [item for sublist in read_var for item in sublist] - # Remove dupplicate if they share the same string representation + # Remove duplicate if they share the same string representation read_var = [ next(obj) for i, obj in groupby(sorted(read_var, key=lambda x: str(x)), lambda x: str(x)) diff --git a/slither/detectors/naming_convention/naming_convention.py b/slither/detectors/naming_convention/naming_convention.py index 827cfe246..ab43318f1 100644 --- a/slither/detectors/naming_convention/naming_convention.py +++ b/slither/detectors/naming_convention/naming_convention.py @@ -16,7 +16,7 @@ class NamingConvention(AbstractDetector): Exceptions: - Allow constant variables name/symbol/decimals to be lowercase (ERC20) - - Allow '_' at the beggining of the mixed_case match for private variables and unused parameters + - Allow '_' at the beginning of the mixed_case match for private variables and unused parameters - Ignore echidna properties (functions with names starting 'echidna_' or 'crytic_' """ diff --git a/slither/detectors/statements/divide_before_multiply.py b/slither/detectors/statements/divide_before_multiply.py index 1f6ccd87e..e33477135 100644 --- a/slither/detectors/statements/divide_before_multiply.py +++ b/slither/detectors/statements/divide_before_multiply.py @@ -80,7 +80,7 @@ def _explore( for ir in node.irs: if isinstance(ir, Assignment): if ir.rvalue in divisions: - # Avoid dupplicate. We dont use set so we keep the order of the nodes + # Avoid duplicate. We dont use set so we keep the order of the nodes if node not in divisions[ir.rvalue]: # type: ignore divisions[ir.lvalue] = divisions[ir.rvalue] + [node] # type: ignore else: @@ -94,7 +94,7 @@ def _explore( nodes = [] for r in mul_arguments: if not isinstance(r, Constant) and (r in divisions): - # Dont add node already present to avoid dupplicate + # Dont add node already present to avoid duplicate # We dont use set to keep the order of the nodes if node in divisions[r]: nodes += [n for n in divisions[r] if n not in nodes] diff --git a/slither/slithir/convert.py b/slither/slithir/convert.py index b8ce460bf..7d8aa543b 100644 --- a/slither/slithir/convert.py +++ b/slither/slithir/convert.py @@ -482,7 +482,7 @@ def propagate_type_and_convert_call(result: List[Operation], node: "Node") -> Li call_data.remove(ins.variable) if isinstance(ins, Argument): - # In case of dupplicate arguments we overwrite the value + # In case of duplicate arguments we overwrite the value # This can happen because of addr.call.value(1).value(2) if ins.get_type() in [ArgumentType.GAS]: calls_gas[ins.call_id] = ins.argument diff --git a/slither/tools/kspec_coverage/analysis.py b/slither/tools/kspec_coverage/analysis.py index 763939e25..a2ae23660 100755 --- a/slither/tools/kspec_coverage/analysis.py +++ b/slither/tools/kspec_coverage/analysis.py @@ -59,7 +59,7 @@ def _get_all_covered_kspec_functions(target: str) -> Set[Tuple[str, str]]: def _get_slither_functions( slither: SlitherCompilationUnit, ) -> Dict[Tuple[str, str], Union[FunctionContract, StateVariable]]: - # Use contract == contract_declarer to avoid dupplicate + # Use contract == contract_declarer to avoid duplicate all_functions_declared: List[Union[FunctionContract, StateVariable]] = [ f for f in slither.functions diff --git a/tests/unit/slithir/test_ssa_generation.py b/tests/unit/slithir/test_ssa_generation.py index 1a709c2f7..2d6c9c8c1 100644 --- a/tests/unit/slithir/test_ssa_generation.py +++ b/tests/unit/slithir/test_ssa_generation.py @@ -502,7 +502,7 @@ def test_storage_refers_to(slither_from_solidity_source): When a phi-node is created, ensure refers_to is propagated to the phi-node. Assignments also propagate refers_to. Whenever a ReferenceVariable is the destination of an assignment (e.g. s.v = 10) - below, create additional versions of the variables it refers to record that a a + below, create additional versions of the variables it refers to record that a write was made. In the current implementation, this is referenced by phis. """ source = """