Giter Site home page Giter Site logo

digitecgalaxus / projectsruler Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 1.0 108 KB

This is a C# Project for architectural governance. It checks the .csproj and .sln files and can be used to implement some rules upon them.

License: MIT License

C# 100.00%
architecture architecture-governance csharp dotnet governance nuget software-architecture

projectsruler's People

Contributors

boskicthebrain avatar lippinio avatar m-gasser avatar ogirard avatar phkiener avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

phkiener

projectsruler's Issues

Run build & test on pull request, require success to complete

To prevent accidents, only safe changes should be incorporated into master. To do this, a pipeline should exist that reacts on pushes on pull requests and verifies that they can be safely merged.

Acceptance criteria

  • When a PR is created (and on every push), a build and test step is executed
  • A successful run of that pipeline is a requirement to complete the PR

Fluent Builder API for Rules

While it's perfectly fine to create rules using only the constructor, it might be beneficial to allow a more fluent style for creating rules. Something like

Rule.CreateRule("This is a description")
    .For("Package.A")
    .Referencing("Package.A.Contracts")
    .Kind(RuleKind.Forbidden)

Obviously, the names are up to debate. I myself prefer a sentence-like style, e.g. "Check that package X does not reference package Y" translated as

Check("Description")
    .That("Package.A")
    .DoesNotReference("Package.B")

but that is just personal preference.

New rules for checking .props files usage

Story

As a developer I want to make sure that only the intended .props files are used in the .csproj files.

Acceptance Criteria

  • There is a rule that limits the usage of .props files.

AllowedButShouldBeRemoved RuleKind

Acceptance Criteria

  • There is another kind of rules for the exceptions that should be cleaned up.
  • These rules are generating warnings.
  • It is up to the unit test maintainer to decide how to handle warnings.

Completely fluent style for checking

I dig fluent interfaces. There now is a fluent builder for rules, but I feel like the checking in general could be done via a fluent interface.

In my mind, it'd be like

var violations = ForProject("path/to/sln").Check()
    .That.Project("SomeCoolProject").DoesNotReference("*Test")
    .That.AllProjects.Import("Common.props")
    .That.Project("*.Database").DoesNotReference("*").Except("EF.Core")
    .Result()

This would allow different kinds of checks to weave together... instead of checking "horizontally" - e.g. all references, all duplicates, ... - you could check "vertically" for projects or layers.

Of course, actual names are subject for debate ๐Ÿ˜‰

PackageReference Rules support a minimal version

Current state

It is possible to check an exact version only. e.g. Version=="1.1.1"

Acceptance criteria

  • There is a support for a minimal version.
  • It is possible to prevent/allow preview/alpha/beta releases.

Remarks

  • MinimalVersion = "1.2.3" would mean Version >= 1.2.3
  • There are different Version formats:
    ** 1
    ** 1.2
    ** 1.2.3
    ** 1.2.3.4
    ** 1.2.3-asdf

Rules support pattern matching in a reference name

Acceptance Criteria

  • It is possible to differentiate between components in the same parent namespace Base.A vs. Base.B
  • It is possible to extract a piece of a namespace from a reference.

Base.A -> Base.A.Contracts OK
Base.A.Contracts -> Base.A not OK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.