Skip to content

Commit

Permalink
Upgrade Endjin.RecommendedPractices to 2.1 (#375)
Browse files Browse the repository at this point in the history
Fix resulting analyzer warnings
  • Loading branch information
idg10 committed Feb 16, 2022
1 parent 3e2e3f1 commit 931baff
Show file tree
Hide file tree
Showing 99 changed files with 472 additions and 413 deletions.
49 changes: 44 additions & 5 deletions Solutions/.editorconfig
@@ -1,6 +1,25 @@
# Note: this file was added to your solution as a result of one or more projects using the Endjin.RecommendedPractices.Build.Common NuGet package.
# You can edit this file (e.g., to remove these comments), and it will not be updated - the package just checks for its presence, and copies
# this file. If you don't want this file (but you want to use the NuGet package that puts it here), add this setting to all projects
# using Endjin.RecommendedPractices.Build.Common:
# <EndjinDisableCodeAnalysis>true</EndjinDisableCodeAnalysis>
# and then delete this file. That setting will prevent the package from recreating this file.

# Code style rules for enforcing the endjin house style
# See: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
[*.cs]

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# C# files
[*.{cs,csx}]
indent_size = 4
insert_final_newline = false

# Core editorconfig formatting - indentation

Expand All @@ -18,10 +37,6 @@ csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_open_brace = object_collection, object_collection_array_initalizers, accessors, lambdas, control_blocks, methods, properties, types

# Formatting - organize using options

dotnet_sort_system_directives_first = true

# Formatting - spacing options

csharp_space_after_cast = false
Expand Down Expand Up @@ -68,3 +83,27 @@ dotnet_style_qualification_for_field = true:suggestion
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_property = true:suggestion
dotnet_style_qualification_for_event = true:suggestion

# Style - using directives and namespace declarations
dotnet_sort_system_directives_first = true

# Code analyzer rules (formerly in StyleCop.ruleset)
# SA1025 makes it impossible to write decent-looking switch expressions because it
# doesn't allow multiple whitespace characters in a row. There seems to be no way to
# disable this rule just inside switch expressions, so we reluctantly live without it.
dotnet_diagnostic.SA1025.severity = None
# StyleCop's insistence that constructors' summaries must always start with exactly
# the same boilerplate text is not deeply helpful. Saying "Creates a Foo"
# is in most cases better than the "Initializes a new instance of the Foo type"
# that this rule insists on.
dotnet_diagnostic.SA1642.severity = None

# CLS Compliance - not relevant for most of what we work on.
dotnet_diagnostic.CA1014.severity = None

# Standard exception constructors - not helpful when the exception absolutely needs certain information
dotnet_diagnostic.CA1032.severity = None
dotnet_diagnostic.RCS1194.severity = None

# Localize string constants - apps that want localization can turn this back on
dotnet_diagnostic.CA1303.severity = None
36 changes: 0 additions & 36 deletions Solutions/Directory.build.props

This file was deleted.

Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="Corvus.Tenancy.Abstractions" Version="3.0.0" />
<PackageReference Include="Endjin.RecommendedPractices" Version="1.2.0">
<PackageReference Include="Endjin.RecommendedPractices.GitHub" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Expand Up @@ -113,4 +113,4 @@ public bool HasPermissionFor(Uri resourceUri, string accessType)
return matchingRules.AllAndAtLeastOne(x => x.Permission == Permission.Allow);
}
}
}
}
Expand Up @@ -22,4 +22,4 @@ public List<ClaimPermissions> Permissions
set => this.permissions = value;
}
}
}
}
Expand Up @@ -19,4 +19,4 @@ public static class ClaimTypes
/// </summary>
public const string ObjectIdentifier = "http://schemas.microsoft.com/identity/claims/objectidentifier";
}
}
}
Expand Up @@ -79,4 +79,4 @@ public interface IClaimPermissionsStore
/// </returns>
Task<bool> AnyPermissions();
}
}
}
Expand Up @@ -79,4 +79,4 @@ public interface IResourceAccessRuleSetStore
/// </returns>
Task<ResourceAccessRuleSet> PersistAsync(ResourceAccessRuleSet resourceAccessRuleSet);
}
}
}
Expand Up @@ -71,4 +71,4 @@ public bool Equals(IdWithETag other)
/// <inheritdoc/>
public override int GetHashCode() => HashCode.Combine(this.Id, this.ETag);
}
}
}
Expand Up @@ -23,4 +23,4 @@ public enum Permission
/// </summary>
Allow,
}
}
}
Expand Up @@ -14,4 +14,4 @@ public class PermissionResult
/// </summary>
public Permission Permission { get; set; }
}
}
}
Expand Up @@ -103,4 +103,4 @@ public bool Equals(Resource other)
Uri.Compare(this.Uri, other.Uri, UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.InvariantCultureIgnoreCase) == 0;
}
}
}
}
Expand Up @@ -19,4 +19,4 @@ public class ResourceAccessEvaluation
/// </summary>
public PermissionResult Result { get; set; }
}
}
}
Expand Up @@ -147,4 +147,4 @@ public bool IsMatch(Uri resourceUri, string accessType)
return resourceNameMatchResult.HasMatches && accessTypeMatchResult.HasMatches;
}
}
}
}
Expand Up @@ -55,4 +55,4 @@ public IList<ResourceAccessRule> Rules
set { this.rules = value; }
}
}
}
}
Expand Up @@ -22,4 +22,4 @@ public List<ResourceAccessRuleSet> RuleSets
set => this.ruleSets = value;
}
}
}
}
Expand Up @@ -24,4 +24,4 @@ public class ResourceAccessSubmission
/// </summary>
public string ResourceAccessType { get; set; }
}
}
}
Expand Up @@ -10,13 +10,13 @@ namespace Marain.Claims
public enum UpdateOperation
{
/// <summary>
/// Add operation
/// Add operation.
/// </summary>
Add,

/// <summary>
/// Remove operation
/// Remove operation.
/// </summary>
Remove,
}
}
}
4 changes: 2 additions & 2 deletions Solutions/Marain.Claims.Benchmark/packages.lock.json
Expand Up @@ -80,8 +80,8 @@
"Microsoft.Extensions.Configuration.EnvironmentVariables": {
"type": "Direct",
"requested": "[6.0.*, )",
"resolved": "6.0.0",
"contentHash": "DjYkzqvhiHCq38LW71PcIxXk6nhtV6VySP9yDcSO0goPl7YCU1VG1f2Wbgy58lkA10pWkjHCblZPUyboCB93ZA==",
"resolved": "6.0.1",
"contentHash": "pnyXV1LFOsYjGveuC07xp0YHIyGq7jRq5Ncb5zrrIieMLWVwgMyYxcOH0jTnBedDT4Gh1QinSqsjqzcieHk1og==",
"dependencies": {
"Microsoft.Extensions.Configuration": "6.0.0",
"Microsoft.Extensions.Configuration.Abstractions": "6.0.0"
Expand Down
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Endjin.RecommendedPractices" Version="1.2.0">
<PackageReference Include="Endjin.RecommendedPractices.GitHub" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Expand Up @@ -91,4 +91,4 @@ public async Task<List<ResourceAccessEvaluation>> EvaluateAsync(string tenantId,
.ToList();
}
}
}
}
Expand Up @@ -182,4 +182,4 @@ public static class OpenApiClaimsServiceCollectionExtensions
return services;
}
}
}
}
2 changes: 1 addition & 1 deletion Solutions/Marain.Claims.Client/Marain.Claims.Client.csproj
Expand Up @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="Corvus.Identity.MicrosoftRest" Version="3.0.0" />
<PackageReference Include="Endjin.RecommendedPractices" Version="1.2.0">
<PackageReference Include="Endjin.RecommendedPractices.GitHub" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Expand Up @@ -22,4 +22,4 @@ public class ClaimsClientOptions
/// </summary>
public string ResourceIdForMsiAuthentication { get; set; }
}
}
}
Expand Up @@ -18,4 +18,4 @@ public class ClaimsClientWithCachingOptions : ClaimsClientOptions
/// </summary>
public Dictionary<HttpStatusCode, TimeSpan> CacheExpirationPerHttpResponseCode { get; set; }
}
}
}
Expand Up @@ -29,4 +29,4 @@ public UnauthenticatedClaimsService(Uri baseUri, params DelegatingHandler[] hand
{
}
}
}
}
Expand Up @@ -32,18 +32,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Endjin.RecommendedPractices" Version="1.2.0">
<PackageReference Include="Endjin.RecommendedPractices.GitHub" Version="2.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.2.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="[6.0.*,)" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Marain.Claims.Hosting.AspNetCore\Marain.Claims.Hosting.AspNetCore.csproj" />
Expand Down
Expand Up @@ -39,4 +39,4 @@ public Task<IActionResult> RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "
return this.host.HandleRequestAsync(req.Path, req.Method, req, new { ExecutionContext = executionContext });
}
}
}
}
Expand Up @@ -62,4 +62,4 @@ private static void ConfigureAuthenticationStrategies(IServiceCollection service
services.AddClaimsProviderStrategy<EasyAuthJwtStrategy>();
}
}
}
}
Expand Up @@ -4,6 +4,7 @@
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"FUNCTIONS_EXTENSION_VERSION": "~4",
"APPINSIGHTS_INSTRUMENTATIONKEY": "",
"AI:DeveloperMode": "true",

Expand Down

0 comments on commit 931baff

Please sign in to comment.