Skip to content

New Issues could not be mapped to files under review #37

@kstevenard

Description

@kstevenard

I find out a case where new issues are identified by SonarQube but where the sonar-gerrit-plugin fails to map them to files under review.
this is when in the file path there is a "src" folder. The sonar-gerrit-plugin apparently use a shortened key for those files due to the following block of code:
protected String parseFileName(@NotNull String fileName) { return fileName.replaceFirst(MAVEN_ENTRY_REGEX, "src/"); }

If gerrit returns something like this:
{"/COMMIT_MSG":{"status":"A","lines_inserted":9},"a/b/c/src/x/y/z/a.source.file":{"lines_inserted":5}}
then it will keep in memory the following:
11:17:55.564 DEBUG - [GERRIT PLUGIN] Modified files in gerrit (keys) : [src/x/y/z/a.source.file] 11:17:55.564 DEBUG - [GERRIT PLUGIN] Modified files in gerrit (values): [a/b/c/src/x/y/z/a.source.file]
Which means that when later the plugin will check if a/b/c/src/x/y/z/a.source.file is under review it will not find it and will not post any comments:

11:17:55.615 DEBUG - [GERRIT PLUGIN] Decorate: a/b/c/src/x/y/z/a.source.file 11:17:55.615 DEBUG - [GERRIT PLUGIN] Start Sonar decoration for Gerrit 11:17:55.615 DEBUG - [GERRIT PLUGIN] Look for in Gerrit if the file was under review, name=a/b/c/src/x/y/z/a.source.file 11:17:55.615 DEBUG - [GERRIT PLUGIN] File a/b/c/src/x/y/z/a.source.file is not under review

Then is this parseFileName function really needed? is there cases when it should be done?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions