Skip to content

Commit 97f98ee

Browse files
authored
chore: remove syntax highlight (#158)
1 parent df04fee commit 97f98ee

File tree

4 files changed

+1
-188
lines changed

4 files changed

+1
-188
lines changed

src/codegen/runner/diff/syntax_highlight.py

Lines changed: 0 additions & 162 deletions
This file was deleted.

src/codegen/runner/models/configs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class RunnerFeatureFlags(BaseModel):
2323
ts_dependency_manager: bool = False
2424

2525
import_resolution_overrides: dict[str, str] = {}
26-
syntax_highlight: bool = False
2726

2827
def encoded_json(self):
2928
return base64.b64encode(self.model_dump_json().encode("utf-8")).decode("utf-8")

src/codegen/runner/sandbox/executor.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
from codegen.git.models.pr_options import PROptions
88
from codegen.runner.diff.get_raw_diff import get_raw_diff
9-
from codegen.runner.diff.syntax_highlight import syntax_highlight_modified_files
109
from codegen.runner.models.codemod import BranchConfig, Codemod, CodemodRunResult, CreatedBranch, GroupingConfig
11-
from codegen.runner.models.configs import get_runner_feature_flags
1210
from codegen.runner.sandbox.repo import SandboxRepo
1311
from codegen.runner.utils.branch_name import get_head_branch_name
1412
from codegen.runner.utils.exception_utils import update_observation_meta
@@ -29,12 +27,10 @@ class SandboxExecutor:
2927

3028
codebase: CodebaseType
3129
remote_repo: SandboxRepo
32-
_is_syntax_highlight_enabled: bool
3330

3431
def __init__(self, codebase: CodebaseType):
3532
self.codebase = codebase
3633
self.remote_repo = SandboxRepo(self.codebase)
37-
self._is_syntax_highlight_enabled = get_runner_feature_flags().syntax_highlight
3834

3935
async def find_flags(self, execute_func: Callable) -> list[CodeFlag]:
4036
"""Runs the execute_func in find_mode to find flags"""
@@ -172,16 +168,6 @@ async def _get_structured_run_output(self, result: CodemodRunResult) -> CodemodR
172168
result.observation = raw_diff
173169
result.base_commit = self.codebase.current_commit.hexsha if self.codebase.current_commit else "HEAD"
174170

175-
if self._is_syntax_highlight_enabled:
176-
logger.info("> Syntax highlighting modified files")
177-
try:
178-
result.highlighted_diff = syntax_highlight_modified_files(self.codebase, raw_diff, flags)
179-
except Exception as e:
180-
# TODO: this doesn't work during webhooks. Maybe due to installation dependencies?
181-
logger.exception(f"Error! Failed to syntax highlight modified files: {e}")
182-
else:
183-
logger.info("> Skipping syntax highlighting, because feature flag is not enabled")
184-
185171
# =====[ Finalize CodemodRun state ]=====
186172
# Include logs etc.
187173
logger.info("> Extracting/formatting logs")

tests/unit/codegen/runner/sandbox/conftest.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ def codebase(tmpdir, request) -> Codebase:
2626

2727
@pytest.fixture
2828
def executor(codebase: Codebase) -> Generator[SandboxExecutor]:
29-
with patch("codegen.runner.sandbox.executor.get_runner_feature_flags") as mock_ff:
30-
mock_ff.return_value = RunnerFeatureFlags(syntax_highlight=False)
31-
32-
yield SandboxExecutor(codebase)
29+
yield SandboxExecutor(codebase)
3330

3431

3532
@pytest.fixture
@@ -42,13 +39,6 @@ def runner(codebase: Codebase, tmpdir):
4239
yield SandboxRunner(container_id="ta-123", repo_config=codebase.op.repo_config)
4340

4441

45-
@pytest.fixture(autouse=True)
46-
def mock_runner_flags():
47-
with patch("codegen.runner.sandbox.executor.get_runner_feature_flags") as mock_ff:
48-
mock_ff.return_value = RunnerFeatureFlags(syntax_highlight=False)
49-
yield mock_ff
50-
51-
5242
@pytest.fixture(autouse=True)
5343
def mock_codebase_config():
5444
with patch("codegen.runner.sandbox.runner.get_codebase_config") as mock_config:

0 commit comments

Comments
 (0)