|
17 | 17 | """ |
18 | 18 | JavaSitter module |
19 | 19 | """ |
| 20 | +import logging |
20 | 21 | from itertools import groupby |
21 | 22 | from typing import List, Set, Dict |
22 | 23 | from tree_sitter import Language, Node, Parser, Query, Tree |
23 | 24 | import tree_sitter_java as tsjava |
24 | | -from tree_sitter import Language, Node, Parser, Query |
25 | | - |
26 | 25 | from cldk.models.treesitter import Captures |
27 | 26 |
|
28 | | -import logging |
29 | | - |
30 | 27 | logger = logging.getLogger(__name__) |
31 | 28 |
|
32 | 29 |
|
| 30 | +# pylint: disable=too-many-public-methods |
33 | 31 | class JavaSitter: |
34 | 32 | """ |
35 | 33 | Treesitter for Java usecases. |
@@ -75,7 +73,7 @@ def syntax_error(node): |
75 | 73 | for child in node.children: |
76 | 74 | if syntax_error(child): |
77 | 75 | return True |
78 | | - except RecursionError as err: |
| 76 | + except RecursionError: |
79 | 77 | return True |
80 | 78 |
|
81 | 79 | return False |
@@ -108,6 +106,7 @@ def get_all_imports(self, source_code: str) -> Set[str]: |
108 | 106 | import_declerations: Captures = self.frame_query_and_capture_output(query="(import_declaration (scoped_identifier) @name)", code_to_process=source_code) |
109 | 107 | return {capture.node.text.decode() for capture in import_declerations} |
110 | 108 |
|
| 109 | + # TODO: This typo needs to be fixed (i.e., package not pacakge) |
111 | 110 | def get_pacakge_name(self, source_code: str) -> str: |
112 | 111 | """Get the package name from the source code. |
113 | 112 |
|
@@ -228,7 +227,7 @@ def safe_ascend(self, node: Node, ascend_count: int) -> Node: |
228 | 227 | def get_call_targets(self, method_body: str, declared_methods: dict) -> Set[str]: |
229 | 228 | """Generate a list of call targets from the method body. |
230 | 229 |
|
231 | | - Uses simple name resolution for finding the call targets. Nothing sophiscticed here. Just a simple search |
| 230 | + Uses simple name resolution for finding the call targets. Nothing sophisticated here. Just a simple search |
232 | 231 | over the AST. |
233 | 232 |
|
234 | 233 | Parameters |
|
0 commit comments