Skip to content

Commit

Permalink
Added Roslyn Analyzers for this codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzsantos committed Oct 1, 2023
1 parent fee149b commit 600ca3a
Show file tree
Hide file tree
Showing 24 changed files with 1,216 additions and 26 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions src/ApiHost1/ApiHost1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

<!-- Runs the source generator (in memory) on build -->
<ItemGroup>
<ProjectReference Include="..\Infrastructure.WebApi.Generators\Infrastructure.WebApi.Generators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
<ProjectReference Include="..\Tools.Generators.WebApi\Tools.Generators.WebApi.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources.resx">
Expand Down
4 changes: 1 addition & 3 deletions src/CarsApi/CarsApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

<!-- Runs the source generator (in memory) on build -->
<ItemGroup>
<ProjectReference Include="..\Infrastructure.WebApi.Generators\Infrastructure.WebApi.Generators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
<ProjectReference Include="..\Tools.Generators.WebApi\Tools.Generators.WebApi.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="ValidationResources.resx">
Expand Down
6 changes: 0 additions & 6 deletions src/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,4 @@
</AssemblyAttribute>
</ItemGroup>

<!-- Runs the analyzers (in memory) on build -->
<ItemGroup>
<ProjectReference Include="..\Tools.CodingStandards\Tools.CodingStandards.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions src/Common/Error.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Common;

/// <summary>
/// Defines a <see cref="Result" /> error, used for result return values
/// </summary>
public struct Error
{
private Error(ErrorCode code, string? message = null)
Expand Down Expand Up @@ -63,8 +66,13 @@ public static Error Unexpected(string? message = null)
}
}

/// <summary>
/// Defines the common types (codes) of errors that can happen in code at any layer,
/// that return <see cref="Result{Error}" />
/// </summary>
public enum ErrorCode
{
// EXTEND: add other kinds of errors you want to support in Result<TError>
Validation,
RuleViolation,
RoleViolation,
Expand Down
15 changes: 10 additions & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@

<!-- Build configurations -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
Expand All @@ -77,7 +77,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\$(Configuration)\</OutputPath>
Expand All @@ -86,7 +86,7 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseForDeploy|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseForDeploy|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\$(Configuration)\</OutputPath>
Expand All @@ -95,4 +95,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<!-- Runs the analyzers (in memory) on build -->
<ItemGroup>
<ProjectReference Include="..\Tools.Analyzers.Core\Tools.Analyzers.Core.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" Condition="'$(IsTestProject)'=='' AND '$(IsRoslynComponent)'==''" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
Expand Down
31 changes: 28 additions & 3 deletions src/SaaStack.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
GlobalAssemblyInfo.cs = GlobalAssemblyInfo.cs
..\CHANGELOG.md = ..\CHANGELOG.md
..\README_PROJECT.md = ..\README_PROJECT.md
..\README_DERIVATIVE.md = ..\README_DERIVATIVE.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{508E7DA4-4DF2-4201-955D-CCF70C41AD05}"
Expand Down Expand Up @@ -70,7 +70,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application.Interfaces", "A
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTesting.WebApi.Common", "IntegrationTesting.WebApi.Common\IntegrationTesting.WebApi.Common.csproj", "{A7CA7AD7-70CA-43F0-BE73-75A01342D571}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.WebApi.Generators", "Infrastructure.WebApi.Generators\Infrastructure.WebApi.Generators.csproj", "{7AB39FD6-660F-4400-9955-B92684378492}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Generators.WebApi", "Tools.Generators.WebApi\Tools.Generators.WebApi.csproj", "{7AB39FD6-660F-4400-9955-B92684378492}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{19ADDB2F-B589-49EF-9BDA-BD9908057D60}"
EndProject
Expand Down Expand Up @@ -108,6 +108,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application.Persistence.Int
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarsInfrastructure", "CarsInfrastructure\CarsInfrastructure.csproj", "{ED71C769-CDA7-4C58-B252-8218DCE3D2B5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{BAE0D6F2-6920-4B02-9F30-D71B04B7170D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Analyzers.Core", "Tools.Analyzers.Core\Tools.Analyzers.Core.csproj", "{DE31F486-AE81-49C0-BA00-3A6A325B7C42}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{A25A3BA8-5602-4825-9595-2CF96B166920}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Analyzers.Core.UnitTests", "Tools.Analyzers.Core.UnitTests\Tools.Analyzers.Core.UnitTests.csproj", "{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -271,6 +279,18 @@ Global
{ED71C769-CDA7-4C58-B252-8218DCE3D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
{ED71C769-CDA7-4C58-B252-8218DCE3D2B5}.ReleaseForDeploy|Any CPU.ActiveCfg = ReleaseForDeploy|Any CPU
{ED71C769-CDA7-4C58-B252-8218DCE3D2B5}.ReleaseForDeploy|Any CPU.Build.0 = ReleaseForDeploy|Any CPU
{DE31F486-AE81-49C0-BA00-3A6A325B7C42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE31F486-AE81-49C0-BA00-3A6A325B7C42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE31F486-AE81-49C0-BA00-3A6A325B7C42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE31F486-AE81-49C0-BA00-3A6A325B7C42}.Release|Any CPU.Build.0 = Release|Any CPU
{DE31F486-AE81-49C0-BA00-3A6A325B7C42}.ReleaseForDeploy|Any CPU.ActiveCfg = ReleaseForDeploy|Any CPU
{DE31F486-AE81-49C0-BA00-3A6A325B7C42}.ReleaseForDeploy|Any CPU.Build.0 = ReleaseForDeploy|Any CPU
{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD}.Release|Any CPU.Build.0 = Release|Any CPU
{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD}.ReleaseForDeploy|Any CPU.ActiveCfg = ReleaseForDeploy|Any CPU
{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD}.ReleaseForDeploy|Any CPU.Build.0 = ReleaseForDeploy|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F5C77A86-38AF-40E4-82FC-617E624B2754} = {508E7DA4-4DF2-4201-955D-CCF70C41AD05}
Expand Down Expand Up @@ -299,7 +319,6 @@ Global
{B76CF102-CE56-4321-9060-F81E63B982D6} = {57FDFB31-D6B6-4369-A78C-6F3D3AEA0D79}
{23FF9513-1B26-41F4-A7FE-1D8A9F0808AE} = {BA1AEAEC-68CD-4855-A8CB-0DC2070B6A8C}
{A7CA7AD7-70CA-43F0-BE73-75A01342D571} = {5838EE94-374F-4A6F-A231-1BC1C87985F4}
{7AB39FD6-660F-4400-9955-B92684378492} = {B68592DF-E8E8-452A-A46F-5C8ECB178FDF}
{19ADDB2F-B589-49EF-9BDA-BD9908057D60} = {B68592DF-E8E8-452A-A46F-5C8ECB178FDF}
{4CF7C7E2-C95D-4440-9ECF-5D1CE2A46D7A} = {19ADDB2F-B589-49EF-9BDA-BD9908057D60}
{AE57212B-9A30-4577-A795-7B411621BCDA} = {19ADDB2F-B589-49EF-9BDA-BD9908057D60}
Expand All @@ -319,5 +338,11 @@ Global
{23A93A15-21B8-4CA5-B128-1FF4B0C6A861} = {57FDFB31-D6B6-4369-A78C-6F3D3AEA0D79}
{F6C71F8B-AFDE-471A-B1DE-6E1E8F3499C6} = {BA1AEAEC-68CD-4855-A8CB-0DC2070B6A8C}
{ED71C769-CDA7-4C58-B252-8218DCE3D2B5} = {57FDFB31-D6B6-4369-A78C-6F3D3AEA0D79}
{BAE0D6F2-6920-4B02-9F30-D71B04B7170D} = {9270A12C-E16F-4932-89C4-F4ADDDA55AF3}
{DE31F486-AE81-49C0-BA00-3A6A325B7C42} = {BAE0D6F2-6920-4B02-9F30-D71B04B7170D}
{A25A3BA8-5602-4825-9595-2CF96B166920} = {BAE0D6F2-6920-4B02-9F30-D71B04B7170D}
{3E6AA34C-02F9-4B8B-8307-FC9CA25DB7AD} = {A25A3BA8-5602-4825-9595-2CF96B166920}
{33E2D4C7-525A-41CE-858C-F6A944160618} = {864DED88-9252-46EB-9D13-00269C7333F9}
{7AB39FD6-660F-4400-9955-B92684378492} = {BAE0D6F2-6920-4B02-9F30-D71B04B7170D}
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions src/SaaStack.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=DE31F486_002DAE81_002D49C0_002DBA00_002D3A6A325B7C42_002Ff_003AAnalyzerReleases_002EShipped_002Emd/@EntryIndexedValue">ExplicitlyExcluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=DE31F486_002DAE81_002D49C0_002DBA00_002D3A6A325B7C42_002Ff_003AAnalyzerReleases_002EUnshipped_002Emd/@EntryIndexedValue">ExplicitlyExcluded</s:String>


<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeNamespaceBody/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SeparateLocalFunctionsWithJumpStatement/@EntryIndexedValue">WARNING</s:String>
Expand Down
Loading

0 comments on commit 600ca3a

Please sign in to comment.