ardalis / ardalis/GuardClauses

Analyzers that verify this is used in all public methods

Open
#165 3 comments 0 reactions 0 assignees View on GitHub
hacktoberfest help wanted
Dominant language
C#
Stars
3.3k
Forks
296
PR merge metrics
No merged PRs in 30d

Description

Awesome package. Love it.

We currently employ units tests to verify that guard clauses are used in all public methods, which is done by extending the [AutoFixture idiom](https://github.com/AutoFixture/AutoFixture/blob/master/Src/Idioms/GuardClauseAssertion.cs) helper and then searching all packages in the solution.

Testing code quality via unit tests isn't ideal, and it would be nice not to have it as part of our test suite but instead utilize [Roslyn](https://docs.microsoft.com/en-us/visualstudio/code-quality/roslyn-analyzers-overview?view=vs-2022), which I assume might be possible. (I might be wrong, though!)

Not sure if this would be too much of a stretch compared to this otherwise light package, but one might name a separate sub-project.

I'll try to work on it myself if I have time one day, but I am currently somewhat busy.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing AutoFixture's Idioms/GuardClauseAssertion.cs and the linked Roslyn analyzer overview to understand the existing test-based check and analyzer model. Done would mean a Roslyn-based analyzer verifies guard clauses across all public methods, potentially in a separate sub-project; the issue does not identify repository files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.