test_class.file: sonar-php-plugin/src/test/java/org/sonar/plugins/php/PhpExclusionsFileFilterTest.java
test_class.identifier: PhpExclusionsFileFilterTest
test_case.body: @Test(timeout = 2000)
    public void should_ignore_php_files_with_average_line_length_over_threshold() throws IOException {
      PhpExclusionsFileFilter filter = new PhpExclusionsFileFilter(new MapSettings().asConfig());
      File baseDir = new File("src/test/resources/exclusions");
      SensorContextTester context = SensorContextTester.create(baseDir);
      DefaultInputFile testFile = setupSingleFile(baseDir, context, "excluded.php");
      assertThat(filter.accept(testFile)).isFalse();
  
      // ignore header comment
      testFile = setupSingleFile(baseDir, context, "included.php");
      assertThat(filter.accept(testFile)).isTrue();
  
      // first line is not a comment nor a single php tag
      testFile = setupSingleFile(baseDir, context, "excluded2.php");
      assertThat(filter.accept(testFile)).isFalse();
  
      testFile = setupSingleFile(baseDir, context, "excluded3.php");
      assertThat(filter.accept(testFile)).isFalse();
  
      testFile = setupSingleFile(baseDir, context, "excluded4.php");
      assertThat(filter.accept(testFile)).isFalse();
  
      //
  
      testFile = setupSingleFile(baseDir, context, "unknown.php", "");
      try {
        filter.accept(testFile);
        fail("unknown file should have failed");
      } catch (AnalysisException ae) {
        assertThat(ae).hasMessage("Unable to read file 'unknown.php'");
      }
  
      testFile = setupSingleFile(baseDir, context, "empty.php");
      assertThat(filter.accept(testFile)).isTrue();
  
    }
test_case.class_method_signature: PhpExclusionsFileFilterTest.should_ignore_php_files_with_average_line_length_over_threshold()
test_case.full_signature: @Test(timeout = 2000) public void should_ignore_php_files_with_average_line_length_over_threshold()
test_case.identifier: should_ignore_php_files_with_average_line_length_over_threshold
test_case.invocations: asConfig create setupSingleFile isFalse assertThat accept setupSingleFile isTrue assertThat accept setupSingleFile isFalse assertThat accept setupSingleFile isFalse assertThat accept setupSingleFile isFalse assertThat accept setupSingleFile accept fail hasMessage assertThat setupSingleFile isTrue assertThat accept
test_case.modifiers: @Test(timeout = 2000) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_ignore_php_files_with_average_line_length_over_threshold()
focal_class.declarator: excludedPatterns
focal_class.modifier: private final
focal_class.original_string: private final String[] excludedPatterns;
focal_class.type: String[]
focal_class.var_name: excludedPatterns
focal_class.declarator: LOG = Loggers.get(PhpExclusionsFileFilter.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = Loggers.get(PhpExclusionsFileFilter.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: DEFAULT_AVERAGE_LINE_LENGTH_THRESHOLD = 220
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_AVERAGE_LINE_LENGTH_THRESHOLD = 220;
focal_class.type: int
focal_class.var_name: DEFAULT_AVERAGE_LINE_LENGTH_THRESHOLD
focal_class.file: sonar-php-plugin/src/main/java/org/sonar/plugins/php/PhpExclusionsFileFilter.java
focal_class.identifier: PhpExclusionsFileFilter
focal_class.interfaces: implements InputFileFilter
focal_class.class_method_signature: PhpExclusionsFileFilter.PhpExclusionsFileFilter(Configuration configuration)
focal_class.full_signature: public  PhpExclusionsFileFilter(Configuration configuration)
focal_class.identifier: PhpExclusionsFileFilter
focal_class.modifiers: public
focal_class.parameters: (Configuration configuration)
focal_class.signature:  PhpExclusionsFileFilter(Configuration configuration)
focal_class.class_method_signature: PhpExclusionsFileFilter.accept(InputFile inputFile)
focal_class.full_signature: @Override public boolean accept(InputFile inputFile)
focal_class.identifier: accept
focal_class.modifiers: @Override public
focal_class.parameters: (InputFile inputFile)
focal_class.return: boolean
focal_class.signature: boolean accept(InputFile inputFile)
focal_method.body: @Override
    public boolean accept(InputFile inputFile) {
      if (!Php.KEY.equals(inputFile.language())) {
        return true;
      }
  
      String relativePath = inputFile.uri().toString();
      if (WildcardPattern.match(WildcardPattern.create(excludedPatterns), relativePath)) {
        LOG.debug("File [" + inputFile.uri() + "] is excluded by '" + PhpPlugin.PHP_EXCLUSIONS_KEY + "' property and will not be analyzed");
        return false;
      }
  
      if (new AverageLineLengthCalculator(inputFile).getAverageLineLength() > DEFAULT_AVERAGE_LINE_LENGTH_THRESHOLD) {
        LOG.debug("File [" + inputFile.uri() + "] is excluded because it is considered generated (average line length is too big).");
        return false;
      }
  
      return true;
    }
focal_method.class_method_signature: PhpExclusionsFileFilter.accept(InputFile inputFile)
focal_method.full_signature: @Override public boolean accept(InputFile inputFile)
focal_method.identifier: accept
focal_method.invocations: equals language toString uri match create debug uri getAverageLineLength debug uri
focal_method.modifiers: @Override public
focal_method.parameters: (InputFile inputFile)
focal_method.return: boolean
focal_method.signature: boolean accept(InputFile inputFile)