Fix force lang

This commit is contained in:
Clément Fournier
2021-12-16 18:24:37 +01:00
parent 71cc6bcf6b
commit 5f0a5daa41
3 changed files with 6 additions and 2 deletions

View File

@ -223,7 +223,10 @@ public final class FileUtil {
private static void internalGetApplicableFiles(List<TextFile> files, PMDConfiguration configuration, Set<Language> languages) throws IOException {
List<String> ignoredFiles = getIgnoredFiles(configuration);
Predicate<Path> fileFilter = PredicateUtil.toFileFilter(new LanguageFilenameFilter(languages));
LanguageVersion forcedVersion = configuration.getForceLanguageVersion();
Predicate<Path> fileFilter =
forcedVersion != null ? Files::isRegularFile // accept everything except dirs
: PredicateUtil.toFileFilter(new LanguageFilenameFilter(languages));
fileFilter = fileFilter.and(path -> !ignoredFiles.contains(path.toString()));
for (String root : configuration.getAllInputPaths()) {

View File

@ -15,6 +15,7 @@ import net.sourceforge.pmd.lang.LanguageVersion;
/**
* A builder for a new text file.
* See static methods on {@link TextFile}.
*/
public abstract class TextFileBuilder {

View File

@ -94,7 +94,7 @@ public abstract class BaseCLITest {
protected void checkStatusCode(int expectedExitCode) {
int statusCode = getStatusCode();
if (statusCode != expectedExitCode) {
fail("PMD failed with status code:" + statusCode);
fail("PMD failed with status code: " + statusCode);
}
}