iTernity.archlint
0.1.0
dotnet add package iTernity.archlint --version 0.1.0
NuGet\Install-Package iTernity.archlint -Version 0.1.0
<PackageReference Include="iTernity.archlint" Version="0.1.0" />
paket add iTernity.archlint --version 0.1.0
#r "nuget: iTernity.archlint, 0.1.0"
// Install iTernity.archlint as a Cake Addin #addin nuget:?package=iTernity.archlint&version=0.1.0 // Install iTernity.archlint as a Cake Tool #tool nuget:?package=iTernity.archlint&version=0.1.0
The archlint project provides static code analysis (SCA) to verify certain architectural conditions in your Visual Studio .NET solution. Especially component structures, layers and dependency rules between them.
When used continuously (e.g. as architectural tests inside your CI) archlint can help to prevent so called "architectural erosion" in your project, which is the gap between the planned and the actual architecture of your software system.
How can I use it?
See how simple it is to automatically verify your architecture with a single Assertion as part of a unit test.
// 1. Choose your architectural style
var archStyle = new CleanArchLight("Petshop");
// 2. Identify and parse all components and dependencies in your solution (according to the given [definition](#Defintion: Components and Dependencies)).
var petshopSolution = Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create().OpenSolutionAsync("path/To/Petshop/Solution.sln").Result;
var dependencies = new DependencyCollector(archStyle).Collect(petshopSolution);
// 3. Check for invalid component dependencies (according to your [architectural style](#Architectural styles)).
var checkedDependencies = DependencyCheck
.WithDependencies(dependencies)
.WithRule(archStyle)
.Result();
// 4. Assert that all dependencies are allowed
Assert.IsTrue(checkedDependencies.AllDependenciesAllowed, "There are invalid dependencies in your code!");
Here's another example with some more usefull features using pretty printing and the iTernity.plantuml package.
// 1. Choose your architectural style
var archStyle = new CleanArchLight("Petshop");
// 2. Identify and parse all components and dependencies in your solution (according to the given [definition](#Defintion: Components and Dependencies)).
var petshopSolution = Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create().OpenSolutionAsync("path/To/Petshop/Solution.sln").Result;
var dependencies = new DependencyCollector(archStyle).Collect(petshopSolution);
// 3. Check for invalid component dependencies (according to your [architectural style](#Architectural styles)).
var checkedDependencies = DependencyCheck
.WithDependencies(dependencies)
.WithRule(archStyle)
.Result();
// 4. Use a StringWriter to create a message for the upcoming Assert statement, where only the invalid dependencies are printed.
var msg = new System.IO.StringWriter();
DependencyCheckResultWriter
.WithResult(checkedDependencies)
.WithWriter(msg)
.OnlyInvalidDependencies()
.Write();
// 5. Use iTernity.plantuml nuget package to attach a PlantUML link to your error message to visualize all components and dependencies.
var plantUmlCode = new System.IO.StringWriter();
PlantUMLWriter
.WithRule(archStyle)
.WithWriter(plantUmlCode)
//.OnlyInvalidDependencies() // Use this, if you only want to display the invalid depedencies.
.ExcludeLayerDependencies()
.Write(dependencies);
msgWriter.WriteLine(Iternity.PlantUML.PlantUMLUrl.UML(plantUmlCode.ToString()));
// 6. Assert that all dependencies are allowed
Assert.IsTrue(checkedDependencies.AllDependenciesAllowed, msgWriter.ToString());
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.CSharp.Workspaces (>= 2.8.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.0 | 751 | 11/28/2018 |