tree-sitter-analyzer 1.2.0__py3-none-any.whl → 1.2.3__py3-none-any.whl

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.

Potentially problematic release.


This version of tree-sitter-analyzer might be problematic. Click here for more details.

@@ -150,7 +150,7 @@ class JavaElementExtractor(ElementExtractor):
150
150
  def extract_imports(
151
151
  self, tree: "tree_sitter.Tree", source_code: str
152
152
  ) -> list[Import]:
153
- """Extract Java import statements"""
153
+ """Extract Java import statements with enhanced robustness"""
154
154
  self.source_code = source_code
155
155
  self.content_lines = source_code.split("\n")
156
156
 
@@ -172,9 +172,73 @@ class JavaElementExtractor(ElementExtractor):
172
172
  # After package and imports come class declarations, so stop
173
173
  break
174
174
 
175
+ # Fallback: if no imports found via tree-sitter, try regex-based extraction
176
+ if not imports and "import" in source_code:
177
+ log_debug("No imports found via tree-sitter, trying regex fallback")
178
+ fallback_imports = self._extract_imports_fallback(source_code)
179
+ imports.extend(fallback_imports)
180
+
175
181
  log_debug(f"Extracted {len(imports)} imports")
176
182
  return imports
177
183
 
184
+ def _extract_imports_fallback(self, source_code: str) -> list[Import]:
185
+ """Fallback import extraction using regex when tree-sitter fails"""
186
+ imports = []
187
+ lines = source_code.split("\n")
188
+
189
+ for line_num, line in enumerate(lines, 1):
190
+ line = line.strip()
191
+ if line.startswith("import ") and line.endswith(";"):
192
+ # Extract import statement
193
+ import_content = line[:-1] # Remove semicolon
194
+
195
+ if "static" in import_content:
196
+ # Static import
197
+ static_match = re.search(r"import\s+static\s+([\w.]+)", import_content)
198
+ if static_match:
199
+ import_name = static_match.group(1)
200
+ if import_content.endswith(".*"):
201
+ import_name = import_name.replace(".*", "")
202
+ parts = import_name.split(".")
203
+ if len(parts) > 1:
204
+ import_name = ".".join(parts[:-1])
205
+
206
+ imports.append(Import(
207
+ name=import_name,
208
+ start_line=line_num,
209
+ end_line=line_num,
210
+ raw_text=line,
211
+ language="java",
212
+ module_name=import_name,
213
+ is_static=True,
214
+ is_wildcard=import_content.endswith(".*"),
215
+ import_statement=import_content,
216
+ ))
217
+ else:
218
+ # Normal import
219
+ normal_match = re.search(r"import\s+([\w.]+)", import_content)
220
+ if normal_match:
221
+ import_name = normal_match.group(1)
222
+ if import_content.endswith(".*"):
223
+ if import_name.endswith(".*"):
224
+ import_name = import_name[:-2]
225
+ elif import_name.endswith("."):
226
+ import_name = import_name[:-1]
227
+
228
+ imports.append(Import(
229
+ name=import_name,
230
+ start_line=line_num,
231
+ end_line=line_num,
232
+ raw_text=line,
233
+ language="java",
234
+ module_name=import_name,
235
+ is_static=False,
236
+ is_wildcard=import_content.endswith(".*"),
237
+ import_statement=import_content,
238
+ ))
239
+
240
+ return imports
241
+
178
242
  def extract_packages(
179
243
  self, tree: "tree_sitter.Tree", source_code: str
180
244
  ) -> list[Package]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tree-sitter-analyzer
3
- Version: 1.2.0
3
+ Version: 1.2.3
4
4
  Summary: Extensible multi-language code analyzer framework using Tree-sitter with dynamic plugin architecture
5
5
  Project-URL: Homepage, https://github.com/aimasteracc/tree-sitter-analyzer
6
6
  Project-URL: Documentation, https://github.com/aimasteracc/tree-sitter-analyzer#readme
@@ -163,11 +163,11 @@ Description-Content-Type: text/markdown
163
163
 
164
164
  [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
165
165
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
166
- [![Tests](https://img.shields.io/badge/tests-1504%20passed-brightgreen.svg)](#quality-assurance)
167
- [![Coverage](https://img.shields.io/badge/coverage-74.30%25-green.svg)](#quality-assurance)
166
+ [![Tests](https://img.shields.io/badge/tests-1514%20passed-brightgreen.svg)](#quality-assurance)
167
+ [![Coverage](https://img.shields.io/badge/coverage-74.10%25-green.svg)](#quality-assurance)
168
168
  [![Quality](https://img.shields.io/badge/quality-enterprise%20grade-blue.svg)](#quality-assurance)
169
169
  [![PyPI](https://img.shields.io/pypi/v/tree-sitter-analyzer.svg)](https://pypi.org/project/tree-sitter-analyzer/)
170
- [![Version](https://img.shields.io/badge/version-1.2.0-blue.svg)](https://github.com/aimasteracc/tree-sitter-analyzer/releases)
170
+ [![Version](https://img.shields.io/badge/version-1.2.3-blue.svg)](https://github.com/aimasteracc/tree-sitter-analyzer/releases)
171
171
  [![GitHub Stars](https://img.shields.io/github/stars/aimasteracc/tree-sitter-analyzer.svg?style=social)](https://github.com/aimasteracc/tree-sitter-analyzer)
172
172
 
173
173
  ## 🚀 Break LLM Token Limits, Let AI Understand Code Files of Any Size
@@ -734,16 +734,16 @@ Tree-sitter Analyzer automatically detects and protects project boundaries:
734
734
  ## 🏆 Quality Assurance
735
735
 
736
736
  ### 📊 **Quality Metrics**
737
- - **1,504 tests** - 100% pass rate ✅
738
- - **74.30% code coverage** - Industry-leading level
737
+ - **1,514 tests** - 100% pass rate ✅
738
+ - **74.24% code coverage** - Industry-leading level
739
739
  - **Zero test failures** - Fully CI/CD ready
740
740
  - **Cross-platform compatibility** - Windows, macOS, Linux
741
741
 
742
- ### ⚡ **Latest Quality Achievements (v1.2.0)**
742
+ ### ⚡ **Latest Quality Achievements (v1.2.3)**
743
743
  - ✅ **Cross-platform path compatibility** - Fixed Windows short path names and macOS symbolic link differences
744
744
  - ✅ **Windows environment** - Implemented robust path normalization using Windows API
745
745
  - ✅ **macOS environment** - Fixed `/var` vs `/private/var` symbolic link differences
746
- - ✅ **Comprehensive test coverage** - 1504 tests, 74.30% coverage
746
+ - ✅ **Comprehensive test coverage** - 1514 tests, 74.24% coverage
747
747
  - ✅ **GitFlow implementation** - Professional development/release branch strategy. See [GitFlow documentation](GITFLOW.md) for details.
748
748
 
749
749
  ### ⚙️ **Running Tests**
@@ -45,7 +45,7 @@ tree_sitter_analyzer/interfaces/cli_adapter.py,sha256=8j3xL3k6wWrGQCq0KCntqbvSxK
45
45
  tree_sitter_analyzer/interfaces/mcp_adapter.py,sha256=iSWcm-bn8_pL6YBu1Rrzherv72-5WUiavColu3uhSAY,7707
46
46
  tree_sitter_analyzer/interfaces/mcp_server.py,sha256=dUFn1CyO2jLa_y5gGOGE-f0sLGAbjgp738uy5-aAphI,16510
47
47
  tree_sitter_analyzer/languages/__init__.py,sha256=VTXxJgVjHJAciLhX0zzXOS4EygZMtebeYUbi_0z6fGw,340
48
- tree_sitter_analyzer/languages/java_plugin.py,sha256=ZTtDgyUdv-b9fFvCMEL3xS-yr0rfMueKkVleDybisag,47233
48
+ tree_sitter_analyzer/languages/java_plugin.py,sha256=jKr_CBOGWfDREQbism16XArwZ4TvmC4hS3RdhU6C1PQ,50355
49
49
  tree_sitter_analyzer/languages/javascript_plugin.py,sha256=k14kHfi5II9MRTsVuy0NQq5l2KZYncCnM1Q6T1c5q_U,15844
50
50
  tree_sitter_analyzer/languages/python_plugin.py,sha256=MJ03F_Nv-nmInIkEFmPyEXYhyGbLHyr5kCbj2taEDYk,29144
51
51
  tree_sitter_analyzer/mcp/__init__.py,sha256=8tC54ZYcZBcFEio-aDet7evzis50zV5gbHuvn_7K514,944
@@ -76,7 +76,7 @@ tree_sitter_analyzer/security/__init__.py,sha256=ZTqTt24hsljCpTXAZpJC57L7MU5lJLT
76
76
  tree_sitter_analyzer/security/boundary_manager.py,sha256=3eeENRKWtz2pyZHzd8DiVaq8fdeC6s1eVOuBylSmQPg,9347
77
77
  tree_sitter_analyzer/security/regex_checker.py,sha256=jWK6H8PTPgzbwRPfK_RZ8bBTS6rtEbgjY5vr3YWjQ_U,9616
78
78
  tree_sitter_analyzer/security/validator.py,sha256=yR4qTWEcXpR--bSFwtWvSgY0AzqujOFAqlc1Z7dlTdk,9809
79
- tree_sitter_analyzer-1.2.0.dist-info/METADATA,sha256=rdPbuoHTKqWV42JUSc8qQNE7EstPV8vL5Cfthmk-vvU,32970
80
- tree_sitter_analyzer-1.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
81
- tree_sitter_analyzer-1.2.0.dist-info/entry_points.txt,sha256=U4tfLGXgCWubKm2PyEb3zxhQ2pm7zVotMyfyS0CodD8,486
82
- tree_sitter_analyzer-1.2.0.dist-info/RECORD,,
79
+ tree_sitter_analyzer-1.2.3.dist-info/METADATA,sha256=CCFBPKrEicO0wogMoT87aQZ-RpaL9jzz3ej4tjUi2e8,32970
80
+ tree_sitter_analyzer-1.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
81
+ tree_sitter_analyzer-1.2.3.dist-info/entry_points.txt,sha256=U4tfLGXgCWubKm2PyEb3zxhQ2pm7zVotMyfyS0CodD8,486
82
+ tree_sitter_analyzer-1.2.3.dist-info/RECORD,,