@Test public void should_not_analyze_files_with_not_file_uri() throws URISyntaxException, IOException { InputFile httpFile = mock(InputFile.class); when(httpFile.filename()).thenReturn("file.css"); when(httpFile.uri()).thenReturn(new URI("http: sensor.analyzeFile(context, httpFile, new File("config.json")); assertThat(String.join("\n", logTester.logs(LoggerLevel.DEBUG))) .matches("(?s).*Skipping \\S*file.css as it has not 'file' scheme.*") .doesNotMatch("(?s).*\nAnalyzing \\S*file.css.*"); }
void analyzeFile(SensorContext context, InputFile inputFile, File configFile) throws IOException { URI uri = inputFile.uri(); if (!"file".equalsIgnoreCase(uri.getScheme())) { LOG.debug("Skipping {} as it has not 'file' scheme", uri); return; } String fileContent = shouldSendFileContent(context, inputFile) ? inputFile.contents() : null; Request request = new Request(new File(uri).getAbsolutePath(), fileContent, configFile.toString()); LOG.debug("Analyzing " + request.filePath); Issue[] issues = cssAnalyzerBridgeServer.analyze(request); LOG.debug("Found {} issue(s)", issues.length); saveIssues(context, inputFile, issues); }
CssRuleSensor implements Sensor { void analyzeFile(SensorContext context, InputFile inputFile, File configFile) throws IOException { URI uri = inputFile.uri(); if (!"file".equalsIgnoreCase(uri.getScheme())) { LOG.debug("Skipping {} as it has not 'file' scheme", uri); return; } String fileContent = shouldSendFileContent(context, inputFile) ? inputFile.contents() : null; Request request = new Request(new File(uri).getAbsolutePath(), fileContent, configFile.toString()); LOG.debug("Analyzing " + request.filePath); Issue[] issues = cssAnalyzerBridgeServer.analyze(request); LOG.debug("Found {} issue(s)", issues.length); saveIssues(context, inputFile, issues); } }
CssRuleSensor implements Sensor { void analyzeFile(SensorContext context, InputFile inputFile, File configFile) throws IOException { URI uri = inputFile.uri(); if (!"file".equalsIgnoreCase(uri.getScheme())) { LOG.debug("Skipping {} as it has not 'file' scheme", uri); return; } String fileContent = shouldSendFileContent(context, inputFile) ? inputFile.contents() : null; Request request = new Request(new File(uri).getAbsolutePath(), fileContent, configFile.toString()); LOG.debug("Analyzing " + request.filePath); Issue[] issues = cssAnalyzerBridgeServer.analyze(request); LOG.debug("Found {} issue(s)", issues.length); saveIssues(context, inputFile, issues); } CssRuleSensor(
    CheckFactory checkFactory,
    CssAnalyzerBridgeServer cssAnalyzerBridgeServer,
    @Nullable AnalysisWarnings analysisWarnings
  ); }
CssRuleSensor implements Sensor { void analyzeFile(SensorContext context, InputFile inputFile, File configFile) throws IOException { URI uri = inputFile.uri(); if (!"file".equalsIgnoreCase(uri.getScheme())) { LOG.debug("Skipping {} as it has not 'file' scheme", uri); return; } String fileContent = shouldSendFileContent(context, inputFile) ? inputFile.contents() : null; Request request = new Request(new File(uri).getAbsolutePath(), fileContent, configFile.toString()); LOG.debug("Analyzing " + request.filePath); Issue[] issues = cssAnalyzerBridgeServer.analyze(request); LOG.debug("Found {} issue(s)", issues.length); saveIssues(context, inputFile, issues); } 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 { void analyzeFile(SensorContext context, InputFile inputFile, File configFile) throws IOException { URI uri = inputFile.uri(); if (!"file".equalsIgnoreCase(uri.getScheme())) { LOG.debug("Skipping {} as it has not 'file' scheme", uri); return; } String fileContent = shouldSendFileContent(context, inputFile) ? inputFile.contents() : null; Request request = new Request(new File(uri).getAbsolutePath(), fileContent, configFile.toString()); LOG.debug("Analyzing " + request.filePath); Issue[] issues = cssAnalyzerBridgeServer.analyze(request); LOG.debug("Found {} issue(s)", issues.length); saveIssues(context, inputFile, issues); } 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);  }