Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLCORE-937: Don't fail when checks not possible #1101

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.google.common.util.concurrent.MoreExecutors;
import java.net.URI;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -757,8 +758,20 @@ private List<ClientInputFile> toInputFiles(String configScopeId, Path actualBase
.filter(not(fileExclusionService::isExcluded))
.filter(not(sonarLintGitIgnore::isFileIgnored))
.filter(userDefinedFilesFilter(configScopeId))
.filter(uri -> !Files.isSymbolicLink(Path.of(uri)))
.filter(uri -> !WindowsShortcutUtils.isWindowsShortcut(uri))
.filter(uri -> {
// On protocols with schemes like "temp" (used by IntelliJ in the integration tests) or "rse" (the Eclipse Remote System Explorer)
// and maybe others the check for a symbolic link or Windows shortcut will fail as these file systems cannot be resolved for the
// operations.
// If this happens, we won't exclude the file as the chance for someone to use a protocol with such a scheme while also using
// symbolic links or Windows shortcuts should be near zero and this is less error-prone than excluding the
try {
return !Files.isSymbolicLink(Path.of(uri)) && !WindowsShortcutUtils.isWindowsShortcut(uri);
} catch (FileSystemNotFoundException err) {
LOG.debug("Checking for symbolic links or Windows shortcuts in the file system is not possible for the URI '" + uri
+ "'. Therefore skipping the checks due to the underlying protocol / its scheme.", err);
return true;
}
})
.map(uri -> toInputFile(configScopeId, uri))
.filter(Objects::nonNull)
.collect(toList());
Expand Down