Search in sources :

Example 1 with DurationStatistics

use of org.sonar.DurationStatistics in project sonar-php by SonarSource.

the class PHPSensor method execute.

@Override
public void execute(SensorContext context) {
    DurationStatistics statistics = new DurationStatistics(context.config());
    FileSystem fileSystem = context.fileSystem();
    FilePredicate phpFilePredicate = fileSystem.predicates().hasLanguage(Php.KEY);
    List<InputFile> inputFiles = new ArrayList<>();
    fileSystem.inputFiles(phpFilePredicate).forEach(inputFiles::add);
    SymbolScanner symbolScanner = new SymbolScanner(context, statistics);
    try {
        symbolScanner.execute(inputFiles);
        ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData();
        new AnalysisScanner(context, projectSymbolData, statistics).execute(inputFiles);
        if (!inSonarLint(context)) {
            processTestsAndCoverage(context);
        }
    } catch (CancellationException e) {
        LOG.info(e.getMessage());
    }
    statistics.log();
}
Also used : ProjectSymbolData(org.sonar.php.symbols.ProjectSymbolData) FilePredicate(org.sonar.api.batch.fs.FilePredicate) DurationStatistics(org.sonar.DurationStatistics) FileSystem(org.sonar.api.batch.fs.FileSystem) ArrayList(java.util.ArrayList) InputFile(org.sonar.api.batch.fs.InputFile)

Aggregations

ArrayList (java.util.ArrayList)1 DurationStatistics (org.sonar.DurationStatistics)1 FilePredicate (org.sonar.api.batch.fs.FilePredicate)1 FileSystem (org.sonar.api.batch.fs.FileSystem)1 InputFile (org.sonar.api.batch.fs.InputFile)1 ProjectSymbolData (org.sonar.php.symbols.ProjectSymbolData)1