@Test public void exception_should_fail_analysis_if_configured_so() throws Exception { RuntimeException exception = new NumberFormatException(); PHPCheck check = new ExceptionRaisingCheck(exception); addInputFiles(ANALYZED_FILE); context.setSettings(new MapSettings().setProperty("sonar.internal.analysis.failFast", "true")); PHPSensor sensor = createSensor(check); assertThatThrownBy(() -> sensor.execute(context)) .isInstanceOf(IllegalStateException.class) .hasCause(exception) .hasMessageContaining("PHPSquidSensor.php"); }
@Override public void execute(SensorContext context) { 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); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { 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); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { 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); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter);  PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter, @Nullable PHPCustomRuleRepository[] customRuleRepositories);   PHPSensor(FileLinesContextFactory fileLinesContextFactory, PHPChecks checks, NoSonarFilter noSonarFilter); }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { 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); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter);  PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter, @Nullable PHPCustomRuleRepository[] customRuleRepositories);   PHPSensor(FileLinesContextFactory fileLinesContextFactory, PHPChecks checks, NoSonarFilter noSonarFilter); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); @Override String toString(); }
PHPSensor implements Sensor { @Override public void execute(SensorContext context) { 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); try { symbolScanner.execute(inputFiles); ProjectSymbolData projectSymbolData = symbolScanner.getProjectSymbolData(); new AnalysisScanner(context, projectSymbolData).execute(inputFiles); if (!inSonarLint(context)) { processTestsAndCoverage(context); } } catch (CancellationException e) { LOG.info(e.getMessage()); } } PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter);  PHPSensor(FileLinesContextFactory fileLinesContextFactory,
    CheckFactory checkFactory, NoSonarFilter noSonarFilter, @Nullable PHPCustomRuleRepository[] customRuleRepositories);   PHPSensor(FileLinesContextFactory fileLinesContextFactory, PHPChecks checks, NoSonarFilter noSonarFilter); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); @Override String toString();  }