Commit graph

20 commits

Author SHA1 Message Date
Sarthak Agarwal
353feab063 [Fix] Normalizer and expand its scope 2026-03-06 21:31:24 +05:30
Kevin Turcios
04a94f2b03 test: update tests for refactored language support
- Update discover_functions calls to new (source, file_path) signature
- Use language-specific FunctionOptimizer subclasses in tests
- Add explicit utf-8 encoding to read_text()/write_text() for Windows
- Fix pytest fixture in TestTsJestSkipsConversion (was __init__)
- Update nonexistent file tests for source-based discover_functions
- Remove unused imports
2026-03-02 06:09:06 -05:00
Kevin Turcios
ef99747697 refactor: move code_extractor, code_replacer to languages/python/static_analysis/ 2026-02-19 03:21:34 -05:00
mohammed ahmed
f800ae3d92
Merge branch 'main' into fix/js-jest30-loop-runner 2026-02-06 17:22:15 +02:00
ali
a6b936402d
fix: include same-class helper methods inside class wrapper for TypeScript
When optimizing TypeScript class methods that call other methods from the
same class, the helper methods were being appended OUTSIDE the class
definition. This caused syntax errors because class-specific keywords like
`private` are only valid inside a class body.

Changes:
- Add _find_same_class_helpers() method to identify helper methods belonging
  to the same class as the target method
- Modify extract_code_context() to include same-class helpers inside the
  class wrapper and filter them from the helpers list
- Fix all JavaScript/TypeScript tests by adding export keywords to test code
  so functions can be discovered by discover_functions()
- Add comprehensive tests for same-class helper extraction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:19:46 +02:00
Sarthak Agarwal
7d408551fd add ts/js multiple tests 2026-02-05 05:27:19 +05:30
mohammed ahmed
7f807e5a87
Merge branch 'main' into fix/js-skip-module-conversion-for-ts-jest 2026-02-03 14:11:51 +02:00
mohammed ahmed
677e46e59e
Merge branch 'main' into fix/js-skip-module-conversion-for-ts-jest 2026-02-03 02:18:18 +02:00
Saurabh Misra
028eadbc63
Merge branch 'main' into refactor/use-function-to-optimize-in-js 2026-02-02 16:15:41 -08:00
ali
20a32bb714
remove github ids from test 2026-02-03 02:10:35 +02:00
misrasaurabh1
a5edb73b13 fix: Use FunctionToOptimize field names consistently across JS code
- Fix field name mismatches: .name → .function_name, .start_line → .starting_line,
  .end_line → .ending_line, .start_col → .starting_col, .end_col → .ending_col
- Fix circular imports by creating function_types.py with FunctionParent
- Add lazy language registration via _ensure_languages_registered()
- Fix macOS symlink path resolution in ImportResolver
- Update all affected code and tests to use correct FunctionToOptimize attributes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 11:32:58 -08:00
ali
348a6eccd3
fix: skip module conversion only for TypeScript projects with ts-jest
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 17:27:41 +02:00
ali
067ef3920c
add new global definitions after their deps 2026-02-02 16:00:29 +02:00
Saurabh Misra
a3dd1b3484 fix: prevent imported types from being duplicated during code replacement
When the optimized code contains type definitions (interfaces, types) that
are already imported in the original file, the code replacer was incorrectly
adding them as new declarations because it only checked for existing
declarations, not imports.

Fix: In `_add_global_declarations_for_language`, also check for imported
names (default imports, named imports, namespace imports) and exclude them
from being added as new declarations.

This fixes the bug where imported interfaces like `TreeNode` were being
duplicated in the output even though they were already imported.

See: https://github.com/codeflash-ai/appsmith/pull/20

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:50:20 +00:00
misrasaurabh1
7f7053cd43 fix 2026-01-30 21:19:51 -08:00
ali
8f14682065
Merge branch 'main' of github.com:codeflash-ai/codeflash into multi-language 2026-01-29 19:01:17 +02:00
ali
81dac14b47
better code replacer and tests 2026-01-29 16:52:00 +02:00
misrasaurabh1
198487bf81 format and lint all 2026-01-29 01:39:48 -08:00
Sarthak Agarwal
2d5b33a361 strict tests for extractor and replacer 2026-01-29 03:38:44 +05:30
Sarthak Agarwal
2cc1fb2809 tests for extractor and replacer 2026-01-29 01:27:19 +05:30