@Test public void should_exclude_by_content() throws Exception { String longContent = new String(new char[500]).replace("\0", "a") + "\n"; DefaultInputFile jsFile = TestInputFileBuilder.create("", "foo.css") .setLanguage("css") .setContents(longContent) .build(); assertThat(MINIFIED_FILES_FILTER.accept(jsFile)).isFalse(); }
@Override public boolean accept(InputFile file) { if (!CssLanguage.KEY.equals(file.language())) { return true; } try { boolean isMinified = hasMinifiedFileName(file) || hasExcessiveAverageLineLength(file); if (isMinified) { LOG.debug("File [" + file.uri() + "] looks like a minified file and will not be analyzed"); } return !isMinified; } catch (IOException e) { throw new IllegalStateException("Failed to read input file", e); } }
MinifiedFilesFilter implements InputFileFilter { @Override public boolean accept(InputFile file) { if (!CssLanguage.KEY.equals(file.language())) { return true; } try { boolean isMinified = hasMinifiedFileName(file) || hasExcessiveAverageLineLength(file); if (isMinified) { LOG.debug("File [" + file.uri() + "] looks like a minified file and will not be analyzed"); } return !isMinified; } catch (IOException e) { throw new IllegalStateException("Failed to read input file", e); } } }
MinifiedFilesFilter implements InputFileFilter { @Override public boolean accept(InputFile file) { if (!CssLanguage.KEY.equals(file.language())) { return true; } try { boolean isMinified = hasMinifiedFileName(file) || hasExcessiveAverageLineLength(file); if (isMinified) { LOG.debug("File [" + file.uri() + "] looks like a minified file and will not be analyzed"); } return !isMinified; } catch (IOException e) { throw new IllegalStateException("Failed to read input file", e); } }  }
MinifiedFilesFilter implements InputFileFilter { @Override public boolean accept(InputFile file) { if (!CssLanguage.KEY.equals(file.language())) { return true; } try { boolean isMinified = hasMinifiedFileName(file) || hasExcessiveAverageLineLength(file); if (isMinified) { LOG.debug("File [" + file.uri() + "] looks like a minified file and will not be analyzed"); } return !isMinified; } catch (IOException e) { throw new IllegalStateException("Failed to read input file", e); } }  @Override boolean accept(InputFile file); }
MinifiedFilesFilter implements InputFileFilter { @Override public boolean accept(InputFile file) { if (!CssLanguage.KEY.equals(file.language())) { return true; } try { boolean isMinified = hasMinifiedFileName(file) || hasExcessiveAverageLineLength(file); if (isMinified) { LOG.debug("File [" + file.uri() + "] looks like a minified file and will not be analyzed"); } return !isMinified; } catch (IOException e) { throw new IllegalStateException("Failed to read input file", e); } }  @Override boolean accept(InputFile file);  }