-
Notifications
You must be signed in to change notification settings - Fork 651
Change GitVersionConfiguration and BranchConfiguration to record type and extract interfaces #3433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change GitVersionConfiguration and BranchConfiguration to record type and extract interfaces #3433
Conversation
… and extract interfaces.
@@ -104,8 +104,9 @@ public IBranch GetTargetBranch(string? targetBranchName) | |||
|
|||
public IBranch? FindMainBranch(GitVersionConfiguration configuration) | |||
{ | |||
var branches = configuration.Branches; | |||
var mainBranchRegex = configuration.Branches[ConfigurationConstants.MainBranchKey].Regex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var mainBranchRegex = configuration.Branches[ConfigurationConstants.MainBranchKey].Regex | |
var mainBranchRegex = branches[ConfigurationConstants.MainBranchKey].Regex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
[JsonPropertyDescription("The regex pattern to use to match this branch.")] | ||
public string? Regex { get; set; } | ||
[JsonPropertyDescription("The regular expression pattern to use to match this branch.")] | ||
public string? Regex { get; internal set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public string? Regex { get; internal set; } | |
public string? RegularExpression { get; internal set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
public SemanticVersionFormat SemanticVersionFormat { get; internal set; } | ||
|
||
[JsonIgnore] | ||
IReadOnlyDictionary<string, BranchConfiguration> IGitVersionConfiguration.Branches => Branches; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can use the newly interface here
IReadOnlyDictionary<string, BranchConfiguration> IGitVersionConfiguration.Branches => Branches; | |
IReadOnlyDictionary<string, IBranchConfiguration> IGitVersionConfiguration.Branches => Branches; |
and the next line as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the first line because the second line is used for initialiization.
@HHobeck will this follow up with a PR that will start using the new interfaces in the core instead of the classes? Or we can include that in the current PR? |
Please also run from the root dotnet run --project .\src\GitVersion.Schema --framework net7.0 -- --outputdirectory schemas --version 6.0 to generate the updated schema as you've changed the descriptions |
…sible. Execute: dotnet run --project .\src\GitVersion.Schema --framework net7.0 -- --outputdirectory schemas --version 6.0
…on where possible.
I think it might be better to separate it and create another PR. |
TODOs for the next PR:
Please add more to this list what you have in mind, and then you can use this list as description for the new PR |
LGTM! It moves in the direction that will allow us to move the implementations details of Configuration into its own module |
…rd, to an extension at the place of usage
Beside the fact that it might be a lot of work and tricky doing it I think it is not feasible (last point) moving the JsonProperty to the interface. The reason is that we are using interfaces and mutable data types in the interface and YamlDotnet cannot handle it.
Yes that's the goal to seperate the aspect of loading/merging the configuration from using it. I'm done please merge this PR to main. |
Thank you @HHobeck for your contribution! |
That's the reason I put |
Change GitVersionConfiguration and BranchConfiguration to record type and extract interfaces
Description
Preparation for #3306
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Checklist: