natemcmaster / CommandLineUtils

Command line parsing and utilities for .NET

Home Page:https://natemcmaster.github.io/CommandLineUtils/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Is it possible to detect breaking changes on Attribute Level

Lorilatschki opened this issue · comments

commented

We currently planning to use CommandLineUtiles across our CLI tools. Since we want to ensure, that CLIs won't break in both, CLI level as well as behavior level (assuming a optional parameter in version 1.0.0 will be changed to a required parameter) we are looking for tooling support for that.

We found the PublicApiAnalyzers which will help to keep track on public properties/methods/types in general. With that, we can track adding new options or removed options within a CLI. So far so good.
However, if an optional parameter is accidently changed in terms of the attached [Option(...)] attribute to be mandatory now, we would like to have a similar approach to get notified or even build errors when a option is changed in a way, that it would result in a breaking change to a previous released version of the CLI tool.

We do have tests in place which testing the CLI, however having such a quality gate in place even before the tests are executed increases the quality and fast feedback.

We can implement such a roslyn analyzer our self, which also keep track on the attached attributes, maybe there is far better way to achieve this.

The analyzers you referenced (which we also use in this project) are intended to detect changes to your library's binary surface. But I think the kind of changes you are looking for are more about ensuring that the available command line arguments and options are stable. For that, I don't know if analyzers will be capable of detecting changes to that. But, if you find a way to do it, feel free to share your findings for future people with similar questions :)