Skip to content

Commit

Permalink
Fixed all 'suppressable to suppressible' misspellings. Added tfm/tfms…
Browse files Browse the repository at this point in the history
… to the exclusion list.
  • Loading branch information
MiYanni committed Sep 27, 2023
1 parent 6088e2f commit 28e5599
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 75 deletions.
2 changes: 2 additions & 0 deletions exclusion.dic
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ nupkg
nuspec
sdk
sdks
tfm
tfms
url
urls
xamarin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ namespace Microsoft.DotNet.ApiCompat
internal sealed class ApiCompatServiceProvider
{
private readonly Lazy<ISuppressionEngine> _suppressionEngine;
private readonly Lazy<ISuppressableLog> _compatibilityLogger;
private readonly Lazy<ISuppressibleLog> _compatibilityLogger;
private readonly Lazy<IApiCompatRunner> _apiCompatRunner;

internal ApiCompatServiceProvider(Func<ISuppressionEngine, ISuppressableLog> logFactory,
internal ApiCompatServiceProvider(Func<ISuppressionEngine, ISuppressibleLog> logFactory,
Func<ISuppressionEngine> suppressionEngineFactory,
Func<ISuppressableLog, IRuleFactory> ruleFactory,
Func<ISuppressibleLog, IRuleFactory> ruleFactory,
bool respectInternals,
string[]? excludeAttributesFiles)
{
_suppressionEngine = new Lazy<ISuppressionEngine>(suppressionEngineFactory);
_compatibilityLogger = new Lazy<ISuppressableLog>(() => logFactory(SuppressionEngine));
_compatibilityLogger = new Lazy<ISuppressibleLog>(() => logFactory(SuppressionEngine));
_apiCompatRunner = new Lazy<IApiCompatRunner>(() =>
{
CompositeSymbolFilter compositeSymbolFilter = new CompositeSymbolFilter()
Expand All @@ -42,15 +42,15 @@ internal ApiCompatServiceProvider(Func<ISuppressionEngine, ISuppressableLog> log
new TypedConstantEqualityComparer(symbolEqualityComparer)),
respectInternals);

return new ApiCompatRunner(SuppressableLog,
return new ApiCompatRunner(SuppressibleLog,
SuppressionEngine,
new ApiComparerFactory(ruleFactory(SuppressableLog), apiComparerSettings),
new ApiComparerFactory(ruleFactory(SuppressibleLog), apiComparerSettings),
new AssemblySymbolLoaderFactory(respectInternals));
});
}

public ISuppressionEngine SuppressionEngine => _suppressionEngine.Value;
public ISuppressableLog SuppressableLog => _compatibilityLogger.Value;
public ISuppressibleLog SuppressibleLog => _compatibilityLogger.Value;
public IApiCompatRunner ApiCompatRunner => _apiCompatRunner.Value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static ISuppressionEngine CreateSuppressionEngine(string[]? suppressionFi

// Write the suppression file to disk and throw if a path isn't provided.
public static void GenerateSuppressionFile(ISuppressionEngine suppressionEngine,
ISuppressableLog log,
ISuppressibleLog log,
bool preserveUnnecessarySuppressions,
string[]? suppressionFiles,
string? suppressionOutputFile)
Expand All @@ -47,7 +47,7 @@ public static void GenerateSuppressionFile(ISuppressionEngine suppressionEngine,
}

// Log whether or not we found breaking changes. If we are writing to a suppression file, no need to log anything.
public static void LogApiCompatSuccessOrFailure(bool generateSuppressionFile, ISuppressableLog log)
public static void LogApiCompatSuccessOrFailure(bool generateSuppressionFile, ISuppressibleLog log)
{
if (log.HasLoggedErrorSuppressions)
{
Expand All @@ -63,7 +63,7 @@ public static void LogApiCompatSuccessOrFailure(bool generateSuppressionFile, IS
}

// Validate whether unnecessary suppressions exist and log those.
public static void ValidateUnnecessarySuppressions(ISuppressionEngine suppressionEngine, ISuppressableLog log)
public static void ValidateUnnecessarySuppressions(ISuppressionEngine suppressionEngine, ISuppressibleLog log)
{
IReadOnlyCollection<Suppression> unnecessarySuppressions = suppressionEngine.GetUnnecessarySuppressions();
if (unnecessarySuppressions.Count == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.DotNet.ApiCompat
{
internal static class ValidateAssemblies
{
public static void Run(Func<ISuppressionEngine, ISuppressableLog> logFactory,
public static void Run(Func<ISuppressionEngine, ISuppressibleLog> logFactory,
bool generateSuppressionFile,
bool preserveUnnecessarySuppressions,
bool permitUnnecessarySuppressions,
Expand Down Expand Up @@ -86,19 +86,19 @@ public static void Run(Func<ISuppressionEngine, ISuppressableLog> logFactory,
// Execute the enqueued work item(s).
apiCompatRunner.ExecuteWorkItems();

SuppressionFileHelper.LogApiCompatSuccessOrFailure(generateSuppressionFile, serviceProvider.SuppressableLog);
SuppressionFileHelper.LogApiCompatSuccessOrFailure(generateSuppressionFile, serviceProvider.SuppressibleLog);

if (generateSuppressionFile)
{
SuppressionFileHelper.GenerateSuppressionFile(serviceProvider.SuppressionEngine,
serviceProvider.SuppressableLog,
serviceProvider.SuppressibleLog,
preserveUnnecessarySuppressions,
suppressionFiles,
suppressionOutputFile);
}
else if (!permitUnnecessarySuppressions)
{
SuppressionFileHelper.ValidateUnnecessarySuppressions(serviceProvider.SuppressionEngine, serviceProvider.SuppressableLog);
SuppressionFileHelper.ValidateUnnecessarySuppressions(serviceProvider.SuppressionEngine, serviceProvider.SuppressibleLog);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Microsoft.DotNet.ApiCompat
{
internal static class ValidatePackage
{
public static void Run(Func<ISuppressionEngine, ISuppressableLog> logFactory,
public static void Run(Func<ISuppressionEngine, ISuppressibleLog> logFactory,
bool generateSuppressionFile,
bool preserveUnnecessarySuppressions,
bool permitUnnecessarySuppressions,
Expand Down Expand Up @@ -51,21 +51,21 @@ public static void Run(Func<ISuppressionEngine, ISuppressableLog> logFactory,
Package package = Package.Create(packagePath, packageAssemblyReferences);

// Invoke all validators and pass the specific validation options in. Don't execute work items, just enqueue them.
CompatibleTfmValidator tfmValidator = new(serviceProvider.SuppressableLog, serviceProvider.ApiCompatRunner);
CompatibleTfmValidator tfmValidator = new(serviceProvider.SuppressibleLog, serviceProvider.ApiCompatRunner);
tfmValidator.Validate(new PackageValidatorOption(package,
enableStrictModeForCompatibleTfms,
enqueueApiCompatWorkItems: runApiCompat,
executeApiCompatWorkItems: false));

CompatibleFrameworkInPackageValidator compatibleFrameworkInPackageValidator = new(serviceProvider.SuppressableLog, serviceProvider.ApiCompatRunner);
CompatibleFrameworkInPackageValidator compatibleFrameworkInPackageValidator = new(serviceProvider.SuppressibleLog, serviceProvider.ApiCompatRunner);
compatibleFrameworkInPackageValidator.Validate(new PackageValidatorOption(package,
enableStrictModeForCompatibleFrameworksInPackage,
enqueueApiCompatWorkItems: runApiCompat,
executeApiCompatWorkItems: false));

if (!string.IsNullOrEmpty(baselinePackagePath))
{
BaselinePackageValidator baselineValidator = new(serviceProvider.SuppressableLog, serviceProvider.ApiCompatRunner);
BaselinePackageValidator baselineValidator = new(serviceProvider.SuppressibleLog, serviceProvider.ApiCompatRunner);
baselineValidator.Validate(new PackageValidatorOption(package,
enableStrictMode: enableStrictModeForBaselineValidation,
enqueueApiCompatWorkItems: runApiCompat,
Expand All @@ -78,20 +78,20 @@ public static void Run(Func<ISuppressionEngine, ISuppressableLog> logFactory,
// Execute the work items that were enqueued.
serviceProvider.ApiCompatRunner.ExecuteWorkItems();

SuppressionFileHelper.LogApiCompatSuccessOrFailure(generateSuppressionFile, serviceProvider.SuppressableLog);
SuppressionFileHelper.LogApiCompatSuccessOrFailure(generateSuppressionFile, serviceProvider.SuppressibleLog);
}

if (generateSuppressionFile)
{
SuppressionFileHelper.GenerateSuppressionFile(serviceProvider.SuppressionEngine,
serviceProvider.SuppressableLog,
serviceProvider.SuppressibleLog,
preserveUnnecessarySuppressions,
suppressionFiles,
suppressionOutputFile);
}
else if (!permitUnnecessarySuppressions)
{
SuppressionFileHelper.ValidateUnnecessarySuppressions(serviceProvider.SuppressionEngine, serviceProvider.SuppressableLog);
SuppressionFileHelper.ValidateUnnecessarySuppressions(serviceProvider.SuppressionEngine, serviceProvider.SuppressibleLog);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.DotNet.ApiCompat.Task
/// <summary>
/// Class that can log Suppressions in an MSBuild task, by implementing MSBuildLog and ISuppressibleLog.
/// </summary>
internal sealed class SuppressibleMSBuildLog : MSBuildLog, ISuppressableLog
internal sealed class SuppressibleMSBuildLog : MSBuildLog, ISuppressibleLog
{
private readonly ISuppressionEngine _suppressionEngine;

Expand Down
4 changes: 2 additions & 2 deletions src/ApiCompat/Microsoft.DotNet.ApiCompat.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ static int Main(string[] args)
(string, string)[]? leftAssembliesTransformationPattern = parseResult.GetValue(leftAssembliesTransformationPatternOption);
(string, string)[]? rightAssembliesTransformationPattern = parseResult.GetValue(rightAssembliesTransformationPatternOption);

Func<ISuppressionEngine, SuppressableConsoleLog> logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
Func<ISuppressionEngine, SuppressibleConsoleLog> logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
ValidateAssemblies.Run(logFactory,
generateSuppressionFile,
preserveUnnecessarySuppressions,
Expand Down Expand Up @@ -310,7 +310,7 @@ static int Main(string[] args)
Dictionary<NuGetFramework, IEnumerable<string>>? packageAssemblyReferences = parseResult.GetValue(packageAssemblyReferencesOption);
Dictionary<NuGetFramework, IEnumerable<string>>? baselinePackageAssemblyReferences = parseResult.GetValue(baselinePackageAssemblyReferencesOption);

Func<ISuppressionEngine, SuppressableConsoleLog> logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
Func<ISuppressionEngine, SuppressibleConsoleLog> logFactory = (suppressionEngine) => new(suppressionEngine, verbosity);
ValidatePackage.Run(logFactory,
generateSuppressionFile,
preserveUnnecessarySuppressions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
namespace Microsoft.DotNet.ApiCompat.Tool
{
/// <summary>
/// Class that can log Suppressions to the Console, by implementing ConsoleLog and ISuppressableLog.
/// Class that can log Suppressions to the Console, by implementing ConsoleLog and ISuppressibleLog.
/// </summary>
internal sealed class SuppressableConsoleLog : ConsoleLog, ISuppressableLog
internal sealed class SuppressibleConsoleLog : ConsoleLog, ISuppressibleLog
{
private readonly ISuppressionEngine _suppressionEngine;

/// <inheritdoc />
public bool HasLoggedErrorSuppressions { get; private set; }

public SuppressableConsoleLog(ISuppressionEngine suppressionEngine,
public SuppressibleConsoleLog(ISuppressionEngine suppressionEngine,
MessageImportance messageImportance)
: base(messageImportance)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.DotNet.ApiCompatibility.Logging
/// <summary>
/// Interface to define a logging abstraction for APICompat suppressions shared between Console and MSBuild tasks.
/// </summary>
public interface ISuppressableLog : ILog
public interface ISuppressibleLog : ILog
{
/// <summary>
/// Reports whether the logger emitted an error suppression.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ namespace Microsoft.DotNet.ApiCompatibility.Rules
/// </summary>
public class AssemblyIdentityMustMatch : IRule
{
private readonly ISuppressableLog _log;
private readonly ISuppressibleLog _log;
private readonly IRuleSettings _settings;

public AssemblyIdentityMustMatch(ISuppressableLog log,
public AssemblyIdentityMustMatch(ISuppressibleLog log,
IRuleSettings settings,
IRuleRegistrationContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace Microsoft.DotNet.ApiCompatibility.Rules
/// </summary>
public class RuleFactory : IRuleFactory
{
private readonly ISuppressableLog _log;
private readonly ISuppressibleLog _log;
private readonly bool _enableRuleAttributesMustMatch;
private readonly bool _enableRuleCannotChangeParameterName;

public RuleFactory(ISuppressableLog log,
public RuleFactory(ISuppressibleLog log,
bool enableRuleAttributesMustMatch = false,
bool enableRuleCannotChangeParameterName = false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ namespace Microsoft.DotNet.ApiCompatibility.Runner
public class ApiCompatRunner : IApiCompatRunner
{
private readonly HashSet<ApiCompatRunnerWorkItem> _workItems = new();
private readonly ISuppressableLog _log;
private readonly ISuppressibleLog _log;
private readonly ISuppressionEngine _suppressionEngine;
private readonly IApiComparerFactory _apiComparerFactory;
private readonly IAssemblySymbolLoaderFactory _assemblySymbolLoaderFactory;

/// <inheritdoc />
public IReadOnlyCollection<ApiCompatRunnerWorkItem> WorkItems => _workItems;

public ApiCompatRunner(ISuppressableLog log,
public ApiCompatRunner(ISuppressibleLog log,
ISuppressionEngine suppressionEngine,
IApiComparerFactory apiComparerFactory,
IAssemblySymbolLoaderFactory assemblySymbolLoaderFactory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.DotNet.PackageValidation
internal static class ApiCompatRunnerExtensions
{
public static void QueueApiCompatFromContentItem(this IApiCompatRunner apiCompatRunner,
ISuppressableLog log,
ISuppressibleLog log,
IReadOnlyList<ContentItem> leftContentItems,
IReadOnlyList<ContentItem> rightContentItems,
ApiCompatRunnerOptions options,
Expand Down Expand Up @@ -55,7 +55,7 @@ public static void QueueApiCompatFromContentItem(this IApiCompatRunner apiCompat
apiCompatRunner.EnqueueWorkItem(new ApiCompatRunnerWorkItem(left, options, right));
}

private static MetadataInformation GetMetadataInformation(ISuppressableLog log,
private static MetadataInformation GetMetadataInformation(ISuppressibleLog log,
Package package,
ContentItem item,
string? displayString = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace Microsoft.DotNet.PackageValidation.Validators
/// </summary>
public class BaselinePackageValidator : IPackageValidator
{
private readonly ISuppressableLog _log;
private readonly ISuppressibleLog _log;
private readonly IApiCompatRunner _apiCompatRunner;

public BaselinePackageValidator(ISuppressableLog log,
public BaselinePackageValidator(ISuppressibleLog log,
IApiCompatRunner apiCompatRunner)
{
_log = log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ namespace Microsoft.DotNet.PackageValidation.Validators
/// </summary>
public class CompatibleFrameworkInPackageValidator : IPackageValidator
{
private readonly ISuppressableLog _log;
private readonly ISuppressibleLog _log;
private readonly IApiCompatRunner _apiCompatRunner;

public CompatibleFrameworkInPackageValidator(ISuppressableLog log,
public CompatibleFrameworkInPackageValidator(ISuppressibleLog log,
IApiCompatRunner apiCompatRunner)
{
_log = log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ namespace Microsoft.DotNet.PackageValidation.Validators
public class CompatibleTfmValidator : IPackageValidator
{
private static readonly Dictionary<NuGetFramework, HashSet<NuGetFramework>> s_packageTfmMapping = InitializeTfmMappings();
private readonly ISuppressableLog _log;
private readonly ISuppressibleLog _log;
private readonly IApiCompatRunner _apiCompatRunner;

public CompatibleTfmValidator(ISuppressableLog log,
public CompatibleTfmValidator(ISuppressibleLog log,
IApiCompatRunner apiCompatRunner)
{
_log = log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public CompatibleFrameworkInPackageValidatorIntegrationTests(ITestOutputHelper l
{
}

private (SuppressableTestLog, CompatibleFrameworkInPackageValidator) CreateLoggerAndValidator()
private (SuppressibleTestLog, CompatibleFrameworkInPackageValidator) CreateLoggerAndValidator()
{
SuppressableTestLog log = new();
SuppressibleTestLog log = new();
CompatibleFrameworkInPackageValidator validator = new(log,
new ApiCompatRunner(log,
new SuppressionEngine(),
Expand Down Expand Up @@ -57,7 +57,7 @@ public void test(string test) { }
var result = packCommand.Execute();
Assert.Equal(string.Empty, result.StdErr);
Package package = Package.Create(packCommand.GetNuGetPackage(), null);
(SuppressableTestLog log, CompatibleFrameworkInPackageValidator validator) = CreateLoggerAndValidator();
(SuppressibleTestLog log, CompatibleFrameworkInPackageValidator validator) = CreateLoggerAndValidator();

validator.Validate(new PackageValidatorOption(package));

Expand Down Expand Up @@ -98,7 +98,7 @@ public void test(bool test) { }
var result = packCommand.Execute();
Assert.Equal(string.Empty, result.StdErr);
Package package = Package.Create(packCommand.GetNuGetPackage(), null);
(SuppressableTestLog log, CompatibleFrameworkInPackageValidator validator) = CreateLoggerAndValidator();
(SuppressibleTestLog log, CompatibleFrameworkInPackageValidator validator) = CreateLoggerAndValidator();

validator.Validate(new PackageValidatorOption(package));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Microsoft.DotNet.ApiCompatibility.Tests\SuppressableTestLog.cs" />
<Compile Include="..\Microsoft.DotNet.ApiCompatibility.Tests\SuppressibleTestLog.cs" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 28e5599

Please sign in to comment.