-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Remove the term "whitelist" #3507
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,19 +12,19 @@ namespace Microsoft.CodeAnalysis.CompilerServer | |
{ | ||
internal static class AnalyzerConsistencyChecker | ||
{ | ||
private static readonly ImmutableArray<string> s_defaultWhiteList = ImmutableArray.Create("mscorlib", "System", "Microsoft.CodeAnalysis"); | ||
private static readonly ImmutableArray<string> s_defaultIgnorableReferenceNames = ImmutableArray.Create("mscorlib", "System", "Microsoft.CodeAnalysis"); | ||
|
||
public static bool Check(string baseDirectory, IEnumerable<CommandLineAnalyzerReference> analyzerReferences, IAnalyzerAssemblyLoader loader, IEnumerable<string> referenceWhiteList = null) | ||
public static bool Check(string baseDirectory, IEnumerable<CommandLineAnalyzerReference> analyzerReferences, IAnalyzerAssemblyLoader loader, IEnumerable<string> ignorableReferenceNames = null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
{ | ||
if (referenceWhiteList == null) | ||
if (ignorableReferenceNames == null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
{ | ||
referenceWhiteList = s_defaultWhiteList; | ||
ignorableReferenceNames = s_defaultIgnorableReferenceNames; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
} | ||
|
||
try | ||
{ | ||
CompilerServerLogger.Log("Begin Analyzer Consistency Check"); | ||
return CheckCore(baseDirectory, analyzerReferences, loader, referenceWhiteList); | ||
return CheckCore(baseDirectory, analyzerReferences, loader, ignorableReferenceNames); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
} | ||
catch (Exception e) | ||
{ | ||
|
@@ -37,7 +37,7 @@ public static bool Check(string baseDirectory, IEnumerable<CommandLineAnalyzerRe | |
} | ||
} | ||
|
||
private static bool CheckCore(string baseDirectory, IEnumerable<CommandLineAnalyzerReference> analyzerReferences, IAnalyzerAssemblyLoader loader, IEnumerable<string> referenceWhiteList) | ||
private static bool CheckCore(string baseDirectory, IEnumerable<CommandLineAnalyzerReference> analyzerReferences, IAnalyzerAssemblyLoader loader, IEnumerable<string> ignorableReferenceNames) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
{ | ||
var resolvedPaths = new List<string>(); | ||
|
||
|
@@ -56,14 +56,14 @@ private static bool CheckCore(string baseDirectory, IEnumerable<CommandLineAnaly | |
// Don't worry about paths we can't resolve. The compiler will report an error for that later. | ||
} | ||
|
||
// First, check that the set of references is complete, modulo items in the whitelist. | ||
// First, check that the set of references is complete, modulo items in the safe list. | ||
foreach (var resolvedPath in resolvedPaths) | ||
{ | ||
var missingDependencies = AssemblyUtilities.IdentifyMissingDependencies(resolvedPath, resolvedPaths); | ||
|
||
foreach (var missingDependency in missingDependencies) | ||
{ | ||
if (!referenceWhiteList.Any(name => missingDependency.Name.StartsWith(name))) | ||
if (!ignorableReferenceNames.Any(name => missingDependency.Name.StartsWith(name))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
{ | ||
CompilerServerLogger.Log($"Analyzer assembly {resolvedPath} depends on '{missingDependency}' but it was not found."); | ||
return false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,16 +17,16 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation | |
internal sealed class AnalyzerDependencyChecker | ||
{ | ||
private readonly HashSet<string> _analyzerFilePaths; | ||
private readonly List<IAssemblyWhiteList> _assemblyWhiteLists; | ||
private readonly List<IIgnorableAssemblyList> _ignorableAssemblyLists; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
private readonly IBindingRedirectionService _bindingRedirectionService; | ||
|
||
public AnalyzerDependencyChecker(IEnumerable<string> analyzerFilePaths, IEnumerable<IAssemblyWhiteList> assemblyWhiteLists, IBindingRedirectionService bindingRedirectionService = null) | ||
public AnalyzerDependencyChecker(IEnumerable<string> analyzerFilePaths, IEnumerable<IIgnorableAssemblyList> ignorableAssemblyLists, IBindingRedirectionService bindingRedirectionService = null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
{ | ||
Debug.Assert(analyzerFilePaths != null); | ||
Debug.Assert(assemblyWhiteLists != null); | ||
Debug.Assert(ignorableAssemblyLists != null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
|
||
_analyzerFilePaths = new HashSet<string>(analyzerFilePaths, StringComparer.OrdinalIgnoreCase); | ||
_assemblyWhiteLists = assemblyWhiteLists.ToList(); | ||
_ignorableAssemblyLists = ignorableAssemblyLists.ToList(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
_bindingRedirectionService = bindingRedirectionService; | ||
} | ||
|
||
|
@@ -46,7 +46,7 @@ public AnalyzerDependencyResults Run(CancellationToken cancellationToken = defau | |
} | ||
} | ||
|
||
_assemblyWhiteLists.Add(new AssemblyIdentityWhiteList(analyzerInfos.Select(info => info.Identity))); | ||
_ignorableAssemblyLists.Add(new IgnorableAssemblyIdentityList(analyzerInfos.Select(info => info.Identity))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to |
||
|
||
// First check for analyzers with the same identity but different | ||
// contents (that is, different MVIDs). | ||
|
@@ -74,7 +74,7 @@ private ImmutableArray<MissingAnalyzerDependency> FindMissingDependencies(List<A | |
? _bindingRedirectionService.ApplyBindingRedirects(reference) | ||
: reference; | ||
|
||
if (!_assemblyWhiteLists.Any(whiteList => whiteList.Includes(redirectedReference))) | ||
if (!_ignorableAssemblyLists.Any(ignorableAssemblyList => ignorableAssemblyList.Includes(redirectedReference))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is stupid, everyone knows what whitelist means, and ignorableAssemblyList means nothing on the first read. |
||
{ | ||
builder.Add(new MissingAnalyzerDependency( | ||
analyzerInfo.Path, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change to
s_defaultSafeReferenceNames