import org.sonar.scanner.scan.ScanProperties;
import org.sonar.scanner.util.ProgressReport;
+import static java.lang.String.format;
+
/**
* Index input files into {@link InputComponentStore}.
*/
checkIfAlreadyIndexed(inputFile);
componentStore.put(module.key(), inputFile);
issueExclusionsLoader.addMulticriteriaPatterns(inputFile);
- LOG.debug("'{}' indexed {}with language '{}'", projectRelativePath, type == Type.TEST ? "as test " : "", inputFile.language());
+ String langStr = inputFile.language() != null ? format("with language '%s'", inputFile.language()) : "with no language";
+ LOG.debug("'{}' indexed {}{}", projectRelativePath, type == Type.TEST ? "as test " : "", langStr);
evaluateCoverageExclusions(moduleCoverageAndDuplicationExclusions, inputFile);
evaluateDuplicationExclusions(moduleCoverageAndDuplicationExclusions, inputFile);
if (properties.preloadFileMetadata()) {
.build())
.execute();
+ assertThat(logTester.logs()).contains("'src/main/sample.java' indexed with no language");
assertThat(logTester.logs()).contains("3 files indexed");
assertThat(logTester.logs()).contains("'src/main/sample.xoo' generated metadata with charset 'UTF-8'");
assertThat(String.join("\n", logTester.logs())).doesNotContain("'src/main/sample.java' generated metadata");