-
Notifications
You must be signed in to change notification settings - Fork 1
fix(CODEWIKI-005-2): CU-86akn96pk 2 review findings across 2 files #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,6 +161,15 @@ def _get_component_id(self, name: str, parent_class: str = None) -> str: | |
| return f"{module_path}::{parent_class}.{name}" | ||
| return f"{module_path}::{name}" | ||
|
|
||
| def _get_component_id_for_resolved_name(self, resolved_name: str) -> str: | ||
| """Generate a component ID for an already-resolved fully qualified name, | ||
| splitting into module path and component name and joining with '::'.""" | ||
| dotted = resolved_name.replace("\\", ".") | ||
| if "." in dotted: | ||
| module_path, name = dotted.rsplit(".", 1) | ||
| return f"{module_path}::{name}" | ||
| return f"{dotted}::{dotted}" | ||
|
|
||
| def _analyze(self): | ||
| """Parse and analyze the PHP file.""" | ||
| try: | ||
|
|
@@ -359,7 +368,7 @@ def _extract_relationships(self, node, depth: int = 0): | |
| resolved_base = self.namespace_resolver.resolve(base_name) | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=self._get_component_id(class_name), | ||
| callee=resolved_base.replace("\\", "."), | ||
| callee=self._get_component_id_for_resolved_name(resolved_base), | ||
| call_line=node.start_point[0] + 1, | ||
| is_resolved=False | ||
| )) | ||
|
Comment on lines
368
to
374
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΄ PHP component IDs fall back to a dot-joined base class instead of the '::' FQDN format Added new helper π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
|
|
@@ -376,7 +385,7 @@ def _extract_relationships(self, node, depth: int = 0): | |
| resolved_interface = self.namespace_resolver.resolve(interface_name) | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=self._get_component_id(implementer_name), | ||
| callee=resolved_interface.replace("\\", "."), | ||
| callee=self._get_component_id_for_resolved_name(resolved_interface), | ||
| call_line=node.start_point[0] + 1, | ||
| is_resolved=False | ||
| )) | ||
|
|
@@ -392,7 +401,7 @@ def _extract_relationships(self, node, depth: int = 0): | |
| resolved_type = self.namespace_resolver.resolve(created_type) | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=self._get_component_id(containing_class), | ||
| callee=resolved_type.replace("\\", "."), | ||
| callee=self._get_component_id_for_resolved_name(resolved_type), | ||
| call_line=node.start_point[0] + 1, | ||
| is_resolved=False | ||
| )) | ||
|
|
@@ -408,7 +417,7 @@ def _extract_relationships(self, node, depth: int = 0): | |
| resolved_target = self.namespace_resolver.resolve(target_class) | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=self._get_component_id(containing_class), | ||
| callee=resolved_target.replace("\\", "."), | ||
| callee=self._get_component_id_for_resolved_name(resolved_target), | ||
| call_line=node.start_point[0] + 1, | ||
| is_resolved=False | ||
| )) | ||
|
|
@@ -424,7 +433,7 @@ def _extract_relationships(self, node, depth: int = 0): | |
| resolved_type = self.namespace_resolver.resolve(type_name) | ||
| self.call_relationships.append(CallRelationship( | ||
| caller=self._get_component_id(containing_class), | ||
| callee=resolved_type.replace("\\", "."), | ||
| callee=self._get_component_id_for_resolved_name(resolved_type), | ||
| call_line=node.start_point[0] + 1, | ||
| is_resolved=False | ||
| )) | ||
|
|
@@ -604,3 +613,4 @@ def analyze_php_file(file_path: str, content: str, repo_path: str = None) -> Tup | |
| """ | ||
| analyzer = TreeSitterPHPAnalyzer(file_path, content, repo_path) | ||
| return analyzer.nodes, analyzer.call_relationships | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π΄ JavaScript analyzer's _extract_methods_from_class uses dot-separated method_key instead of the '::' FQDN separator used elsewhere
Changed
_extract_methods_from_class(both themethod_definitionbranch and thefield_definition/arrow-function branch) to buildmethod_keyviaself._get_component_id(method_name, class_name, is_method=True)instead of the ad-hocf"{self._get_module_path()}.{class_name}.{method_name}", aligning thetop_level_nodeskey with the::-separated FQDN convention used by_get_component_id/node.id. Also updated the matching lookup in_extract_call_from_node(themethod_keybuilt forthis./super.call resolution) to use_get_component_id(callee_name, current_class, is_method=True)so it stays consistent with the new key format used to populatetop_level_nodesβ without this companion change, method-call resolution againsttop_level_nodeswould have silently broken since the stored keys no longer match the old dot-separated lookup format. Other dot-separated ids elsewhere in the file (e.g. inheritance/call relationship caller/callee ids, JSDoc type ids) were left unchanged since the finding is scoped to_extract_methods_from_class'smethod_key/top_level_nodesinconsistency, and touching those would exceed the minimal fix intended here.π€ Prompt for AI agents
fix confidence: π‘ 85 medium β react π/π to teach the reviewer