Skip to content

Commit 9e6322a

Browse files
committed
Syntax formatting
1 parent f000746 commit 9e6322a

File tree

7 files changed

+90
-68
lines changed

7 files changed

+90
-68
lines changed

src/NerdBank.GitVersioning.Tests/BuildIntegrationTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ public async Task PublicRelease_RegEx_Unsatisfied()
441441
// Just build "master", which doesn't conform to the regex.
442442
var buildResult = await this.BuildAsync();
443443
Assert.False(buildResult.PublicRelease);
444-
AssertStandardProperties(versionOptions, buildResult);
444+
this.AssertStandardProperties(versionOptions, buildResult);
445445
}
446446

447447
public static IEnumerable<object[]> CloudBuildOfBranch(string branchName)
@@ -474,7 +474,7 @@ public async Task PublicRelease_RegEx_SatisfiedByCI(IReadOnlyDictionary<string,
474474
{
475475
var buildResult = await this.BuildAsync();
476476
Assert.True(buildResult.PublicRelease);
477-
AssertStandardProperties(versionOptions, buildResult);
477+
this.AssertStandardProperties(versionOptions, buildResult);
478478
}
479479
}
480480

@@ -514,7 +514,7 @@ public async Task CloudBuildVariables_SetInCI(IReadOnlyDictionary<string, string
514514
this.InitializeSourceControl();
515515

516516
var buildResult = await this.BuildAsync();
517-
AssertStandardProperties(versionOptions, buildResult);
517+
this.AssertStandardProperties(versionOptions, buildResult);
518518

519519
// Assert GitBuildVersion was set
520520
string conditionallyExpectedMessage = UnitTestCloudBuildPrefix + expectedMessage
@@ -554,7 +554,7 @@ public async Task CloudBuildVariables_SetInCI(IReadOnlyDictionary<string, string
554554
versionOptions.CloudBuild.SetVersionVariables = false;
555555
this.WriteVersionFile(versionOptions);
556556
buildResult = await this.BuildAsync();
557-
AssertStandardProperties(versionOptions, buildResult);
557+
this.AssertStandardProperties(versionOptions, buildResult);
558558

559559
// Assert GitBuildVersion was not set
560560
conditionallyExpectedMessage = UnitTestCloudBuildPrefix + expectedMessage
@@ -613,7 +613,7 @@ public async Task BuildNumber_SetInCI(VersionOptions versionOptions, IReadOnlyDi
613613
using (ApplyEnvironmentVariables(properties))
614614
{
615615
var buildResult = await this.BuildAsync();
616-
AssertStandardProperties(versionOptions, buildResult);
616+
this.AssertStandardProperties(versionOptions, buildResult);
617617
expectedBuildNumberMessage = expectedBuildNumberMessage.Replace("{CLOUDBUILDNUMBER}", buildResult.CloudBuildNumber);
618618
Assert.Contains(UnitTestCloudBuildPrefix + expectedBuildNumberMessage, buildResult.LoggedEvents.Select(e => e.Message.TrimEnd()));
619619
}
@@ -623,7 +623,7 @@ public async Task BuildNumber_SetInCI(VersionOptions versionOptions, IReadOnlyDi
623623
using (ApplyEnvironmentVariables(properties))
624624
{
625625
var buildResult = await this.BuildAsync();
626-
AssertStandardProperties(versionOptions, buildResult);
626+
this.AssertStandardProperties(versionOptions, buildResult);
627627
expectedBuildNumberMessage = expectedBuildNumberMessage.Replace("{CLOUDBUILDNUMBER}", buildResult.CloudBuildNumber);
628628
Assert.DoesNotContain(UnitTestCloudBuildPrefix + expectedBuildNumberMessage, buildResult.LoggedEvents.Select(e => e.Message.TrimEnd()));
629629
}
@@ -650,7 +650,7 @@ public async Task BuildNumber_VariousOptions(bool isPublic, VersionOptions.Cloud
650650
}
651651

652652
var buildResult = await this.BuildAsync();
653-
AssertStandardProperties(versionOptions, buildResult);
653+
this.AssertStandardProperties(versionOptions, buildResult);
654654
}
655655

656656
[Fact]
@@ -671,7 +671,7 @@ public async Task PublicRelease_RegEx_SatisfiedByCheckedOutBranch()
671671
Commands.Checkout(this.Repo, releaseBranch);
672672
var buildResult = await this.BuildAsync();
673673
Assert.True(buildResult.PublicRelease);
674-
AssertStandardProperties(versionOptions, buildResult);
674+
this.AssertStandardProperties(versionOptions, buildResult);
675675
}
676676
}
677677

@@ -1154,7 +1154,7 @@ public override string ToString()
11541154

11551155
foreach (var property in this.GetType().GetRuntimeProperties().OrderBy(p => p.Name, StringComparer.OrdinalIgnoreCase))
11561156
{
1157-
if (property.DeclaringType == this.GetType() && property.Name != nameof(BuildResult))
1157+
if (property.DeclaringType == this.GetType() && property.Name != nameof(this.BuildResult))
11581158
{
11591159
sb.AppendLine($"{property.Name} = {property.GetValue(this)}");
11601160
}

src/NerdBank.GitVersioning.Tests/RepoTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected Commit WriteVersionTxtFile(string version = "1.2", string prerelease =
108108
protected Commit WriteVersionFile(string version = "1.2", string prerelease = "", string relativeDirectory = null)
109109
{
110110
var versionData = VersionOptions.FromVersion(new System.Version(version), prerelease);
111-
return WriteVersionFile(versionData, relativeDirectory);
111+
return this.WriteVersionFile(versionData, relativeDirectory);
112112
}
113113

114114
protected Commit WriteVersionFile(VersionOptions versionData, string relativeDirectory = null)

src/NerdBank.GitVersioning.Tests/VersionFileTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ public void GetVersion_String_FindsNearestFileInAncestorDirectories()
231231
this.InitializeSourceControl();
232232
var commit = this.Repo.Head.Commits.First();
233233

234-
AssertPathHasVersion(commit, subDirABC, subdirVersionSpec);
235-
AssertPathHasVersion(commit, subDirAB, subdirVersionSpec);
236-
AssertPathHasVersion(commit, subDirA, rootVersionSpec);
237-
AssertPathHasVersion(commit, this.RepoPath, rootVersionSpec);
234+
this.AssertPathHasVersion(commit, subDirABC, subdirVersionSpec);
235+
this.AssertPathHasVersion(commit, subDirAB, subdirVersionSpec);
236+
this.AssertPathHasVersion(commit, subDirA, rootVersionSpec);
237+
this.AssertPathHasVersion(commit, this.RepoPath, rootVersionSpec);
238238
}
239239

240240
[Fact]
@@ -262,10 +262,10 @@ public void GetVersion_String_FindsNearestFileInAncestorDirectories_WithAssembly
262262
this.InitializeSourceControl();
263263
var commit = this.Repo.Head.Commits.First();
264264

265-
AssertPathHasVersion(commit, subDirABC, subdirVersionSpec);
266-
AssertPathHasVersion(commit, subDirAB, subdirVersionSpec);
267-
AssertPathHasVersion(commit, subDirA, rootVersionSpec);
268-
AssertPathHasVersion(commit, this.RepoPath, rootVersionSpec);
265+
this.AssertPathHasVersion(commit, subDirABC, subdirVersionSpec);
266+
this.AssertPathHasVersion(commit, subDirAB, subdirVersionSpec);
267+
this.AssertPathHasVersion(commit, subDirA, rootVersionSpec);
268+
this.AssertPathHasVersion(commit, this.RepoPath, rootVersionSpec);
269269
}
270270

271271
[Fact]
@@ -348,7 +348,7 @@ public void VersionJson_Inheritance(bool commitInSourceControl, bool bareRepo)
348348
if (bareRepo)
349349
{
350350
operatingRepo = new Repository(
351-
Repository.Clone(this.RepoPath, CreateDirectoryForNewRepo(), new CloneOptions { IsBare = true }));
351+
Repository.Clone(this.RepoPath, this.CreateDirectoryForNewRepo(), new CloneOptions { IsBare = true }));
352352
}
353353

354354
using (operatingRepo)

src/NerdBank.GitVersioning.Tests/VersionSchemaTests.cs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -26,62 +26,62 @@ public VersionSchemaTests(ITestOutputHelper logger)
2626
[Fact]
2727
public void VersionField_BasicScenarios()
2828
{
29-
json = JObject.Parse(@"{ ""version"": ""2.3"" }");
30-
Assert.True(json.IsValid(this.schema));
31-
json = JObject.Parse(@"{ ""version"": ""2.3-beta"" }");
32-
Assert.True(json.IsValid(this.schema));
33-
json = JObject.Parse(@"{ ""version"": ""2.3-beta-final"" }");
34-
Assert.True(json.IsValid(this.schema));
35-
json = JObject.Parse(@"{ ""version"": ""2.3-beta.2"" }");
36-
Assert.True(json.IsValid(this.schema));
37-
json = JObject.Parse(@"{ ""version"": ""2.3-beta.0"" }");
38-
Assert.True(json.IsValid(this.schema));
39-
json = JObject.Parse(@"{ ""version"": ""2.3-beta.01"" }");
40-
Assert.True(json.IsValid(this.schema));
41-
json = JObject.Parse(@"{ ""version"": ""1.2.3"" }");
42-
Assert.True(json.IsValid(this.schema));
43-
json = JObject.Parse(@"{ ""version"": ""1.2.3.4"" }");
44-
Assert.True(json.IsValid(this.schema));
29+
this.json = JObject.Parse(@"{ ""version"": ""2.3"" }");
30+
Assert.True(this.json.IsValid(this.schema));
31+
this.json = JObject.Parse(@"{ ""version"": ""2.3-beta"" }");
32+
Assert.True(this.json.IsValid(this.schema));
33+
this.json = JObject.Parse(@"{ ""version"": ""2.3-beta-final"" }");
34+
Assert.True(this.json.IsValid(this.schema));
35+
this.json = JObject.Parse(@"{ ""version"": ""2.3-beta.2"" }");
36+
Assert.True(this.json.IsValid(this.schema));
37+
this.json = JObject.Parse(@"{ ""version"": ""2.3-beta.0"" }");
38+
Assert.True(this.json.IsValid(this.schema));
39+
this.json = JObject.Parse(@"{ ""version"": ""2.3-beta.01"" }");
40+
Assert.True(this.json.IsValid(this.schema));
41+
this.json = JObject.Parse(@"{ ""version"": ""1.2.3"" }");
42+
Assert.True(this.json.IsValid(this.schema));
43+
this.json = JObject.Parse(@"{ ""version"": ""1.2.3.4"" }");
44+
Assert.True(this.json.IsValid(this.schema));
4545

46-
json = JObject.Parse(@"{ ""version"": ""02.3"" }");
47-
Assert.False(json.IsValid(this.schema));
48-
json = JObject.Parse(@"{ ""version"": ""2.03"" }");
49-
Assert.False(json.IsValid(this.schema));
46+
this.json = JObject.Parse(@"{ ""version"": ""02.3"" }");
47+
Assert.False(this.json.IsValid(this.schema));
48+
this.json = JObject.Parse(@"{ ""version"": ""2.03"" }");
49+
Assert.False(this.json.IsValid(this.schema));
5050
}
5151

5252
[Fact]
5353
public void VersionField_HeightMacroPlacement()
5454
{
5555
// Valid uses
56-
json = JObject.Parse(@"{ ""version"": ""2.3.0-{height}"" }");
57-
Assert.True(json.IsValid(this.schema));
58-
json = JObject.Parse(@"{ ""version"": ""2.3.0-{height}.beta"" }");
59-
Assert.True(json.IsValid(this.schema));
60-
json = JObject.Parse(@"{ ""version"": ""2.3.0-beta.{height}"" }");
61-
Assert.True(json.IsValid(this.schema));
62-
json = JObject.Parse(@"{ ""version"": ""2.3.0-beta+{height}"" }");
63-
Assert.True(json.IsValid(this.schema));
56+
this.json = JObject.Parse(@"{ ""version"": ""2.3.0-{height}"" }");
57+
Assert.True(this.json.IsValid(this.schema));
58+
this.json = JObject.Parse(@"{ ""version"": ""2.3.0-{height}.beta"" }");
59+
Assert.True(this.json.IsValid(this.schema));
60+
this.json = JObject.Parse(@"{ ""version"": ""2.3.0-beta.{height}"" }");
61+
Assert.True(this.json.IsValid(this.schema));
62+
this.json = JObject.Parse(@"{ ""version"": ""2.3.0-beta+{height}"" }");
63+
Assert.True(this.json.IsValid(this.schema));
6464

6565
// Invalid uses
66-
json = JObject.Parse(@"{ ""version"": ""2.3.{height}-beta"" }");
67-
Assert.False(json.IsValid(this.schema));
68-
json = JObject.Parse(@"{ ""version"": ""2.3.0-beta-{height}"" }");
69-
Assert.False(json.IsValid(this.schema));
70-
json = JObject.Parse(@"{ ""version"": ""2.3.0-beta+height-{height}"" }");
71-
Assert.False(json.IsValid(this.schema));
66+
this.json = JObject.Parse(@"{ ""version"": ""2.3.{height}-beta"" }");
67+
Assert.False(this.json.IsValid(this.schema));
68+
this.json = JObject.Parse(@"{ ""version"": ""2.3.0-beta-{height}"" }");
69+
Assert.False(this.json.IsValid(this.schema));
70+
this.json = JObject.Parse(@"{ ""version"": ""2.3.0-beta+height-{height}"" }");
71+
Assert.False(this.json.IsValid(this.schema));
7272
}
7373

7474
[Fact]
7575
public void Inherit_AllowsOmissionOfVersion()
7676
{
77-
json = JObject.Parse(@"{ ""inherit"": false, ""version"": ""1.2"" }");
78-
Assert.True(json.IsValid(this.schema));
79-
json = JObject.Parse(@"{ ""inherit"": false }");
80-
Assert.False(json.IsValid(this.schema));
81-
json = JObject.Parse(@"{ }");
82-
Assert.False(json.IsValid(this.schema));
77+
this.json = JObject.Parse(@"{ ""inherit"": false, ""version"": ""1.2"" }");
78+
Assert.True(this.json.IsValid(this.schema));
79+
this.json = JObject.Parse(@"{ ""inherit"": false }");
80+
Assert.False(this.json.IsValid(this.schema));
81+
this.json = JObject.Parse(@"{ }");
82+
Assert.False(this.json.IsValid(this.schema));
8383

84-
json = JObject.Parse(@"{ ""inherit"": true }");
85-
Assert.True(json.IsValid(this.schema));
84+
this.json = JObject.Parse(@"{ ""inherit"": true }");
85+
Assert.True(this.json.IsValid(this.schema));
8686
}
8787
}

src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,24 @@ private IEnumerable<CodeAttributeDeclaration> CreateAssemblyAttributes()
159159
if (this.EmitNonVersionCustomAttributes)
160160
{
161161
if (!string.IsNullOrEmpty(this.AssemblyTitle))
162+
{
162163
yield return DeclareAttribute(typeof(AssemblyTitleAttribute), this.AssemblyTitle);
164+
}
165+
163166
if (!string.IsNullOrEmpty(this.AssemblyProduct))
167+
{
164168
yield return DeclareAttribute(typeof(AssemblyProductAttribute), this.AssemblyProduct);
169+
}
170+
165171
if (!string.IsNullOrEmpty(this.AssemblyCompany))
172+
{
166173
yield return DeclareAttribute(typeof(AssemblyCompanyAttribute), this.AssemblyCompany);
174+
}
175+
167176
if (!string.IsNullOrEmpty(this.AssemblyCopyright))
177+
{
168178
yield return DeclareAttribute(typeof(AssemblyCopyrightAttribute), this.AssemblyCopyright);
179+
}
169180
}
170181
}
171182

@@ -230,13 +241,24 @@ private void CreateAssemblyAttributes()
230241
if (this.EmitNonVersionCustomAttributes)
231242
{
232243
if (!string.IsNullOrEmpty(this.AssemblyTitle))
244+
{
233245
this.generator.DeclareAttribute(typeof(AssemblyTitleAttribute), this.AssemblyTitle);
246+
}
247+
234248
if (!string.IsNullOrEmpty(this.AssemblyProduct))
249+
{
235250
this.generator.DeclareAttribute(typeof(AssemblyProductAttribute), this.AssemblyProduct);
251+
}
252+
236253
if (!string.IsNullOrEmpty(this.AssemblyCompany))
254+
{
237255
this.generator.DeclareAttribute(typeof(AssemblyCompanyAttribute), this.AssemblyCompany);
256+
}
257+
238258
if (!string.IsNullOrEmpty(this.AssemblyCopyright))
259+
{
239260
this.generator.DeclareAttribute(typeof(AssemblyCopyrightAttribute), this.AssemblyCopyright);
261+
}
240262
}
241263
}
242264

src/Nerdbank.GitVersioning.Tasks/CompareFiles.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ public class CompareFiles : Task
3232
/// Same as <see cref="AreSame"/>, but opposite.
3333
/// </summary>
3434
[Output]
35-
public bool AreChanged { get { return !AreSame; } }
35+
public bool AreChanged { get { return !this.AreSame; } }
3636

3737
public override bool Execute()
3838
{
39-
AreSame = AreFilesIdentical();
39+
this.AreSame = this.AreFilesIdentical();
4040
return true;
4141
}
4242

4343
private bool AreFilesIdentical()
4444
{
45-
if (OriginalItems.Length != NewItems.Length)
45+
if (this.OriginalItems.Length != this.NewItems.Length)
4646
{
4747
return false;
4848
}
4949

50-
for (int i = 0; i < OriginalItems.Length; i++)
50+
for (int i = 0; i < this.OriginalItems.Length; i++)
5151
{
52-
if (!IsContentOfFilesTheSame(OriginalItems[i].ItemSpec, NewItems[i].ItemSpec))
52+
if (!this.IsContentOfFilesTheSame(this.OriginalItems[i].ItemSpec, this.NewItems[i].ItemSpec))
5353
{
5454
return false;
5555
}

src/Nerdbank.GitVersioning.Tasks/CryptoBlobParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ private struct AlgorithmId
153153

154154
public bool IsSet
155155
{
156-
get { return _flags != 0; }
156+
get { return this._flags != 0; }
157157
}
158158

159159
public AlgorithmId(uint flags)
160160
{
161-
_flags = flags;
161+
this._flags = flags;
162162
}
163163
}
164164
}

0 commit comments

Comments
 (0)