iTernity.archlint 0.1.0

Install-Package iTernity.archlint -Version 0.1.0
dotnet add package iTernity.archlint --version 0.1.0
<PackageReference Include="iTernity.archlint" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add iTernity.archlint --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: iTernity.archlint, 0.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// 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 NuGet Team does not provide support for this client. Please contact its maintainers for support.

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());

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 440 11/28/2018