mirror of
https://github.com/github/codeql.git
synced 2026-04-24 00:05:14 +02:00
C#: Exclude not existing or problematic files from extraction
This commit is contained in:
@@ -439,6 +439,25 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
|
||||
files = files.Where(f => !f.FullName.StartsWith(options.DotNetPath, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
files = files.Where(f =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (f.Exists)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
progressMonitor.Log(Severity.Warning, $"File {f.FullName} could not be processed.");
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
progressMonitor.Log(Severity.Warning, $"File {f.FullName} could not be processed: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
files = new FilePathFilter(sourceDir, progressMonitor).Filter(files);
|
||||
return files;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user