Skip to content

Commit

Permalink
Move analyzer into Carter project
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinAlpert committed May 24, 2024
1 parent c379b51 commit 9b8f1ad
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 82 deletions.
30 changes: 0 additions & 30 deletions Carter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Carter.ResponseNegotiators.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Carter.ResponseNegotiators.Newtonsoft.Tests", "test\Carter.ResponseNegotiators.Newtonsoft.Tests\Carter.ResponseNegotiators.Newtonsoft.Tests.csproj", "{47DD3AA8-F072-41E3-AF7F-119DBBD8D14A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Carter.Analyzers", "src\Carter.Analyzers\Carter.Analyzers.csproj", "{14D66E34-E351-441D-B71D-443ED69AC43C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Carter.Analyzers.Tests", "test\Carter.Analyzers.Tests\Carter.Analyzers.Tests.csproj", "{5B978E31-83AB-4632-A39F-1C87B5F49A30}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -154,30 +150,6 @@ Global
{47DD3AA8-F072-41E3-AF7F-119DBBD8D14A}.Release|x64.Build.0 = Release|Any CPU
{47DD3AA8-F072-41E3-AF7F-119DBBD8D14A}.Release|x86.ActiveCfg = Release|Any CPU
{47DD3AA8-F072-41E3-AF7F-119DBBD8D14A}.Release|x86.Build.0 = Release|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Debug|x64.ActiveCfg = Debug|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Debug|x64.Build.0 = Debug|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Debug|x86.ActiveCfg = Debug|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Debug|x86.Build.0 = Debug|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Release|Any CPU.Build.0 = Release|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Release|x64.ActiveCfg = Release|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Release|x64.Build.0 = Release|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Release|x86.ActiveCfg = Release|Any CPU
{14D66E34-E351-441D-B71D-443ED69AC43C}.Release|x86.Build.0 = Release|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Debug|x64.ActiveCfg = Debug|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Debug|x64.Build.0 = Debug|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Debug|x86.ActiveCfg = Debug|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Debug|x86.Build.0 = Debug|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Release|Any CPU.Build.0 = Release|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Release|x64.ActiveCfg = Release|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Release|x64.Build.0 = Release|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Release|x86.ActiveCfg = Release|Any CPU
{5B978E31-83AB-4632-A39F-1C87B5F49A30}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -192,8 +164,6 @@ Global
{E5D99119-96EB-4C01-9EC2-A06FC3EEC182} = {35DE35A0-758D-4FDD-BDA3-67F04F65677D}
{D30E87B0-39AE-41FE-8BA3-E5F9FBFFDD64} = {5D056A8A-821C-4C3C-A281-4FA7F8CE251B}
{47DD3AA8-F072-41E3-AF7F-119DBBD8D14A} = {DCB5B9A0-F06D-4BDF-917D-A459C790C718}
{14D66E34-E351-441D-B71D-443ED69AC43C} = {5D056A8A-821C-4C3C-A281-4FA7F8CE251B}
{5B978E31-83AB-4632-A39F-1C87B5F49A30} = {DCB5B9A0-F06D-4BDF-917D-A459C790C718}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9096DE78-6327-48BA-AE0E-336F769681A7}
Expand Down
21 changes: 0 additions & 21 deletions src/Carter.Analyzers/Carter.Analyzers.csproj

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@ private static void OnTypeAnalysis(SymbolAnalysisContext context, INamedTypeSymb
}
}

public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } =
ImmutableArray.Create(DiagnosticDescriptors.CarterModuleShouldNotHaveDependencies);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = [DiagnosticDescriptors.CarterModuleShouldNotHaveDependencies];
}
8 changes: 5 additions & 3 deletions src/Carter/Carter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
<PackageReadmeFile>README.md</PackageReadmeFile>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<NoWarn>RS2008</NoWarn>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\media\carterlogo.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
<None Include="$(OutputPath)\Carter.Analyzers.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" PrivateAssets="compile" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
<PackageReference Include="MinVer" Version="2.5.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>

</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Carter.Analyzers\Carter.Analyzers.csproj" OutputItemType="Analyzer" />
<InternalsVisibleTo Include="$(AssemblyName).Tests" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/Carter/DependencyContextAssemblyCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ private static Assembly SafeLoadAssembly(AssemblyName assemblyName)
{
try
{
#pragma warning disable RS1035
return Assembly.Load(assemblyName);
#pragma warning restore RS1035
}
catch (Exception)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Carter/ICarterModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ protected CarterModule() : this(string.Empty)
/// Initializes a new instance of <see cref="CarterModule"/>
/// </summary>
/// <param name="basePath">A base path to group routes in your <see cref="CarterModule"/></param>
#pragma warning disable CARTER1
protected CarterModule(string basePath)
#pragma warning restore CARTER1
{
this.basePath = basePath;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Carter/ModelBinding/BindExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ public static async Task BindAndSaveFile(this HttpRequest request, string saveLo

private static async Task SaveFileInternal(IFormFile file, string saveLocation, string fileName = "")
{
#pragma warning disable RS1035
if (!Directory.Exists(saveLocation))
Directory.CreateDirectory(saveLocation);

fileName = !string.IsNullOrWhiteSpace(fileName) ? fileName : file.FileName;

using (var fileToSave = File.Create(Path.Combine(saveLocation, fileName)))
await file.CopyToAsync(fileToSave);
#pragma warning restore RS1035
}
}
23 changes: 0 additions & 23 deletions test/Carter.Analyzers.Tests/Carter.Analyzers.Tests.csproj

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
namespace Carter.Analyzers.Tests;
namespace Carter.Tests.Analyzers;

using System.IO;
using System.Threading.Tasks;
using Carter.Analyzers;
using Microsoft.CodeAnalysis.CSharp.Testing;
using Microsoft.CodeAnalysis.Testing;
using Microsoft.CodeAnalysis.Testing.Verifiers;
using Xunit;

public sealed class CarterModuleShouldNotHaveDependenciesTests
{
Expand Down
1 change: 1 addition & 0 deletions test/Carter.Tests/Carter.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MartinCostello.Logging.XUnit" Version="0.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
</ItemGroup>
</Project>

0 comments on commit 9b8f1ad

Please sign in to comment.