Skip to content

Commit 6aa8796

Browse files
style: auto-fix linting issues
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent aa7eed1 commit 6aa8796

4 files changed

Lines changed: 9 additions & 23 deletions

File tree

codeflash/code_utils/edit_generated_tests.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,7 @@ def inject_test_globals(generated_tests: GeneratedTestsList, test_framework: str
376376
# we only inject test globals for esm modules
377377
# Use vitest imports for vitest projects, jest imports for jest projects
378378
if test_framework == "vitest":
379-
global_import = (
380-
"import { vi, describe, it, expect, beforeEach, afterEach, beforeAll, test } from 'vitest'\n"
381-
)
379+
global_import = "import { vi, describe, it, expect, beforeEach, afterEach, beforeAll, test } from 'vitest'\n"
382380
else:
383381
# Default to jest imports for jest and other frameworks
384382
global_import = (

codeflash/languages/javascript/parse.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
from junitparser.xunit2 import JUnitXml
1717

1818
from codeflash.cli_cmds.console import logger
19-
from codeflash.models.models import (
20-
FunctionTestInvocation,
21-
InvocationId,
22-
TestResults,
23-
TestType,
24-
)
19+
from codeflash.models.models import FunctionTestInvocation, InvocationId, TestResults, TestType
2520

2621
if TYPE_CHECKING:
2722
import subprocess

codeflash/languages/javascript/vitest_runner.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,7 @@ def run_vitest_behavioral_tests(
267267
# Pre-creating an empty directory may cause vitest to delete it
268268
logger.debug(f"Coverage will be written to: {coverage_dir}")
269269

270-
vitest_cmd.extend([
271-
"--coverage",
272-
"--coverage.reporter=json",
273-
f"--coverage.reportsDirectory={coverage_dir}",
274-
])
270+
vitest_cmd.extend(["--coverage", "--coverage.reporter=json", f"--coverage.reportsDirectory={coverage_dir}"])
275271
# Note: Removed --coverage.enabled=true (redundant) and --coverage.all false
276272
# The version mismatch between vitest and @vitest/coverage-v8 can cause
277273
# issues with coverage flag parsing. Let vitest use default settings.
@@ -339,8 +335,7 @@ def run_vitest_behavioral_tests(
339335
logger.debug(f"Vitest JUnit XML created: {result_file_path} ({file_size} bytes)")
340336
if file_size < 200: # Suspiciously small - likely empty or just headers
341337
logger.warning(
342-
f"Vitest JUnit XML is very small ({file_size} bytes). "
343-
f"Content: {result_file_path.read_text()[:500]}"
338+
f"Vitest JUnit XML is very small ({file_size} bytes). Content: {result_file_path.read_text()[:500]}"
344339
)
345340
else:
346341
logger.warning(

codeflash/optimization/function_optimizer.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def _handle_empty_queue(self) -> CandidateNode | None:
315315
self.future_all_code_repair,
316316
"Repairing {0} candidates",
317317
"Added {0} candidates from repair, total candidates now: {1}",
318-
lambda: self.future_all_code_repair.clear(),
318+
self.future_all_code_repair.clear,
319319
)
320320
if self.line_profiler_done and not self.refinement_done:
321321
return self._process_candidates(
@@ -330,7 +330,7 @@ def _handle_empty_queue(self) -> CandidateNode | None:
330330
self.future_adaptive_optimizations,
331331
"Applying adaptive optimizations to {0} candidates",
332332
"Added {0} candidates from adaptive optimization, total candidates now: {1}",
333-
lambda: self.future_adaptive_optimizations.clear(),
333+
self.future_adaptive_optimizations.clear,
334334
)
335335
return None # All done
336336

@@ -1908,11 +1908,9 @@ def setup_and_establish_baseline(
19081908
original_code_baseline, test_functions_to_remove = baseline_result.unwrap()
19091909
# Check test quantity for all languages
19101910
quantity_ok = quantity_of_tests_critic(original_code_baseline)
1911-
# ToDO: {Self} Only check coverage for Python - coverage infrastructure not yet reliable for JS/TS
1911+
# TODO: {Self} Only check coverage for Python - coverage infrastructure not yet reliable for JS/TS
19121912
coverage_ok = coverage_critic(original_code_baseline.coverage_results) if is_python() else True
1913-
if isinstance(original_code_baseline, OriginalCodeBaseline) and (
1914-
not coverage_ok or not quantity_ok
1915-
):
1913+
if isinstance(original_code_baseline, OriginalCodeBaseline) and (not coverage_ok or not quantity_ok):
19161914
if self.args.override_fixtures:
19171915
restore_conftest(original_conftest_content)
19181916
cleanup_paths(paths_to_cleanup)
@@ -2096,7 +2094,7 @@ def process_review(
20962094
formatted_generated_test = format_generated_code(concolic_test_str, self.args.formatter_cmds)
20972095
generated_tests_str += f"```{code_lang}\n{formatted_generated_test}\n```\n\n"
20982096

2099-
existing_tests, replay_tests, concolic_tests = existing_tests_source_for(
2097+
existing_tests, replay_tests, _ = existing_tests_source_for(
21002098
self.function_to_optimize.qualified_name_with_modules_from_root(self.project_root),
21012099
function_to_all_tests,
21022100
test_cfg=self.test_cfg,

0 commit comments

Comments
 (0)