@Override public boolean test(String string) { return test(Paths.get(string)); } }
@Override public boolean test(String string) { return test(Paths.get(string)); } }
private boolean isExcludedByLocalConfiguration(ISonarLintFile file, boolean log) { String relativePath = file.getProjectRelativePath(); if (globalExclusions.test(relativePath)) { logIfNeeded(file, log, "global"); return true; } if (projectExclusions.test(relativePath)) { logIfNeeded(file, log, "project"); return true; } return false; }
/** * Checks if a file is excluded from analysis based on locally configured exclusions. * It will also exclude files that cannot be analysed with {@link #canAnalyze(VirtualFile, Module)}. */ public Result checkExclusions(VirtualFile file, @Nullable Module module) { Result result = canAnalyze(file, module); if (result.isExcluded()) { return result; } if (powerSaveModeCheck.getAsBoolean()) { return Result.excluded("power save mode is enabled"); } result = checkFileInSourceFolders(file, module); if (result.isExcluded) { return result; } String relativePath = appUtils.getRelativePathForAnalysis(module, file); if (relativePath == null) { return Result.excluded("Could not create a relative path"); } if (globalExclusions.test(relativePath)) { return Result.excluded("file matches exclusions defined in the SonarLint Global Settings"); } if (projectExclusions.test(relativePath)) { return Result.excluded("file matches exclusions defined in the SonarLint Project Settings"); } return Result.notExcluded(); }