diff --git a/.editorconfig b/.editorconfig index 06afd81b..a6a7e7e1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 @@ -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 or Enumerable.OfType 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 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 @@ -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) diff --git a/Directory.Build.props b/Directory.Build.props index 8b97bc26..078728c6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -43,10 +43,10 @@ - + - + \ No newline at end of file diff --git a/sample/.editorconfig b/sample/.editorconfig index 62ffd2f3..c44e9af0 100644 --- a/sample/.editorconfig +++ b/sample/.editorconfig @@ -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 diff --git a/src/AtcWeb.Domain/.editorconfig b/src/AtcWeb.Domain/.editorconfig index c96bba9d..f731f937 100644 --- a/src/AtcWeb.Domain/.editorconfig +++ b/src/AtcWeb.Domain/.editorconfig @@ -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 @@ -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 ########################################## \ No newline at end of file diff --git a/src/AtcWeb.Domain/AtcApi/AtcApiGitHubApiInformationClient.cs b/src/AtcWeb.Domain/AtcApi/AtcApiGitHubApiInformationClient.cs index 6fcf5c2c..fd443e17 100644 --- a/src/AtcWeb.Domain/AtcApi/AtcApiGitHubApiInformationClient.cs +++ b/src/AtcWeb.Domain/AtcApi/AtcApiGitHubApiInformationClient.cs @@ -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"; diff --git a/src/AtcWeb.Domain/AtcWeb.Domain.csproj b/src/AtcWeb.Domain/AtcWeb.Domain.csproj index 57ae14f6..cda2bd47 100644 --- a/src/AtcWeb.Domain/AtcWeb.Domain.csproj +++ b/src/AtcWeb.Domain/AtcWeb.Domain.csproj @@ -5,10 +5,10 @@ - - - - + + + + diff --git a/src/AtcWeb.Domain/Data/RepositoryMetadata.cs b/src/AtcWeb.Domain/Data/RepositoryMetadata.cs index b2554693..448e27d6 100644 --- a/src/AtcWeb.Domain/Data/RepositoryMetadata.cs +++ b/src/AtcWeb.Domain/Data/RepositoryMetadata.cs @@ -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"), diff --git a/src/AtcWeb/AtcWeb.csproj b/src/AtcWeb/AtcWeb.csproj index b6345a3e..740e7530 100644 --- a/src/AtcWeb/AtcWeb.csproj +++ b/src/AtcWeb/AtcWeb.csproj @@ -9,15 +9,15 @@ - + - + - - + + diff --git a/src/AtcWeb/Pages/Repository/AtcKusto.razor b/src/AtcWeb/Pages/Repository/AtcKusto.razor new file mode 100644 index 00000000..3ccd993b --- /dev/null +++ b/src/AtcWeb/Pages/Repository/AtcKusto.razor @@ -0,0 +1,4 @@ +@page "/repository/atc-kusto" +@inherits AtcKustoBase + + \ No newline at end of file diff --git a/src/AtcWeb/Pages/Repository/AtcKusto.razor.cs b/src/AtcWeb/Pages/Repository/AtcKusto.razor.cs new file mode 100644 index 00000000..4a5f0e1a --- /dev/null +++ b/src/AtcWeb/Pages/Repository/AtcKusto.razor.cs @@ -0,0 +1,9 @@ +namespace AtcWeb.Pages.Repository; + +public class AtcKustoBase : RepositoryComponentBase +{ + public AtcKustoBase() + : base("atc-kusto") + { + } +} \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index be885ba8..643e7a59 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -52,6 +52,6 @@ - + diff --git a/test/AtcWeb.Domain.Tests/AtcWeb.Domain.Tests.csproj b/test/AtcWeb.Domain.Tests/AtcWeb.Domain.Tests.csproj index cea0a2b9..9ce5f08e 100644 --- a/test/AtcWeb.Domain.Tests/AtcWeb.Domain.Tests.csproj +++ b/test/AtcWeb.Domain.Tests/AtcWeb.Domain.Tests.csproj @@ -6,9 +6,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 586e8e3e..3e568d2a 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -11,7 +11,7 @@ - +