cqfn / veniq

Veniq uses Machine Learning to analyze source code, find possible refactorings, and suggest those that seem optimal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Semi doesn't work with constructors

lyriccoder opened this issue · comments

If we pass a constructor to SEMI, it fails with the error:

Traceback (most recent call last):
  File "D:\git\veniq\veniq\dataset_collection\validation.py", line 88, in validate_row
    opport = _print_extraction_opportunities(
  File "D:\git\veniq\veniq\dataset_collection\validation.py", line 24, in _print_extraction_opportunities
    statements_semantic = extract_method_statements_semantic(method_ast)
  File "D:\git\veniq\veniq\baselines\semi\extract_semantic.py", line 12, in extract_method_statements_semantic
    block_statement_graph = build_block_statement_graph(method_ast)
  File "D:\git\veniq\veniq\ast_framework\block_statement_graph\builder.py", line 15, in build_block_statement_graph
    root_index = _build_graph_from_statement(method_ast.get_root(), graph)
  File "D:\git\veniq\veniq\ast_framework\block_statement_graph\builder.py", line 24, in _build_graph_from_statement
    blocks = extract_blocks_from_statement(statement)
  File "D:\git\veniq\veniq\ast_framework\block_statement_graph\_block_extractors.py", line 17, in extract_blocks_from_statement
    raise NotImplementedError(f"Node {statement.node_type} is not supported.")
NotImplementedError: Node Constructor declaration is not supported.

for part of the file (Constructor):
VmCustomizer_VmCustomizer_96.txt

 public VmCustomizer(final GlassfishInstance instance) {
        this.instance = instance;
        javaPlatforms = JavaUtils.findSupportedPlatforms(this.instance);
        this.platformButtonText = NbBundle.getMessage(
                VmCustomizer.class,
                "VmCustomizer.platformButton");
        this.platformButtonAction = new PlatformAct

Bug was fixed for block-statement graph but not for semantic extraction step in SEMI.