Skip to content

Commit 9fe7628

Browse files
committed
cleanup
1 parent 9a70b19 commit 9fe7628

16 files changed

+63
-84
lines changed

schemas/6.0/GitVersion.configuration.json

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"type": "string"
1111
},
1212
"assembly-file-versioning-scheme": {
13-
"description": "The scheme to use when setting AssemblyFileVersion attribute. Can be \u0027MajorMinorPatchTag\u0027, \u0027MajorMinorPatch\u0027, \u0027MajorMinor\u0027, \u0027Major\u0027, \u0027None\u0027. Defaults to \u0027MajorMinorPatch\u0027.",
13+
"description": "The scheme to use when setting AssemblyFileVersion attribute. Can be 'MajorMinorPatchTag', 'MajorMinorPatch', 'MajorMinor', 'Major', 'None'. Defaults to 'MajorMinorPatch'.",
1414
"default": "MajorMinorPatch",
1515
"enum": [
1616
"MajorMinorPatchTag",
@@ -21,16 +21,16 @@
2121
]
2222
},
2323
"assembly-informational-format": {
24-
"description": "Specifies the format of AssemblyInformationalVersion. Defaults to \u0027{InformationalVersion}\u0027.",
25-
"default": "{InformationalVersion}",
24+
"description": "Specifies the format of AssemblyInformationalVersion. Defaults to '{InformationalVersion}'.",
25+
"default": "'{InformationalVersion}'",
2626
"type": "string"
2727
},
2828
"assembly-versioning-format": {
2929
"description": "Specifies the format of AssemblyVersion and overwrites the value of assembly-versioning-scheme.",
3030
"type": "string"
3131
},
3232
"assembly-versioning-scheme": {
33-
"description": "The scheme to use when setting AssemblyVersion attribute. Can be \u0027MajorMinorPatchTag\u0027, \u0027MajorMinorPatch\u0027, \u0027MajorMinor\u0027, \u0027Major\u0027, \u0027None\u0027. Defaults to \u0027MajorMinorPatch\u0027.",
33+
"description": "The scheme to use when setting AssemblyVersion attribute. Can be 'MajorMinorPatchTag', 'MajorMinorPatch', 'MajorMinor', 'Major', 'None'. Defaults to 'MajorMinorPatch'.",
3434
"default": "MajorMinorPatch",
3535
"enum": [
3636
"MajorMinorPatchTag",
@@ -48,7 +48,7 @@
4848
}
4949
},
5050
"commit-date-format": {
51-
"description": "The format to use when calculating the commit date. Defaults to \u0027yyyy-MM-dd\u0027. See [Standard Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) and [Custom Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings).",
51+
"description": "The format to use when calculating the commit date. Defaults to 'yyyy-MM-dd'. See [Standard Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) and [Custom Date and Time Format Strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings).",
5252
"default": "yyyy-MM-dd",
5353
"type": "string"
5454
},
@@ -86,8 +86,9 @@
8686
"$ref": "#/$defs/string1"
8787
},
8888
"major-version-bump-message": {
89-
"description": "The regular expression to match commit messages with to perform a major version increment. Defaults to \u0027\\\u002Bsemver:\\s?(breaking|major)\u0027",
90-
"default": "\\\u002Bsemver:\\s?(breaking|major)",
89+
"format": "regex",
90+
"description": "The regular expression to match commit messages with to perform a major version increment. Defaults to '\\+semver:\\s?(breaking|major)'",
91+
"default": "\\+semver:\\s?(breaking|major)",
9192
"type": "string"
9293
},
9394
"merge-message-formats": {
@@ -98,22 +99,25 @@
9899
}
99100
},
100101
"minor-version-bump-message": {
101-
"description": "The regular expression to match commit messages with to perform a minor version increment. Defaults to \u0027\\\u002Bsemver:\\s?(feature|minor)\u0027",
102-
"default": "\\\u002Bsemver:\\s?(feature|minor)",
102+
"format": "regex",
103+
"description": "The regular expression to match commit messages with to perform a minor version increment. Defaults to '\\+semver:\\s?(feature|minor)'",
104+
"default": "\\+semver:\\s?(feature|minor)",
103105
"type": "string"
104106
},
105107
"next-version": {
106108
"description": "Allows you to bump the next version explicitly. Useful for bumping main or a feature branch with breaking changes",
107109
"type": "string"
108110
},
109111
"no-bump-message": {
110-
"description": "Used to tell GitVersion not to increment when in Mainline development mode. Defaults to \u0027\\\u002Bsemver:\\s?(none|skip)\u0027",
111-
"default": "\\\u002Bsemver:\\s?(none|skip)",
112+
"format": "regex",
113+
"description": "Used to tell GitVersion not to increment when in Mainline development mode. Defaults to '\\+semver:\\s?(none|skip)'",
114+
"default": "\\+semver:\\s?(none|skip)",
112115
"type": "string"
113116
},
114117
"patch-version-bump-message": {
115-
"description": "The regular expression to match commit messages with to perform a patch version increment. Defaults to \u0027\\\u002Bsemver:\\s?(fix|patch)\u0027",
116-
"default": "\\\u002Bsemver:\\s?(fix|patch)",
118+
"format": "regex",
119+
"description": "The regular expression to match commit messages with to perform a patch version increment. Defaults to '\\+semver:\\s?(fix|patch)'",
120+
"default": "\\+semver:\\s?(fix|patch)",
117121
"type": "string"
118122
},
119123
"pre-release-weight": {
@@ -126,7 +130,7 @@
126130
"$ref": "#/$defs/string2"
127131
},
128132
"semantic-version-format": {
129-
"description": "Specifies the semantic version format that is used when parsing the string. Can be \u0027Strict\u0027 or \u0027Loose\u0027. Defaults to \u0027Strict\u0027.",
133+
"description": "Specifies the semantic version format that is used when parsing the string. Can be 'Strict' or 'Loose'. Defaults to 'Strict'.",
130134
"default": "Strict",
131135
"enum": [
132136
"Strict",
@@ -137,7 +141,8 @@
137141
"$ref": "#/$defs/hashSetOfString1"
138142
},
139143
"tag-prefix": {
140-
"description": "A regular expression which is used to trim Git tags before processing. Defaults to \u0027[vV]?\u0027",
144+
"format": "regex",
145+
"description": "A regular expression which is used to trim Git tags before processing. Defaults to '[vV]?'",
141146
"default": "[vV]?",
142147
"type": "string"
143148
},
@@ -163,15 +168,16 @@
163168
"type": "boolean"
164169
},
165170
"version-in-branch-pattern": {
166-
"description": "A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to \u0027(?\u003Cversion\u003E[vV]?\\d\u002B(\\.\\d\u002B)?(\\.\\d\u002B)?).*\u0027.",
167-
"default": "(?\u003Cversion\u003E[vV]?\\d\u002B(\\.\\d\u002B)?(\\.\\d\u002B)?).*",
171+
"format": "regex",
172+
"description": "A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to '(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*'.",
173+
"default": "(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*",
168174
"type": "string"
169175
},
170176
"mode": {
171177
"$ref": "#/$defs/nullableOfVersioningMode"
172178
},
173179
"workflow": {
174-
"description": "The base template of the configuration to use. Possible values are: \u0027GitFlow/v1\u0027 or \u0027GitHubFlow/v1\u0027",
180+
"description": "The base template of the configuration to use. Possible values are: 'GitFlow/v1' or 'GitHubFlow/v1'",
175181
"type": "string"
176182
}
177183
},
@@ -227,15 +233,15 @@
227233
}
228234
},
229235
"nullableOfCommitMessageIncrementMode": {
230-
"description": "Sets whether it should be possible to increment the version with special syntax in the commit message. Can be \u0027Disabled\u0027, \u0027Enabled\u0027 or \u0027MergeMessageOnly\u0027.",
236+
"description": "Sets whether it should be possible to increment the version with special syntax in the commit message. Can be 'Disabled', 'Enabled' or 'MergeMessageOnly'.",
231237
"enum": [
232238
"Enabled",
233239
"Disabled",
234240
"MergeMessageOnly"
235241
]
236242
},
237243
"incrementStrategy": {
238-
"description": "The increment strategy for this branch. Can be \u0027Inherit\u0027, \u0027Patch\u0027, \u0027Minor\u0027, \u0027Major\u0027, \u0027None\u0027.",
244+
"description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.",
239245
"enum": [
240246
"None",
241247
"Major",
@@ -271,8 +277,9 @@
271277
"type": "string"
272278
},
273279
"string1": {
274-
"description": "The regular expression pattern to use to extract the number from the branch name. Defaults to \u0027[/-](?\u003Cnumber\u003E\\d\u002B)\u0027.",
275-
"default": "[/-](?\u003Cnumber\u003E\\d\u002B)",
280+
"format": "regex",
281+
"description": "The regular expression pattern to use to extract the number from the branch name. Defaults to '[/-](?<number>\\d+)'.",
282+
"default": "[/-](?<number>\\d+)",
276283
"type": "string"
277284
},
278285
"nullableOfInt32": {
@@ -290,6 +297,7 @@
290297
]
291298
},
292299
"string2": {
300+
"format": "regex",
293301
"description": "The regular expression pattern to use to match this branch.",
294302
"type": "string"
295303
},
@@ -323,7 +331,7 @@
323331
]
324332
},
325333
"nullableOfVersioningMode": {
326-
"description": "The versioning mode for this branch. Can be \u0027ContinuousDelivery\u0027, \u0027ContinuousDeployment\u0027, \u0027Mainline\u0027.",
334+
"description": "The versioning mode for this branch. Can be 'ContinuousDelivery', 'ContinuousDeployment', 'Mainline'.",
327335
"enum": [
328336
"ContinuousDelivery",
329337
"ContinuousDeployment",

schemas/6.0/GitVersion.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
]
6060
},
6161
"MajorMinorPatch": {
62-
"description": "Major, Minor and Patch joined together, separated by \u0027.\u0027.",
62+
"description": "Major, Minor and Patch joined together, separated by '.'.",
6363
"type": "string"
6464
},
6565
"Minor": {

src/GitVersion.Configuration/BranchConfiguration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ internal record BranchConfiguration : IBranchConfiguration
2525
[JsonPropertyName("label-number-pattern")]
2626
[JsonPropertyDescription($"The regular expression pattern to use to extract the number from the branch name. Defaults to '{ConfigurationConstants.DefaultLabelNumberPattern}'.")]
2727
[JsonPropertyDefault(ConfigurationConstants.DefaultLabelNumberPattern)]
28+
[JsonPropertyFormat(Format.Regex)]
2829
public string? LabelNumberPattern { get; internal set; }
2930

3031
[JsonPropertyName("track-merge-target")]
@@ -41,6 +42,7 @@ internal record BranchConfiguration : IBranchConfiguration
4142

4243
[JsonPropertyName("regex")]
4344
[JsonPropertyDescription("The regular expression pattern to use to match this branch.")]
45+
[JsonPropertyFormat(Format.Regex)]
4446
public string? RegularExpression { get; internal set; }
4547

4648
[JsonIgnore]

src/GitVersion.Configuration/ConfigurationSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public override IEnumerable<IPropertyDescriptor> GetProperties(Type type, object
4343
{
4444
var descriptor = new PropertyDescriptor(p);
4545
var member = p.GetCustomAttribute<JsonPropertyNameAttribute>();
46-
if (member is { Name: { } })
46+
if (member is { Name: not null })
4747
{
4848
descriptor.Name = member.Name;
4949
}

src/GitVersion.Configuration/GitVersionConfiguration.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal sealed record GitVersionConfiguration : BranchConfiguration, IGitVersio
2525

2626
[JsonPropertyName("assembly-informational-format")]
2727
[JsonPropertyDescription($"Specifies the format of AssemblyInformationalVersion. Defaults to '{DefaultAssemblyInformationalFormat}'.")]
28-
[JsonPropertyDefault(DefaultAssemblyInformationalFormat)]
28+
[JsonPropertyDefault($"'{DefaultAssemblyInformationalFormat}'")]
2929
public string? AssemblyInformationalFormat { get; internal set; }
3030

3131
[JsonPropertyName("assembly-versioning-format")]
@@ -39,11 +39,13 @@ internal sealed record GitVersionConfiguration : BranchConfiguration, IGitVersio
3939
[JsonPropertyName("tag-prefix")]
4040
[JsonPropertyDescription($"A regular expression which is used to trim Git tags before processing. Defaults to '{DefaultTagPrefix}'")]
4141
[JsonPropertyDefault(DefaultTagPrefix)]
42+
[JsonPropertyFormat(Format.Regex)]
4243
public string? TagPrefix { get; internal set; }
4344

4445
[JsonPropertyName("version-in-branch-pattern")]
4546
[JsonPropertyDescription($"A regular expression which is used to determine the version number in the branch name or commit message (e.g., v1.0.0-LTS). Defaults to '{DefaultVersionInBranchPattern}'.")]
4647
[JsonPropertyDefault(DefaultVersionInBranchPattern)]
48+
[JsonPropertyFormat(Format.Regex)]
4749
public string? VersionInBranchPattern { get; internal set; }
4850

4951
[JsonIgnore]
@@ -72,21 +74,25 @@ public string? NextVersion
7274
[JsonPropertyName("major-version-bump-message")]
7375
[JsonPropertyDescription($"The regular expression to match commit messages with to perform a major version increment. Defaults to '{IncrementStrategyFinder.DefaultMajorPattern}'")]
7476
[JsonPropertyDefault(IncrementStrategyFinder.DefaultMajorPattern)]
77+
[JsonPropertyFormat(Format.Regex)]
7578
public string? MajorVersionBumpMessage { get; internal set; }
7679

7780
[JsonPropertyName("minor-version-bump-message")]
7881
[JsonPropertyDescription($"The regular expression to match commit messages with to perform a minor version increment. Defaults to '{IncrementStrategyFinder.DefaultMinorPattern}'")]
7982
[JsonPropertyDefault(IncrementStrategyFinder.DefaultMinorPattern)]
83+
[JsonPropertyFormat(Format.Regex)]
8084
public string? MinorVersionBumpMessage { get; internal set; }
8185

8286
[JsonPropertyName("patch-version-bump-message")]
8387
[JsonPropertyDescription($"The regular expression to match commit messages with to perform a patch version increment. Defaults to '{IncrementStrategyFinder.DefaultPatchPattern}'")]
8488
[JsonPropertyDefault(IncrementStrategyFinder.DefaultPatchPattern)]
89+
[JsonPropertyFormat(Format.Regex)]
8590
public string? PatchVersionBumpMessage { get; internal set; }
8691

8792
[JsonPropertyName("no-bump-message")]
8893
[JsonPropertyDescription($"Used to tell GitVersion not to increment when in Mainline development mode. Defaults to '{IncrementStrategyFinder.DefaultNoBumpPattern}'")]
8994
[JsonPropertyDefault(IncrementStrategyFinder.DefaultNoBumpPattern)]
95+
[JsonPropertyFormat(Format.Regex)]
9096
public string? NoBumpMessage { get; internal set; }
9197

9298
[JsonPropertyName("tag-pre-release-weight")]

src/GitVersion.Core/Configuration/ConfigurationConstants.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@ namespace GitVersion.Configuration;
44

55
internal static class ConfigurationConstants
66
{
7-
public const AssemblyVersioningScheme DefaultAssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch;
87
internal const string NameOfDefaultAssemblyVersioningScheme = nameof(AssemblyVersioningScheme.MajorMinorPatch);
9-
public const AssemblyFileVersioningScheme DefaultAssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch;
108
internal const string NameOfDefaultAssemblyFileVersioningScheme = nameof(AssemblyFileVersioningScheme.MajorMinorPatch);
9+
internal const string StringDefaultSemanticVersionFormat = nameof(SemanticVersionFormat.Strict);
10+
internal const string StringDefaultTagPreReleaseWeight = "60000";
11+
internal const string StringDefaultUpdateBuildNumber = "true";
12+
13+
public const AssemblyVersioningScheme DefaultAssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch;
14+
public const AssemblyFileVersioningScheme DefaultAssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch;
15+
public const SemanticVersionFormat DefaultSemanticVersionFormat = SemanticVersionFormat.Strict;
1116
public const string DefaultAssemblyInformationalFormat = "{InformationalVersion}";
1217
public const string DefaultTagPrefix = "[vV]?";
1318
public const string DefaultVersionInBranchPattern = @"(?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*";
14-
public const int DefaultTagPreReleaseWeight = 60000;
15-
internal const string StringDefaultTagPreReleaseWeight = "60000";
1619
public const string DefaultCommitDateFormat = "yyyy-MM-dd";
1720
public const string BranchNamePlaceholder = "{BranchName}";
18-
public const bool DefaultUpdateBuildNumber = true;
19-
internal const string StringDefaultUpdateBuildNumber = "true";
20-
public const SemanticVersionFormat DefaultSemanticVersionFormat = SemanticVersionFormat.Strict;
21-
internal const string StringDefaultSemanticVersionFormat = nameof(SemanticVersionFormat.Strict);
2221
public const string DefaultLabelNumberPattern = @"[/-](?<number>\d+)";
22+
public const bool DefaultUpdateBuildNumber = true;
23+
public const int DefaultTagPreReleaseWeight = 60000;
2324

2425
public const string MainBranchKey = "main";
2526
public const string MasterBranchKey = "master";

src/GitVersion.Core/Core/Attributes/JsonPropertyDefaultAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public JsonPropertyDefaultAttribute(AssemblyFileVersioningScheme value) : this(v
2424

2525
/// <inheritdoc cref="JsonPropertyDefaultAttribute(string)"/>
2626
/// <remarks>Depending on the Type of the boxed value, the resulting string will be automatically enclosed with single-quotes. If the boxed value is NOT a string and is converted to a string from a numeric , object, array, boolean, or null-only type, then it will NOT be enclosed with single-quotes.</remarks>
27-
public JsonPropertyDefaultAttribute(object boxedValue)
27+
public JsonPropertyDefaultAttribute(object? boxedValue)
2828
{
2929
if (boxedValue is not null)
3030
{

src/GitVersion.Core/Core/Attributes/JsonPropertyPatternAttribute.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)