Skip to content

Static code analysis tool runs even when there are compilation errors #77

@TharmiganK

Description

@TharmiganK

Description

$Subject

The scan rules implemented in the libraries expects a complete compilation result to do the analysis. Due to compilation errors, the compilation result can be invalid or incomplete. This can produce unexpected errors in the libraries' scan rule analysis flow.

If this is an expected behaviour. How do we avoid the unexpected errors?
Option 1: Implement the analysis flow by considering this and having redundant checks which can avoid the unexpected errors
Option 2: Check for compilation errors before hand and not running the scan rule analysis of the library

Steps to Reproduce

Try to run bal scan for the following content:

import ballerina/http;

service /api on new http:Listener(8080) {

    resource function default hello() returns string {
         // Return value is missing
    }
}

Version

Ballerina SwanLake Update 12

Environment Details (with versions)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions