Skip to content
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
76 changes: 34 additions & 42 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: 27-11-2025
# Version: 1.0.1
# Updated: 20-04-2026
# Location: Root
# Distribution: DotNet10
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
Expand Down Expand Up @@ -441,28 +441,24 @@ dotnet_naming_rule.parameters_rule.severity = warning
# http://www.asyncfixer.com


# Asyncify
# https://github.com/hvanbakel/Asyncify-CSharp


# Meziantou
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm
dotnet_diagnostic.MA0003.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0003.md
dotnet_diagnostic.MA0004.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0004.md
dotnet_diagnostic.MA0006.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0006.md
dotnet_diagnostic.MA0003.severity = suggestion # Add argument name to improve readability
dotnet_diagnostic.MA0004.severity = suggestion # Use Task.ConfigureAwait(false)
dotnet_diagnostic.MA0006.severity = none # Use String.Equals instead of equality operator
dotnet_diagnostic.MA0011.severity = none # Duplicate of CA1305
dotnet_diagnostic.MA0016.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0016.md
dotnet_diagnostic.MA0025.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0025.md
dotnet_diagnostic.MA0026.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0026.md
dotnet_diagnostic.MA0028.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0028.md
dotnet_diagnostic.MA0016.severity = error # Prefer return collection abstraction over implementation
dotnet_diagnostic.MA0025.severity = suggestion # Implement functionality instead of throwing NotImplementedException
dotnet_diagnostic.MA0026.severity = suggestion # Fix TODO comment
dotnet_diagnostic.MA0028.severity = none # Optimize StringBuilder usage
dotnet_diagnostic.MA0038.severity = none # Duplicate of CA1822
dotnet_diagnostic.MA0048.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/Meziantou/MA0048.md
dotnet_diagnostic.MA0048.severity = error # File name must match type name


# Microsoft - Code Analysis
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/
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.CA1014.severity = none # Mark assemblies with CLSCompliantAttribute
dotnet_diagnostic.CA1068.severity = error # CancellationToken parameters must come last
dotnet_diagnostic.CA1305.severity = error
dotnet_diagnostic.CA1308.severity = suggestion # Normalize strings to uppercase
dotnet_diagnostic.CA1510.severity = suggestion # Use ArgumentNullException throw helper
Expand All @@ -471,7 +467,7 @@ dotnet_diagnostic.CA1512.severity = suggestion # Use ArgumentOutOfRangeExce
dotnet_diagnostic.CA1513.severity = suggestion # Use ObjectDisposedException throw helper
dotnet_diagnostic.CA1514.severity = error # Avoid redundant length argument
dotnet_diagnostic.CA1515.severity = suggestion # Because an application's API isn't typically referenced from outside the assembly, types can be made internal (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1515)
dotnet_diagnostic.CA1707.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA1707.md
dotnet_diagnostic.CA1707.severity = error # Identifiers should not contain underscores
dotnet_diagnostic.CA1812.severity = none
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1849.severity = error # Call async methods when in an async method
Expand All @@ -498,7 +494,7 @@ dotnet_diagnostic.CA1873.severity = suggestion # Avoid potentially expensiv
dotnet_diagnostic.CA1874.severity = suggestion # Use 'Regex.IsMatch' instead of 'Regex.Match(...).Success' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1874)
dotnet_diagnostic.CA1875.severity = suggestion # Use 'Regex.Count' instead of 'Regex.Matches(...).Count' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1875)
dotnet_diagnostic.CA1877.severity = suggestion # Use 'Path.Combine' or 'Path.Join' overloads (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1877)
dotnet_diagnostic.CA2007.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/CA2007.md
dotnet_diagnostic.CA2007.severity = suggestion # Do not directly await a Task
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
Expand All @@ -515,12 +511,12 @@ dotnet_diagnostic.CA2262.severity = suggestion # Set 'MaxResponseHeadersLen
dotnet_diagnostic.CA2263.severity = suggestion # Prefer generic overload when type is known
dotnet_diagnostic.CA2264.severity = error # Do not pass a non-nullable value to 'ArgumentNullException.ThrowIfNull'
dotnet_diagnostic.CA2265.severity = error # Do not compare Sp an<T> to 'null' or 'default' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)
dotnet_diagnostic.IDE0005.severity = warning # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0005.md
dotnet_diagnostic.IDE0005.severity = warning # Remove unnecessary using directives
dotnet_diagnostic.IDE0010.severity = suggestion # Populate switch
dotnet_diagnostic.IDE0028.severity = suggestion # Collection initialization can be simplified
dotnet_diagnostic.IDE0021.severity = suggestion # Use expression body for constructor
dotnet_diagnostic.IDE0055.severity = none # Fix formatting
dotnet_diagnostic.IDE0058.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCodeAnalysis/IDE0058.md
dotnet_diagnostic.IDE0058.severity = none # Remove unnecessary expression value
dotnet_diagnostic.IDE0061.severity = suggestion # Use expression body for local function
dotnet_diagnostic.IDE0130.severity = suggestion # Namespace does not match folder structure
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor
Expand All @@ -530,38 +526,34 @@ dotnet_diagnostic.IDE0305.severity = suggestion # Collection initialization

# Microsoft - Compiler Errors
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/
dotnet_diagnostic.CS4014.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/MicrosoftCompilerErrors/CS4014.md


# SecurityCodeScan
# https://security-code-scan.github.io/
dotnet_diagnostic.CS4014.severity = error # Call is not awaited


# StyleCop
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers
dotnet_diagnostic.SA1009.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1009.md
dotnet_diagnostic.SA1009.severity = none # Closing parenthesis should be spaced correctly
dotnet_diagnostic.SA1010.severity = none # False positive when using collection initializers
dotnet_diagnostic.SA1101.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1101.md
dotnet_diagnostic.SA1122.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1122.md
dotnet_diagnostic.SA1133.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1133.md
dotnet_diagnostic.SA1200.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1200.md
dotnet_diagnostic.SA1201.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1201.md
dotnet_diagnostic.SA1202.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1202.md
dotnet_diagnostic.SA1204.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1204.md
dotnet_diagnostic.SA1413.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1413.md
dotnet_diagnostic.SA1600.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1600.md
dotnet_diagnostic.SA1101.severity = none # Prefix local calls with this
dotnet_diagnostic.SA1122.severity = error # Use string.Empty for empty strings
dotnet_diagnostic.SA1133.severity = error # Do not combine attributes
dotnet_diagnostic.SA1200.severity = none # Using directives should be placed correctly
dotnet_diagnostic.SA1201.severity = none # Elements should appear in the correct order
dotnet_diagnostic.SA1202.severity = none # Elements should be ordered by access
dotnet_diagnostic.SA1204.severity = none # Static elements should appear before instance elements
dotnet_diagnostic.SA1413.severity = error # Use trailing commas in multi-line initializers
dotnet_diagnostic.SA1600.severity = none # Elements should be documented
dotnet_diagnostic.SA1601.severity = none
dotnet_diagnostic.SA1602.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1602.md
dotnet_diagnostic.SA1604.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1604.md
dotnet_diagnostic.SA1623.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1623.md
dotnet_diagnostic.SA1629.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1629.md
dotnet_diagnostic.SA1633.severity = none # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1633.md
dotnet_diagnostic.SA1649.severity = error # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/StyleCop/SA1649.md
dotnet_diagnostic.SA1602.severity = none # Enumeration items should be documented
dotnet_diagnostic.SA1604.severity = none # Element documentation should have summary
dotnet_diagnostic.SA1623.severity = none # Property summary documentation should match accessors
dotnet_diagnostic.SA1629.severity = none # Documentation text should end with a period
dotnet_diagnostic.SA1633.severity = none # File should have header
dotnet_diagnostic.SA1649.severity = error # File name should match first type name


# SonarAnalyzer.CSharp
# https://rules.sonarsource.com/csharp
dotnet_diagnostic.S1135.severity = suggestion # https://github.com/atc-net/atc-coding-rules/blob/main/documentation/CodeAnalyzersRules/SonarAnalyzerCSharp/S1135.md
dotnet_diagnostic.S1135.severity = suggestion # Track uses of TODO tags
dotnet_diagnostic.S2629.severity = none # Don't use string interpolation in logging message templates.
dotnet_diagnostic.S3358.severity = none # Extract this nested ternary operation into an independent statement.
dotnet_diagnostic.S6602.severity = none # "Find" method should be used instead of the "FirstOrDefault"
Expand Down
8 changes: 3 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@

<!-- Shared code analyzers used for all projects in the solution -->
<ItemGroup Label="Code Analyzers">
<PackageReference Include="Atc.Analyzer" Version="0.1.22" PrivateAssets="All" />
<PackageReference Include="Atc.Analyzer" Version="0.1.23" PrivateAssets="All" />
<PackageReference Include="AsyncFixer" Version="2.1.0" PrivateAssets="All" />
<PackageReference Include="Asyncify" Version="0.9.7" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="3.0.29" PrivateAssets="All" />
<PackageReference Include="SecurityCodeScan.VS2019" Version="5.6.7" PrivateAssets="All" />
<PackageReference Include="Meziantou.Analyzer" Version="3.0.58" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.22.0.136894" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.25.0.139117" PrivateAssets="All" />
</ItemGroup>

</Project>
12 changes: 2 additions & 10 deletions src/.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-11-2025
# Version: 1.0.1
# Updated: 20-04-2026
# Location: src
# Distribution: DotNet10
# Inspired by: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options
Expand All @@ -14,10 +14,6 @@
# http://www.asyncfixer.com


# Asyncify
# https://github.com/hvanbakel/Asyncify-CSharp


# Meziantou
# https://www.meziantou.net/enforcing-asynchronous-code-good-practices-using-a-roslyn-analyzer.htm

Expand All @@ -30,10 +26,6 @@
# https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/


# SecurityCodeScan
# https://security-code-scan.github.io/


# StyleCop
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers

Expand Down
8 changes: 6 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.1
# Updated: 03-06-2024
# Version: 1.0.2
# Updated: 19-04-2026
# Location: blazor
# Distribution: Frameworks

Expand All @@ -17,6 +17,10 @@ dotnet_diagnostic.BL0003.severity = error # Component parameter with C
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.BL0007.severity = warning # Component parameter should be auto property - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0007?view=aspnetcore-10.0
dotnet_diagnostic.BL0008.severity = warning # Component parameters should be auto properties ([SupplyParameterFromForm] with non-default initializer) - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0008?view=aspnetcore-10.0
dotnet_diagnostic.BL0009.severity = warning # Property initializer can be overwritten for [PersistentState] properties - https://github.com/dotnet/aspnetcore/pull/63236
dotnet_diagnostic.BL0010.severity = warning # Use InvokeVoidAsync for JavaScript functions that don't return a value - https://learn.microsoft.com/en-us/aspnet/core/diagnostics/bl0010?view=aspnetcore-11.0

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

Expand Down
39 changes: 39 additions & 0 deletions src/AtcWeb.Domain/AtcApi/AtcApiUrlBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace AtcWeb.Domain.AtcApi;

public static class AtcApiUrlBuilder
{
private static readonly HashSet<string> AllowedExternalProxyOwners = new(StringComparer.OrdinalIgnoreCase)
{
"atc-net",
"microsoft",
"dotnet",
"Azure",
"github",
};

[SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "Consumed directly as an HTML attribute value.")]
public static string BuildRawFileUrl(
string repositoryName,
string branch,
string filePath)
=> $"{AtcApiConstants.BaseAddress}/github/repository/{Uri.EscapeDataString(repositoryName)}/raw?branch={Uri.EscapeDataString(branch)}&filePath={Uri.EscapeDataString(filePath)}";

[SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "Consumed directly as an HTML attribute value.")]
public static string BuildExternalRawFileUrl(
string owner,
string repositoryName,
string branch,
string filePath)
=> $"{AtcApiConstants.BaseAddress}/github/raw/{Uri.EscapeDataString(owner)}/{Uri.EscapeDataString(repositoryName)}?branch={Uri.EscapeDataString(branch)}&filePath={Uri.EscapeDataString(filePath)}";

[SuppressMessage("Design", "CA1055:URI-like return values should not be strings", Justification = "Consumed directly as an HTML attribute value.")]
public static string BuildAvatarUrl(
long userId,
int? size = null)
=> size.HasValue
? $"{AtcApiConstants.BaseAddress}/github/users/{userId}/avatar?size={size.Value}"
: $"{AtcApiConstants.BaseAddress}/github/users/{userId}/avatar";

public static bool IsExternalProxyOwner(string owner)
=> AllowedExternalProxyOwners.Contains(owner);
}
15 changes: 10 additions & 5 deletions src/AtcWeb.Domain/AtcWeb.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Atc" Version="3.0.18" />
<PackageReference Include="Atc.DotNet" Version="3.0.18" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.5" />
<PackageReference Include="Atc" Version="3.0.67" />
<PackageReference Include="Atc.DotNet" Version="3.0.67" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.7" />
<PackageReference Include="Microsoft.Build.Framework" Version="18.4.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.5" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.7" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.5" />
<PackageReference Include="Microsoft.Extensions.Http" Version="10.0.7" />

</ItemGroup>

<ItemGroup>
<PackageReference Update="Atc.Analyzer" Version="0.1.23" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="10.0.203" />
</ItemGroup>

</Project>
Loading
Loading