package pl.touk.sputnik.processor.sonar;

import java.util.List;

import org.sonar.runner.api.EmbeddedRunner;

import pl.touk.sputnik.review.Review;
import pl.touk.sputnik.review.ReviewFile;

import com.google.common.collect.Lists;

class SonarRunnerBuilder {
    public SonarRunner prepareRunner(Review review) {
        List<String> files = Lists.newArrayList();
        for (ReviewFile file : review.getFiles()) {
            files.add(file.getReviewFilename());
        }
        SonarRunner sonarRunner = new SonarRunner(files, EmbeddedRunner.create());
        return sonarRunner;
    }
}

@@ -31,24 +31,45 @@
 sor.sonar;%0A%0A
+import java.io.File;%0A
 import java.
@@ -378,16 +378,668 @@
 yList();
+%0A%0A        /*%0A         * Some sonar plugin do no include git path as the source file path (for%0A         * example, sonar-visual-studio plugin generates filenames that are relative%0A         * to the module csproj file).%0A         *%0A         * Using the file basename and a recursive match allows Sonar to match%0A         * modified files with their indexed names in Sonar.%0A         *%0A         * Although this can generate useless analysis (as some files that are not%0A         * included in a review may be analysed), this has a limited additional%0A         * cost considering that few files have the same basename inside a%0A         * repository.%0A         */
 %0A       
@@ -1105,16 +1105,33 @@
 les.add(
+%22**/%22 + new File(
 file.get
@@ -1143,24 +1143,35 @@
 wFilename())
+.getName())
 ;%0A        %7D%0A

Use file basename instead of fullname in sonar