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

Remove the term "whitelist" #3507

Merged
merged 1 commit into from
Jun 15, 2015
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions src/Compilers/Core/VBCSCompiler/AnalyzerConsistencyChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

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


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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to safeReferenceNames

{
if (referenceWhiteList == null)
if (ignorableReferenceNames == null)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to safeReferenceNames

{
referenceWhiteList = s_defaultWhiteList;
ignorableReferenceNames = s_defaultIgnorableReferenceNames;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to safeReferenceNames

}

try
{
CompilerServerLogger.Log("Begin Analyzer Consistency Check");
return CheckCore(baseDirectory, analyzerReferences, loader, referenceWhiteList);
return CheckCore(baseDirectory, analyzerReferences, loader, ignorableReferenceNames);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to safeReferenceNames

}
catch (Exception e)
{
Expand All @@ -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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to safeReferenceNames

{
var resolvedPaths = new List<string>();

Expand All @@ -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)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to safeReferenceNames

{
CompilerServerLogger.Log($"Analyzer assembly {resolvedPath} depends on '{missingDependency}' but it was not found.");
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to List<ISkippableAssemblyList> _skippableAssemblyList

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to IEnumerable<ISkippableAssemblyList> skippableAssemblyList

{
Debug.Assert(analyzerFilePaths != null);
Debug.Assert(assemblyWhiteLists != null);
Debug.Assert(ignorableAssemblyLists != null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to skippableAssemblyList


_analyzerFilePaths = new HashSet<string>(analyzerFilePaths, StringComparer.OrdinalIgnoreCase);
_assemblyWhiteLists = assemblyWhiteLists.ToList();
_ignorableAssemblyLists = ignorableAssemblyLists.ToList();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to _skippableAssemblyList = skippableAssemblyList.ToList()

_bindingRedirectionService = bindingRedirectionService;
}

Expand All @@ -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)));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to _skippableAssemblyList.Add(new SkippableAssemblyIdentityList(analyzerInfos.Select(info => info.Identity)));


// First check for analyzers with the same identity but different
// contents (that is, different MVIDs).
Expand Down Expand Up @@ -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)))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to if (!_skippableAssemblyLists.Any(skippableAssemblyList => skippableAssemblyList.Includes(redirectedReference)))

Choose a reason for hiding this comment

The 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation
internal sealed class AnalyzerDependencyCheckingService
{
private static readonly object s_dependencyConflictErrorId = new object();
private static readonly IAssemblyWhiteList s_systemPrefixWhiteList = new AssemblyNamePrefixWhiteList("System");
private static readonly IIgnorableAssemblyList s_systemPrefixList = new IgnorableAssemblyNamePrefixList("System");

private readonly VisualStudioWorkspaceImpl _workspace;
private readonly HostDiagnosticUpdateSource _updateSource;
Expand Down Expand Up @@ -194,10 +194,10 @@ private Task<AnalyzerDependencyResults> GetConflictsAsync()
_task = _task.SafeContinueWith(_ =>
{
IEnumerable<AssemblyIdentity> loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies().Select(assembly => AssemblyIdentity.FromAssemblyDefinition(assembly));
AssemblyIdentityWhiteList loadedAssembliesWhiteList = new AssemblyIdentityWhiteList(loadedAssemblies);
IAssemblyWhiteList[] whiteLists = new[] { s_systemPrefixWhiteList, loadedAssembliesWhiteList };
IgnorableAssemblyIdentityList loadedAssembliesList = new IgnorableAssemblyIdentityList(loadedAssemblies);
IIgnorableAssemblyList[] ignorableAssemblyLists = new[] { s_systemPrefixList, loadedAssembliesList };

return new AnalyzerDependencyChecker(currentAnalyzerPaths, whiteLists, _bindingRedirectionService).Run(_cancellationTokenSource.Token);
return new AnalyzerDependencyChecker(currentAnalyzerPaths, ignorableAssemblyLists, _bindingRedirectionService).Run(_cancellationTokenSource.Token);
},
TaskScheduler.Default);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal interface IAssemblyWhiteList
internal interface IIgnorableAssemblyList
{
bool Includes(AssemblyIdentity assemblyIdentity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal sealed class AssemblyIdentityWhiteList : IAssemblyWhiteList
internal sealed class IgnorableAssemblyIdentityList : IIgnorableAssemblyList
{
private readonly HashSet<AssemblyIdentity> _assemblyIdentities;

public AssemblyIdentityWhiteList(IEnumerable<AssemblyIdentity> assemblyIdentities)
public IgnorableAssemblyIdentityList(IEnumerable<AssemblyIdentity> assemblyIdentities)
{
Debug.Assert(assemblyIdentities != null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
internal sealed class AssemblyNamePrefixWhiteList : IAssemblyWhiteList
internal sealed class IgnorableAssemblyNamePrefixList : IIgnorableAssemblyList
{
private readonly string _prefix;

public AssemblyNamePrefixWhiteList(string prefix)
public IgnorableAssemblyNamePrefixList(string prefix)
{
Debug.Assert(prefix != null);

Expand Down
6 changes: 3 additions & 3 deletions src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
<Compile Include="Implementation\AnalyzerDependencyChecker.cs" />
<Compile Include="Implementation\AnalyzerDependencyCheckingService.cs" />
<Compile Include="Implementation\AnalyzerDependencyConflict.cs" />
<Compile Include="Implementation\AssemblyIdentityWhiteList.cs" />
<Compile Include="Implementation\AssemblyNamePrefixWhiteList.cs" />
<Compile Include="Implementation\IgnorableAssemblyIdentityList.cs" />
<Compile Include="Implementation\IgnorableAssemblyNamePrefixList.cs" />
<Compile Include="Implementation\CompilationErrorTelemetry\CompilationErrorTelemetryIncrementalAnalyzer.cs" />
<Compile Include="Implementation\Diagnostics\VisualStudioVenusSpanMappingService.cs" />
<Compile Include="Implementation\EditAndContinue\Interop\NativeMethods.cs" />
<Compile Include="Implementation\IAssemblyWhiteList.cs" />
<Compile Include="Implementation\IIgnorableAssemblyList.cs" />
<Compile Include="Implementation\IBindingRedirectionService.cs" />
<Compile Include="Implementation\LanguageService\AbstractLanguageService`2.IVsLanguageBlock.cs" />
<Compile Include="Implementation\Library\FindResults\TreeItems\AbstractSourceTreeItem.cs" />
Expand Down
Loading