@Test public void should_stop_execution_when_sensor_context_is_cancelled() throws IOException { addInputFile("file.css"); context.setCancelled(true); sensor.execute(context); assertThat(context.allIssues()).isEmpty(); assertThat(logTester.logs(LoggerLevel.INFO)) .contains("java.util.concurrent.CancellationException: Analysis interrupted because the SensorContext is in cancelled state"); }
@Override public void execute(SensorContext context) { reportOldNodeProperty(context); List<InputFile> inputFiles = getInputFiles(context); if (inputFiles.isEmpty()) { LOG.info("No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped."); return; } File configFile = null; boolean serverRunning = false; try { serverRunning = cssAnalyzerBridgeServer.startServerLazily(context); configFile = createLinterConfig(context); } catch (Exception e) { String msg = "Failure during CSS analysis preparation, " + cssAnalyzerBridgeServer.getCommandInfo(); logErrorOrWarn(context, msg, e); throwFailFast(context, e); } if (serverRunning && configFile != null) { analyzeFiles(context, inputFiles, configFile); } }
CssRuleSensor implements Sensor { @Override public void execute(SensorContext context) { reportOldNodeProperty(context); List<InputFile> inputFiles = getInputFiles(context); if (inputFiles.isEmpty()) { LOG.info("No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped."); return; } File configFile = null; boolean serverRunning = false; try { serverRunning = cssAnalyzerBridgeServer.startServerLazily(context); configFile = createLinterConfig(context); } catch (Exception e) { String msg = "Failure during CSS analysis preparation, " + cssAnalyzerBridgeServer.getCommandInfo(); logErrorOrWarn(context, msg, e); throwFailFast(context, e); } if (serverRunning && configFile != null) { analyzeFiles(context, inputFiles, configFile); } } }
CssRuleSensor implements Sensor { @Override public void execute(SensorContext context) { reportOldNodeProperty(context); List<InputFile> inputFiles = getInputFiles(context); if (inputFiles.isEmpty()) { LOG.info("No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped."); return; } File configFile = null; boolean serverRunning = false; try { serverRunning = cssAnalyzerBridgeServer.startServerLazily(context); configFile = createLinterConfig(context); } catch (Exception e) { String msg = "Failure during CSS analysis preparation, " + cssAnalyzerBridgeServer.getCommandInfo(); logErrorOrWarn(context, msg, e); throwFailFast(context, e); } if (serverRunning && configFile != null) { analyzeFiles(context, inputFiles, configFile); } } CssRuleSensor(
    CheckFactory checkFactory,
    CssAnalyzerBridgeServer cssAnalyzerBridgeServer,
    @Nullable AnalysisWarnings analysisWarnings
  ); }
CssRuleSensor implements Sensor { @Override public void execute(SensorContext context) { reportOldNodeProperty(context); List<InputFile> inputFiles = getInputFiles(context); if (inputFiles.isEmpty()) { LOG.info("No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped."); return; } File configFile = null; boolean serverRunning = false; try { serverRunning = cssAnalyzerBridgeServer.startServerLazily(context); configFile = createLinterConfig(context); } catch (Exception e) { String msg = "Failure during CSS analysis preparation, " + cssAnalyzerBridgeServer.getCommandInfo(); logErrorOrWarn(context, msg, e); throwFailFast(context, e); } if (serverRunning && configFile != null) { analyzeFiles(context, inputFiles, configFile); } } CssRuleSensor(
    CheckFactory checkFactory,
    CssAnalyzerBridgeServer cssAnalyzerBridgeServer,
    @Nullable AnalysisWarnings analysisWarnings
  ); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); static void throwFailFast(SensorContext context, Exception e); static boolean hasCssFiles(SensorContext context); }
CssRuleSensor implements Sensor { @Override public void execute(SensorContext context) { reportOldNodeProperty(context); List<InputFile> inputFiles = getInputFiles(context); if (inputFiles.isEmpty()) { LOG.info("No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped."); return; } File configFile = null; boolean serverRunning = false; try { serverRunning = cssAnalyzerBridgeServer.startServerLazily(context); configFile = createLinterConfig(context); } catch (Exception e) { String msg = "Failure during CSS analysis preparation, " + cssAnalyzerBridgeServer.getCommandInfo(); logErrorOrWarn(context, msg, e); throwFailFast(context, e); } if (serverRunning && configFile != null) { analyzeFiles(context, inputFiles, configFile); } } CssRuleSensor(
    CheckFactory checkFactory,
    CssAnalyzerBridgeServer cssAnalyzerBridgeServer,
    @Nullable AnalysisWarnings analysisWarnings
  ); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); static void throwFailFast(SensorContext context, Exception e); static boolean hasCssFiles(SensorContext context);  }