Skip to content

Commit

Permalink
Merge pull request #17 from atc-net/feature/maintenance
Browse files Browse the repository at this point in the history
Feature/maintenance
  • Loading branch information
davidkallesen authored Aug 16, 2024
2 parents 48fee70 + d332fe7 commit d6cd2a5
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 20 deletions.
41 changes: 39 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.0
# Updated: 25-09-2023
# Version: 1.0.1
# Updated: 03-06-2024
# Location: Root
# Distribution: DotNet8
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
Expand Down Expand Up @@ -464,10 +464,45 @@ dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net
dotnet_diagnostic.CA1014.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1014.md
dotnet_diagnostic.CA1068.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1068.md
dotnet_diagnostic.CA1305.severity = error
dotnet_diagnostic.CA1510.severity = suggestion # Use ArgumentNullException throw helper
dotnet_diagnostic.CA1511.severity = suggestion # Use ArgumentException throw helper
dotnet_diagnostic.CA1512.severity = suggestion # Use ArgumentOutOfRangeException throw helper
dotnet_diagnostic.CA1513.severity = suggestion # Use ObjectDisposedException throw helper
dotnet_diagnostic.CA1514.severity = error # Avoid redundant length argument
dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
dotnet_diagnostic.CA1812.severity = none
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1849.severity = error # Call async methods when in an async method
dotnet_diagnostic.CA1854.severity = suggestion # Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
dotnet_diagnostic.CA1855.severity = suggestion # Prefer 'Clear' over 'Fill'
dotnet_diagnostic.CA1856.severity = error # Incorrect usage of ConstantExpected attribute
dotnet_diagnostic.CA1857.severity = suggestion # A constant is expected for the parameter
dotnet_diagnostic.CA1858.severity = suggestion # Use 'StartsWith' instead of 'IndexOf'
dotnet_diagnostic.CA1859.severity = suggestion # Use concrete types when possible for improved performance
dotnet_diagnostic.CA1860.severity = suggestion # Avoid using 'Enumerable.Any()' extension method
dotnet_diagnostic.CA1861.severity = suggestion # Avoid constant arrays as arguments
dotnet_diagnostic.CA1862.severity = error # Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
dotnet_diagnostic.CA1863.severity = suggestion # Use 'CompositeFormat'
dotnet_diagnostic.CA1864.severity = suggestion # Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
dotnet_diagnostic.CA1865.severity = suggestion # Use char overload
dotnet_diagnostic.CA1866.severity = suggestion # Use char overload
dotnet_diagnostic.CA1867.severity = suggestion # Use char overload
dotnet_diagnostic.CA1868.severity = suggestion # Unnecessary call to 'Contains(item)'
dotnet_diagnostic.CA1869.severity = suggestion # Cache and reuse 'JsonSerializerOptions' instances
dotnet_diagnostic.CA1870.severity = suggestion # Use a cached 'SearchValues' instance
dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
dotnet_diagnostic.CA2017.severity = error # Parameter count mismatch
dotnet_diagnostic.CA2018.severity = error # The count argument to Buffer.BlockCopy should specify the number of bytes to copy
dotnet_diagnostic.CA2019.severity = error # ThreadStatic fields should not use inline initialization
dotnet_diagnostic.CA2021.severity = error # Don't call Enumerable.Cast<T> or Enumerable.OfType<T> with incompatible types
dotnet_diagnostic.CA2250.severity = suggestion # Use ThrowIfCancellationRequested
dotnet_diagnostic.CA2252.severity = suggestion # Opt-in to preview features should be used with caution
dotnet_diagnostic.CA2253.severity = error # Named placeholders should not be numeric values
dotnet_diagnostic.CA2254.severity = suggestion # Template should be a static expression
dotnet_diagnostic.CA2255.severity = suggestion # The ModuleInitializer attribute should not be used in libraries
dotnet_diagnostic.CA2259.severity = error # Ensure ThreadStatic is only used with static fields
dotnet_diagnostic.CA2260.severity = error # Implement generic math interfaces correctly
dotnet_diagnostic.CA2261.severity = error # Do not use ConfigureAwaitOptions.SuppressThrowing with Task<TResult>
dotnet_diagnostic.IDE0005.severity = warning # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0005.md
dotnet_diagnostic.IDE0058.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0058.md

Expand Down Expand Up @@ -521,6 +556,8 @@ dotnet_diagnostic.S6605.severity = none # Collection-specific "Exist
##########################################
[*.cs]

dotnet_diagnostic.AsyncFixer02.severity = none # False/Positiv - ToListAsync should be used instead of

dotnet_diagnostic.CA1002.severity = none # For Now - Use Collection, ReadonlyCollection, KeyedCollection
dotnet_diagnostic.CA1031.severity = none # For Now
dotnet_diagnostic.CA1051.severity = none # For Now - Do not declare visible instance fields (hard in Blazor Project)
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
<ItemGroup Label="Code Analyzers">
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.147" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.163" PrivateAssets="All" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.23.2.88755" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" PrivateAssets="All" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions sample/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
# StyleCop
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers

# SonarAnalyzer.CSharp
# https://rules.sonarsource.com/csharp

dotnet_diagnostic.S1075.severity = none # Refactor your code not to use hardcoded absolute paths or URIs


##########################################
# Custom - Code Analyzers Rules
Expand Down
14 changes: 12 additions & 2 deletions src/AtcWeb.Domain/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ATC coding rules - https://github.com/atc-net/atc-coding-rules
# Version: 1.0.0
# Updated: 27-03-2024
# Version: 1.0.1
# Updated: 03-06-2024
# Location: blazor
# Distribution: Frameworks

Expand All @@ -9,8 +9,18 @@
##########################################
[*.{cs}]

dotnet_diagnostic.ASP0006.severity = suggestion # Do not use non-literal sequence numbers - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/asp0006?view=aspnetcore-8.0

dotnet_diagnostic.BL0001.severity = error # Component parameter should have public setters - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0001?view=aspnetcore-8.0
dotnet_diagnostic.BL0002.severity = error # Component has multiple CaptureUnmatchedValues parameters - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0002?view=aspnetcore-8.0
dotnet_diagnostic.BL0003.severity = error # Component parameter with CaptureUnmatchedValues has the wrong type - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0003?view=aspnetcore-8.0
dotnet_diagnostic.BL0004.severity = error # Component parameter should be public - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0004?view=aspnetcore-8.0
dotnet_diagnostic.BL0005.severity = error # Component parameter should not be set outside of its component - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0005?view=aspnetcore-8.0
dotnet_diagnostic.BL0006.severity = warning # Do not use RenderTree types - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0006?view=aspnetcore-8.0

dotnet_diagnostic.MA0048.severity = none # To support code-behind [component].razor.cs files / Inherit from ComponentBase - File will not match type name.


##########################################
# Custom - Code Analyzers Rules
##########################################
4 changes: 3 additions & 1 deletion src/AtcWeb.Domain/AtcApi/AtcApiGitHubApiInformationClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ public class AtcApiGitHubApiInformationClient
private const string BaseAddress = "https://atc-api.azurewebsites.net/github/api-information";

[SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "OK.")]
public async Task<(bool IsSuccessful, GitHubApiRateLimits GitHubApiRateLimits)> GetApiRateLimits(CancellationToken cancellationToken = default)
[SuppressMessage("Minor Code Smell", "S2325:Methods and properties that don't access instance data should be static", Justification = "OK.")]
public async Task<(bool IsSuccessful, GitHubApiRateLimits GitHubApiRateLimits)> GetApiRateLimits(
CancellationToken cancellationToken = default)
{
const string url = $"{BaseAddress}/rate-limits";

Expand Down
8 changes: 4 additions & 4 deletions src/AtcWeb.Domain/AtcWeb.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc" Version="2.0.465" />
<PackageReference Include="Atc.DotNet" Version="2.0.465" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.9.5" />
<PackageReference Include="Atc" Version="2.0.513" />
<PackageReference Include="Atc.DotNet" Version="2.0.513" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.4" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
Expand Down
2 changes: 2 additions & 0 deletions src/AtcWeb.Domain/Data/RepositoryMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public static class RepositoryMetadata
Tuple.Create("atc-installer", "perkops"),
Tuple.Create("atc-kepware", "davidkallesen"),
Tuple.Create("atc-kepware", "perkops"),
Tuple.Create("atc-kusto", "davidkallesen"),
Tuple.Create("atc-kusto", "perkops"),
Tuple.Create("atc-logviewer", "davidkallesen"),
Tuple.Create("atc-logviewer", "perkops"),
Tuple.Create("atc-microsoft-graph-client", "davidkallesen"),
Expand Down
8 changes: 4 additions & 4 deletions src/AtcWeb/AtcWeb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc" Version="2.0.465" />
<PackageReference Include="Atc" Version="2.0.513" />
<PackageReference Include="Atc.Blazor" Version="1.0.22" />
<PackageReference Include="Atc.Blazor.ColorThemePreference" Version="1.0.22" />
<PackageReference Include="BuildWebCompiler" Version="1.12.405" Condition="$([MSBuild]::IsOsPlatform('Windows'))" />
<PackageReference Include="ColorCode.HTML" Version="2.0.15" />
<PackageReference Include="HtmlSanitizer" Version="8.0.843" />
<PackageReference Include="HtmlSanitizer" Version="8.1.870" />
<PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.4" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.9.5" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
Expand Down
4 changes: 4 additions & 0 deletions src/AtcWeb/Pages/Repository/AtcKusto.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@page "/repository/atc-kusto"
@inherits AtcKustoBase

<DocsPageRepository Repository="@repository" />
9 changes: 9 additions & 0 deletions src/AtcWeb/Pages/Repository/AtcKusto.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace AtcWeb.Pages.Repository;

public class AtcKustoBase : RepositoryComponentBase
{
public AtcKustoBase()
: base("atc-kusto")
{
}
}
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.141" PrivateAssets="All" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions test/AtcWeb.Domain.Tests/AtcWeb.Domain.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc.Test" Version="1.0.89" />
<PackageReference Include="Atc.Test" Version="1.0.96" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" PrivateAssets="All" />
</ItemGroup>

Expand Down

0 comments on commit d6cd2a5

Please sign in to comment.