Skip to content

Commit d122dee

Browse files
committed
code cleanup
1 parent 180e37d commit d122dee

File tree

140 files changed

+1947
-1991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1947
-1991
lines changed

src/GitVersion.App/ArgumentParserExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static bool ArgumentRequiresValue(this string argument, int argumentIndex
6969

7070
var argumentMightRequireValue = !booleanArguments.Contains(argument[1..], StringComparer.OrdinalIgnoreCase);
7171

72-
// If this is the first argument that might be a target path, the argument starts with slash and we're on an OS that supports paths with slashes, the argument does not require a value.
72+
// If this is the first argument that might be a target path, the argument starts with slash, and we're on an OS that supports paths with slashes, the argument does not require a value.
7373
if (argumentMightRequireValue && argumentIndex == 0 && argument.StartsWith('/') && Path.DirectorySeparatorChar == '/' && argument.IsValidPath())
7474
return false;
7575

src/GitVersion.App/QuotedStringHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static string UnquoteText(string input)
7171
if (sb[0] == '"')
7272
sb.Remove(0, 1);
7373

74-
if (sb[sb.Length - 1] == '"' && sb[sb.Length - 2] != '\\')
74+
if (sb[^1] == '"' && sb[^2] != '\\')
7575
sb.Remove(sb.Length - 1, 1);
7676

7777
sb.Replace("\\\"", "\""); // unescape quotes.

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wel
126126
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
127127
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
128128

129-
configuration.Branches["bug"].SourceBranches.ShouldBe(new List<string> { wellKnownBranchKey });
129+
configuration.Branches["bug"].SourceBranches.ShouldBe([wellKnownBranchKey]);
130130
}
131131

132132
[Test]
@@ -301,7 +301,7 @@ public void ShouldUseSpecifiedSourceBranchesForDevelop()
301301
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
302302
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
303303

304-
configuration.Branches["develop"].SourceBranches.ShouldBe(new List<string> { "develop" });
304+
configuration.Branches["develop"].SourceBranches.ShouldBe(["develop"]);
305305
}
306306

307307
[Test]
@@ -332,7 +332,7 @@ public void ShouldUseSpecifiedSourceBranchesForFeature()
332332
using var _ = this.fileSystem.SetupConfigFile(path: this.repoPath, text: text);
333333
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);
334334

335-
configuration.Branches["feature"].SourceBranches.ShouldBe(new List<string> { "develop", "release" });
335+
configuration.Branches["feature"].SourceBranches.ShouldBe(["develop", "release"]);
336336
}
337337

338338
[Test]

src/GitVersion.Configuration/Attributes/JsonPropertyFormatAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace GitVersion.Configuration.Attributes;
22

33
/// <summary>
4-
/// <para>The <c>format</c> keyword allows for basic semantic identification of certain kinds of string values that are commonly used. For example, because JSON doesn't have a "DateTime" type, dates need to be encoded as strings. <c>format</c> allows the schema author to indicate that the string value should be interpreted as a date. By default, <c>format</c> is just an annotation and does not effect validation.</para>
4+
/// <para>The <c>format</c> keyword allows for basic semantic identification of certain kinds of string values that are commonly used. For example, because JSON doesn't have a "DateTime" type, dates need to be encoded as strings. <c>format</c> allows the schema author to indicate that the string value should be interpreted as a date. By default, <c>format</c> is just an annotation and does not affect validation.</para>
55
/// <para>Optionally, validator implementations can [...] enable <c>format</c> to function as an assertion rather than just an annotation.</para>
66
/// <see href="https://json-schema.org/understanding-json-schema/reference/string#format"/>
77
/// </summary>

src/GitVersion.Configuration/PreventIncrementConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ internal class PreventIncrementConfiguration : IPreventIncrementConfiguration
1313
public bool? WhenBranchMerged { get; set; }
1414

1515
[JsonPropertyName("when-current-commit-tagged")]
16-
[JsonPropertyDescription("This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.")]
16+
[JsonPropertyDescription("This branch related property controls the behavior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.")]
1717
public bool? WhenCurrentCommitTagged { get; set; }
1818
}

src/GitVersion.Core.Tests/Helpers/TestFileSystem.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ public void WriteAllText(string? file, string fileContents, Encoding encoding)
7474
public Stream OpenRead(string path)
7575
{
7676
var fullPath = Path.GetFullPath(path);
77-
if (!this.fileSystem.ContainsKey(fullPath))
77+
if (!this.fileSystem.TryGetValue(fullPath, out var content))
7878
throw new FileNotFoundException("File not found.", fullPath);
7979

80-
var content = this.fileSystem[fullPath];
8180
return new MemoryStream(content);
8281
}
8382

0 commit comments

Comments
 (0)