Skip to content

Commit

Permalink
review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Jan 4, 2024
1 parent d6ead2a commit 03c3782
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ repos:
src/core_codemods/docs/.*|
src/codemodder/dependency.py |
integration_tests/.*|
tests/codemods/test_remove_debug_breakpoint.py |
tests/test_codemodder.py
tests/.*
)$
- id: check-added-large-files
- repo: https://github.com/psf/black
Expand Down
9 changes: 7 additions & 2 deletions src/core_codemods/remove_debug_breakpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@

class RemoveDebugBreakpoint(BaseCodemod, NameResolutionMixin, AncestorPatternsMixin):
NAME = "remove-debug-breakpoint"
SUMMARY = "Remove Breakpoint"
SUMMARY = "Remove Calls to `builtin` `breakpoint` and `pdb.set_trace"
REVIEW_GUIDANCE = ReviewGuidance.MERGE_WITHOUT_REVIEW
DESCRIPTION = "Remove calls to builtin `breakpoint` or `pdb.set_trace."
DESCRIPTION = "Remove breakpoint call"
REFERENCES: list = []

def leave_Expr(
self, original_node: cst.Expr, _
) -> Union[cst.Expr, cst.RemovalSentinel]:
if not self.filter_by_path_includes_or_excludes(
self.node_position(original_node)
):
return original_node

match call_node := original_node.value:
case cst.Call():
if self.find_base_name(
Expand Down
11 changes: 5 additions & 6 deletions tests/codemods/test_remove_debug_breakpoint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from core_codemods.remove_debug_breakpoint import RemoveDebugBreakpoint
from tests.codemods.base_codemod_test import BaseCodemodTest
from textwrap import dedent


class TestRemoveDebugBreakpoint(BaseCodemodTest):
Expand All @@ -21,7 +20,7 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_builtin_breakpoint_multiple_statements(self, tmpdir):
Expand All @@ -37,7 +36,7 @@ def something():
print(var);
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_inline_pdb(self, tmpdir):
Expand All @@ -52,7 +51,7 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_pdb_import(self, tmpdir):
Expand All @@ -68,7 +67,7 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

def test_pdb_from_import(self, tmpdir):
Expand All @@ -84,5 +83,5 @@ def something():
var = 1
something()
"""
self.run_and_assert(tmpdir, dedent(input_code), dedent(expected))
self.run_and_assert(tmpdir, input_code, expected)
assert len(self.file_context.codemod_changes) == 1

0 comments on commit 03c3782

Please sign in to comment.