redup 0.3.3__tar.gz → 0.3.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {redup-0.3.3 → redup-0.3.5}/PKG-INFO +10 -2
  2. {redup-0.3.3 → redup-0.3.5}/README.md +1 -1
  3. {redup-0.3.3 → redup-0.3.5}/pyproject.toml +9 -1
  4. {redup-0.3.3 → redup-0.3.5}/src/redup/__init__.py +1 -1
  5. {redup-0.3.3 → redup-0.3.5}/src/redup/core/ts_extractor.py +39 -2
  6. {redup-0.3.3 → redup-0.3.5}/src/redup/reporters/enhanced_reporter.py +1 -1
  7. {redup-0.3.3 → redup-0.3.5}/src/redup.egg-info/PKG-INFO +10 -2
  8. {redup-0.3.3 → redup-0.3.5}/src/redup.egg-info/requires.txt +8 -0
  9. {redup-0.3.3 → redup-0.3.5}/LICENSE +0 -0
  10. {redup-0.3.3 → redup-0.3.5}/setup.cfg +0 -0
  11. {redup-0.3.3 → redup-0.3.5}/src/redup/__main__.py +0 -0
  12. {redup-0.3.3 → redup-0.3.5}/src/redup/cli_app/__init__.py +0 -0
  13. {redup-0.3.3 → redup-0.3.5}/src/redup/cli_app/main.py +0 -0
  14. {redup-0.3.3 → redup-0.3.5}/src/redup/core/__init__.py +0 -0
  15. {redup-0.3.3 → redup-0.3.5}/src/redup/core/config.py +0 -0
  16. {redup-0.3.3 → redup-0.3.5}/src/redup/core/differ.py +0 -0
  17. {redup-0.3.3 → redup-0.3.5}/src/redup/core/hasher.py +0 -0
  18. {redup-0.3.3 → redup-0.3.5}/src/redup/core/lsh_matcher.py +0 -0
  19. {redup-0.3.3 → redup-0.3.5}/src/redup/core/matcher.py +0 -0
  20. {redup-0.3.3 → redup-0.3.5}/src/redup/core/models.py +0 -0
  21. {redup-0.3.3 → redup-0.3.5}/src/redup/core/parallel_scanner.py +0 -0
  22. {redup-0.3.3 → redup-0.3.5}/src/redup/core/pipeline.py +0 -0
  23. {redup-0.3.3 → redup-0.3.5}/src/redup/core/planner.py +0 -0
  24. {redup-0.3.3 → redup-0.3.5}/src/redup/core/scanner.py +0 -0
  25. {redup-0.3.3 → redup-0.3.5}/src/redup/core/utils/__init__.py +0 -0
  26. {redup-0.3.3 → redup-0.3.5}/src/redup/core/utils/duplicate_finders.py +0 -0
  27. {redup-0.3.3 → redup-0.3.5}/src/redup/core/utils/function_extractor.py +0 -0
  28. {redup-0.3.3 → redup-0.3.5}/src/redup/core/utils/hash_utils.py +0 -0
  29. {redup-0.3.3 → redup-0.3.5}/src/redup/reporters/__init__.py +0 -0
  30. {redup-0.3.3 → redup-0.3.5}/src/redup/reporters/json_reporter.py +0 -0
  31. {redup-0.3.3 → redup-0.3.5}/src/redup/reporters/markdown_reporter.py +0 -0
  32. {redup-0.3.3 → redup-0.3.5}/src/redup/reporters/toon_reporter.py +0 -0
  33. {redup-0.3.3 → redup-0.3.5}/src/redup/reporters/yaml_reporter.py +0 -0
  34. {redup-0.3.3 → redup-0.3.5}/src/redup.egg-info/SOURCES.txt +0 -0
  35. {redup-0.3.3 → redup-0.3.5}/src/redup.egg-info/dependency_links.txt +0 -0
  36. {redup-0.3.3 → redup-0.3.5}/src/redup.egg-info/entry_points.txt +0 -0
  37. {redup-0.3.3 → redup-0.3.5}/src/redup.egg-info/top_level.txt +0 -0
  38. {redup-0.3.3 → redup-0.3.5}/tests/test_e2e.py +0 -0
  39. {redup-0.3.3 → redup-0.3.5}/tests/test_hasher.py +0 -0
  40. {redup-0.3.3 → redup-0.3.5}/tests/test_matcher.py +0 -0
  41. {redup-0.3.3 → redup-0.3.5}/tests/test_models.py +0 -0
  42. {redup-0.3.3 → redup-0.3.5}/tests/test_pipeline.py +0 -0
  43. {redup-0.3.3 → redup-0.3.5}/tests/test_planner.py +0 -0
  44. {redup-0.3.3 → redup-0.3.5}/tests/test_reporters.py +0 -0
  45. {redup-0.3.3 → redup-0.3.5}/tests/test_scanner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: redup
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: Code duplication analyzer and refactoring planner for LLMs
5
5
  Author-email: Tom Sapletta <tom@sapletta.com>
6
6
  License-Expression: Apache-2.0
@@ -59,6 +59,14 @@ Requires-Dist: tree-sitter-kotlin>=0.20; extra == "ast"
59
59
  Requires-Dist: tree-sitter-swift>=0.20; extra == "ast"
60
60
  Requires-Dist: tree-sitter-objc>=0.20; extra == "ast"
61
61
  Requires-Dist: tree-sitter-c-sharp>=0.20; extra == "ast"
62
+ Requires-Dist: tree-sitter-lua>=0.20; extra == "ast"
63
+ Requires-Dist: tree-sitter-graphql>=0.20; extra == "ast"
64
+ Requires-Dist: tree-sitter-dockerfile>=0.20; extra == "ast"
65
+ Requires-Dist: tree-sitter-make>=0.20; extra == "ast"
66
+ Requires-Dist: tree-sitter-vim>=0.20; extra == "ast"
67
+ Requires-Dist: tree-sitter-nginx>=0.20; extra == "ast"
68
+ Requires-Dist: tree-sitter-svelte>=0.20; extra == "ast"
69
+ Requires-Dist: tree-sitter-vue>=0.20; extra == "ast"
62
70
  Provides-Extra: lsh
63
71
  Requires-Dist: datasketch>=1.6; extra == "lsh"
64
72
  Provides-Extra: dev
@@ -75,7 +83,7 @@ Dynamic: license-file
75
83
  [![PyPI](https://img.shields.io/pypi/v/redup)](https://pypi.org/project/redup/)
76
84
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
77
85
  [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
78
- [![Version](https://img.shields.io/badge/version-0.3.3-green.svg)](https://pypi.org/project/redup/)
86
+ [![Version](https://img.shields.io/badge/version-0.3.5-green.svg)](https://pypi.org/project/redup/)
79
87
 
80
88
  reDUP scans codebases for duplicated functions, blocks, and structural patterns — then builds a prioritized refactoring map that LLMs can consume to eliminate redundancy systematically.
81
89
 
@@ -5,7 +5,7 @@
5
5
  [![PyPI](https://img.shields.io/pypi/v/redup)](https://pypi.org/project/redup/)
6
6
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
7
  [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
8
- [![Version](https://img.shields.io/badge/version-0.3.3-green.svg)](https://pypi.org/project/redup/)
8
+ [![Version](https://img.shields.io/badge/version-0.3.5-green.svg)](https://pypi.org/project/redup/)
9
9
 
10
10
  reDUP scans codebases for duplicated functions, blocks, and structural patterns — then builds a prioritized refactoring map that LLMs can consume to eliminate redundancy systematically.
11
11
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "redup"
7
- version = "0.3.3"
7
+ version = "0.3.5"
8
8
  description = "Code duplication analyzer and refactoring planner for LLMs"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -66,6 +66,14 @@ ast = [
66
66
  "tree-sitter-swift>=0.20",
67
67
  "tree-sitter-objc>=0.20",
68
68
  "tree-sitter-c-sharp>=0.20",
69
+ "tree-sitter-lua>=0.20",
70
+ "tree-sitter-graphql>=0.20",
71
+ "tree-sitter-dockerfile>=0.20",
72
+ "tree-sitter-make>=0.20",
73
+ "tree-sitter-vim>=0.20",
74
+ "tree-sitter-nginx>=0.20",
75
+ "tree-sitter-svelte>=0.20",
76
+ "tree-sitter-vue>=0.20",
69
77
  ]
70
78
  lsh = ["datasketch>=1.6"]
71
79
  dev = [
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "0.3.3"
5
+ __version__ = "0.3.5"
6
6
 
7
7
  from redup.core.models import (
8
8
  DuplicateFragment,
@@ -60,6 +60,8 @@ _LANGUAGE_MAPPING = {
60
60
  # Python (fallback to AST)
61
61
  ".py": "python",
62
62
  ".pyw": "python",
63
+ # Lua
64
+ ".lua": "lua",
63
65
  # Ruby
64
66
  ".rb": "ruby",
65
67
  ".rbw": "ruby",
@@ -335,6 +337,8 @@ def extract_functions_treesitter(source: str, file_path: str) -> list[CodeBlock]
335
337
  return _extract_functions_php(tree.root_node, source_lines, file_path)
336
338
  elif language_name == "bash":
337
339
  return _extract_functions_bash(tree.root_node, source_lines, file_path)
340
+ elif language_name == "lua":
341
+ return _extract_functions_lua(tree.root_node, source_lines, file_path)
338
342
  elif language_name in ("c", "cpp"):
339
343
  return _extract_functions_c_cpp(tree.root_node, source_lines, file_path)
340
344
  elif language_name in ("html", "xml"):
@@ -343,8 +347,8 @@ def extract_functions_treesitter(source: str, file_path: str) -> list[CodeBlock]
343
347
  return _extract_blocks_css(tree.root_node, source_lines, file_path)
344
348
  elif language_name == "sql":
345
349
  return _extract_blocks_sql(tree.root_node, source_lines, file_path)
346
- elif language_name in ("json", "yaml", "toml", "markdown", "embedded_template", "regex"):
347
- # Data formats and markup languages don't have functions in the traditional sense
350
+ elif language_name in ("json", "yaml", "toml", "markdown", "embedded_template", "regex", "graphql", "dockerfile", "make", "vim", "nginx", "svelte", "vue"):
351
+ # Data formats, markup languages, config files, and template languages don't have functions in the traditional sense
348
352
  return []
349
353
 
350
354
  return []
@@ -507,6 +511,39 @@ def _extract_blocks_sql(node: Any, source_lines: list[str], file_path: str) -> l
507
511
  return blocks
508
512
 
509
513
 
514
+ def _extract_functions_lua(node: Any, source_lines: list[str], file_path: str) -> list[CodeBlock]:
515
+ """Extract functions from Lua using tree-sitter."""
516
+ blocks = []
517
+
518
+ def traverse(node: Any, depth: int = 0) -> None:
519
+ if depth > 50:
520
+ return
521
+
522
+ node_type = node.type
523
+
524
+ # Function declarations (local function, function)
525
+ if node_type in ("function_declaration", "local_function"):
526
+ start_line = node.start_point[0] + 1
527
+ end_line = node.end_point[0] + 1
528
+
529
+ name_node = node.child_by_field_name("name")
530
+ function_name = name_node.text.decode() if name_node else "anonymous"
531
+
532
+ blocks.append(CodeBlock(
533
+ file=file_path,
534
+ line_start=start_line,
535
+ line_end=end_line,
536
+ text="\n".join(source_lines[start_line-1:end_line]),
537
+ function_name=function_name,
538
+ class_name=None,
539
+ ))
540
+
541
+ for child in node.children:
542
+ traverse(child, depth + 1)
543
+
544
+ return blocks
545
+
546
+
510
547
  def _extract_functions_c_sharp(node: Any, source_lines: list[str], file_path: str) -> list[CodeBlock]:
511
548
  """Extract functions from C# using tree-sitter."""
512
549
  blocks = []
@@ -264,7 +264,7 @@ class EnhancedReporter:
264
264
  "fragments": len(g.fragments),
265
265
  "similarity": g.similarity_score,
266
266
  "impact_score": g.impact_score,
267
- "saved_lines": g.saved_lines
267
+ "saved_lines": g.saved_lines_potential
268
268
  }
269
269
  for g in self.groups[:20] # Top 20 groups
270
270
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: redup
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: Code duplication analyzer and refactoring planner for LLMs
5
5
  Author-email: Tom Sapletta <tom@sapletta.com>
6
6
  License-Expression: Apache-2.0
@@ -59,6 +59,14 @@ Requires-Dist: tree-sitter-kotlin>=0.20; extra == "ast"
59
59
  Requires-Dist: tree-sitter-swift>=0.20; extra == "ast"
60
60
  Requires-Dist: tree-sitter-objc>=0.20; extra == "ast"
61
61
  Requires-Dist: tree-sitter-c-sharp>=0.20; extra == "ast"
62
+ Requires-Dist: tree-sitter-lua>=0.20; extra == "ast"
63
+ Requires-Dist: tree-sitter-graphql>=0.20; extra == "ast"
64
+ Requires-Dist: tree-sitter-dockerfile>=0.20; extra == "ast"
65
+ Requires-Dist: tree-sitter-make>=0.20; extra == "ast"
66
+ Requires-Dist: tree-sitter-vim>=0.20; extra == "ast"
67
+ Requires-Dist: tree-sitter-nginx>=0.20; extra == "ast"
68
+ Requires-Dist: tree-sitter-svelte>=0.20; extra == "ast"
69
+ Requires-Dist: tree-sitter-vue>=0.20; extra == "ast"
62
70
  Provides-Extra: lsh
63
71
  Requires-Dist: datasketch>=1.6; extra == "lsh"
64
72
  Provides-Extra: dev
@@ -75,7 +83,7 @@ Dynamic: license-file
75
83
  [![PyPI](https://img.shields.io/pypi/v/redup)](https://pypi.org/project/redup/)
76
84
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
77
85
  [![Python](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
78
- [![Version](https://img.shields.io/badge/version-0.3.3-green.svg)](https://pypi.org/project/redup/)
86
+ [![Version](https://img.shields.io/badge/version-0.3.5-green.svg)](https://pypi.org/project/redup/)
79
87
 
80
88
  reDUP scans codebases for duplicated functions, blocks, and structural patterns — then builds a prioritized refactoring map that LLMs can consume to eliminate redundancy systematically.
81
89
 
@@ -35,6 +35,14 @@ tree-sitter-kotlin>=0.20
35
35
  tree-sitter-swift>=0.20
36
36
  tree-sitter-objc>=0.20
37
37
  tree-sitter-c-sharp>=0.20
38
+ tree-sitter-lua>=0.20
39
+ tree-sitter-graphql>=0.20
40
+ tree-sitter-dockerfile>=0.20
41
+ tree-sitter-make>=0.20
42
+ tree-sitter-vim>=0.20
43
+ tree-sitter-nginx>=0.20
44
+ tree-sitter-svelte>=0.20
45
+ tree-sitter-vue>=0.20
38
46
 
39
47
  [dev]
40
48
  pytest>=7.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes