Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bohendo committed Jan 27, 2025
1 parent ade58c3 commit b68e731
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion slither/core/source_mapping/source_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def content(self) -> str:
# If the compilation unit was not initialized, it means that the set_offset was never called
# on the corresponding object, which should not happen
assert self.compilation_unit
return self.compilation_unit.core.source_code[self.filename.absolute].encode("utf-8")[self.start : self.end].decode("utf-8")
return (
self.compilation_unit.core.source_code[self.filename.absolute]
.encode("utf-8")[self.start : self.end]
.decode("utf-8")
)

@property
def content_hash(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion slither/tools/mutator/mutators/AOR.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _mutate(self) -> Dict:
if not line_no[0] in self.dont_mutate_line:
halves = old_str.split(ir.type.value)
if len(halves) != 2:
continue # skip if assembly
continue # skip if assembly
new_str = f"{halves[0]}{op.value}{halves[1]}"
create_patch_with_line(
result,
Expand Down
2 changes: 1 addition & 1 deletion slither/tools/mutator/mutators/BOR.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _mutate(self) -> Dict:
# Replace the expression with true
halves = old_str.split(ir.type.value)
if len(halves) != 2:
continue # skip if assembly
continue # skip if assembly
new_str = f"{halves[0]}{op.value}{halves[1]}"
create_patch_with_line(
result,
Expand Down
5 changes: 4 additions & 1 deletion slither/tools/mutator/mutators/RR.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from slither.tools.mutator.utils.patch import create_patch_with_line
from slither.tools.mutator.mutators.abstract_mutator import AbstractMutator


class RR(AbstractMutator): # pylint: disable=too-few-public-methods
NAME = "RR"
HELP = "Revert Replacement"
Expand All @@ -25,7 +26,9 @@ def _mutate(self) -> Dict:
old_str = node.source_mapping.content
line_no = node.source_mapping.lines[0]
if not line_no in self.dont_mutate_line:
if node.type == NodeType.RETURN and not old_str.lstrip().startswith("return"):
if node.type == NodeType.RETURN and not old_str.lstrip().startswith(
"return"
):
continue # skip the return declarations in fn signatures
if not old_str.lstrip().startswith("revert"):
new_str = "revert()"
Expand Down

0 comments on commit b68e731

Please sign in to comment.