Skip to content

Commit 32063ff

Browse files
committed
(cleanup) resharper cleanup
1 parent cbb2e91 commit 32063ff

File tree

111 files changed

+438
-758
lines changed

Some content is hidden

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

111 files changed

+438
-758
lines changed

src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,6 @@ private static void VerifyAssemblyInfoFile(
503503
var config = new TestEffectiveConfiguration(assemblyVersioningScheme: versioningScheme);
504504
var variables = VariableProvider.GetVariablesFor(version, config, false);
505505

506-
verify(fileSystem, variables);
506+
verify?.Invoke(fileSystem, variables);
507507
}
508508
}

src/GitVersionCore.Tests/DefaultConfigFileLocatorTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void WarnOnExistingGitVersionConfigYamlFile(string path)
4040
{
4141
configFileLocator.Verify(workingPath, repoPath, fileSystem);
4242
}
43-
var configFileDeprecatedWarning = string.Format("{0}' is deprecated, use '{1}' instead", DefaultConfigFileLocator.ObsoleteFileName, DefaultConfigFileLocator.DefaultFileName);
43+
var configFileDeprecatedWarning = $"{DefaultConfigFileLocator.ObsoleteFileName}' is deprecated, use '{DefaultConfigFileLocator.DefaultFileName}' instead";
4444
logOutput.Contains(configFileDeprecatedWarning).ShouldBe(true);
4545
}
4646

@@ -58,7 +58,7 @@ public void WarnOnAmbiguousConfigFilesAtTheSameProjectRootDirectory(string path)
5858
configFileLocator.Verify(workingPath, repoPath, fileSystem);
5959
}
6060

61-
var configFileDeprecatedWarning = string.Format("Ambiguous config files at '{0}'", path);
61+
var configFileDeprecatedWarning = $"Ambiguous config files at '{path}'";
6262
logOutput.Contains(configFileDeprecatedWarning).ShouldBe(true);
6363
}
6464

@@ -73,7 +73,7 @@ public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile,
7373

7474
WarningException exception = Should.Throw<WarningException>(() => { configFileLocator.Verify(workingPath, repoPath, fileSystem); });
7575

76-
var expecedMessage = string.Format("Ambiguous config file selection from '{0}' and '{1}'", workingDirectoryConfigFilePath, repositoryConfigFilePath);
76+
var expecedMessage = $"Ambiguous config file selection from '{workingDirectoryConfigFilePath}' and '{repositoryConfigFilePath}'";
7777
exception.Message.ShouldBe(expecedMessage);
7878
}
7979

src/GitVersionCore.Tests/DocumentationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void ConfigurationDocumentationIsUpToDate()
4040

4141
foreach (var configProperty in configProperties)
4242
{
43-
var formattedConfigProperty = string.Format("### {0}", configProperty);
43+
var formattedConfigProperty = $"### {configProperty}";
4444
configurationDocumentationFile.ShouldContain(formattedConfigProperty,
4545
Environment.NewLine + configurationDocumentationFile);
4646
}
@@ -85,7 +85,7 @@ public void DocumentationIndexIsUpToDate()
8585
continue;
8686
}
8787

88-
documentationIndexFile.ShouldContain(relativePath, () => string.Format("The file '{0}' is not listed in 'mkdocs.yml'.", relativePath));
88+
documentationIndexFile.ShouldContain(relativePath, () => $"The file '{relativePath}' is not listed in 'mkdocs.yml'.");
8989
}
9090
}
9191

@@ -97,7 +97,7 @@ private string ReadDocumentationFile(string relativeDocumentationFilePath)
9797

9898
if (!File.Exists(documentationFilePath))
9999
{
100-
throw new FileNotFoundException(string.Format("The documentation file '{0}' couldn't be found.", documentationFilePath), documentationFilePath);
100+
throw new FileNotFoundException($"The documentation file '{documentationFilePath}' couldn't be found.", documentationFilePath);
101101
}
102102

103103
return File.ReadAllText(documentationFilePath);

src/GitVersionCore.Tests/Helpers/DirectoryHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public static void DeleteDirectory(string directoryPath)
4646
if (!Directory.Exists(directoryPath))
4747
{
4848
Trace.WriteLine(
49-
string.Format("Directory '{0}' is missing and can't be removed.",
50-
directoryPath));
49+
$"Directory '{directoryPath}' is missing and can't be removed.");
5150

5251
return;
5352
}

src/GitVersionCore.Tests/Init/InitStepsDefaultResponsesDoNotThrow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void Execute(Types data, IConventionResultContext result)
2121
var instance = Activator.CreateInstance(t, ctorArguments);
2222
try
2323
{
24-
resultProperty.GetValue(instance);
24+
if (resultProperty != null) resultProperty.GetValue(instance);
2525
}
2626
catch (Exception)
2727
{
@@ -31,6 +31,6 @@ public void Execute(Types data, IConventionResultContext result)
3131
}));
3232
}
3333

34-
public string ConventionReason { get { return "So things do not blow up"; } }
34+
public string ConventionReason => "So things do not blow up";
3535
}
36-
}
36+
}

src/GitVersionCore.Tests/IntegrationTests/MainlineDevelopmentMode.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Reflection;
33
using System.Text;
44
using GitTools.Testing;
@@ -534,14 +534,14 @@ public static void MakeACommit(this RepositoryFixtureBase fixture, string commit
534534
fixture.Repository.MakeACommit(commitMsg);
535535
var diagramBuilder = (StringBuilder)typeof(SequenceDiagram)
536536
.GetField("_diagramBuilder", BindingFlags.Instance | BindingFlags.NonPublic)
537-
.GetValue(fixture.SequenceDiagram);
537+
?.GetValue(fixture.SequenceDiagram);
538538
Func<string, string> getParticipant = participant => (string)typeof(SequenceDiagram)
539539
.GetMethod("GetParticipant", BindingFlags.Instance | BindingFlags.NonPublic)
540-
.Invoke(fixture.SequenceDiagram, new object[]
540+
?.Invoke(fixture.SequenceDiagram, new object[]
541541
{
542542
participant
543543
});
544544
diagramBuilder.AppendLineFormat("{0} -> {0}: Commit '{1}'", getParticipant(fixture.Repository.Head.FriendlyName),
545545
commitMsg);
546546
}
547-
}
547+
}

src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ public void GivenARemoteGitRepositoryWhenCheckingOutDetachedhead_UsingExistingIm
7171
fixture.LocalRepositoryFixture.Repository.Head.Tip);
7272

7373
Should.Throw<WarningException>(() => fixture.AssertFullSemver("0.1.0+4", fixture.LocalRepositoryFixture.Repository, isForTrackedBranchOnly: false),
74-
string.Format("It looks like the branch being examined is a detached Head pointing to commit '{0}'. Without a proper branch name GitVersion cannot determine the build version.",
75-
fixture.LocalRepositoryFixture.Repository.Head.Tip.Id.ToString(7)));
74+
$"It looks like the branch being examined is a detached Head pointing to commit '{fixture.LocalRepositoryFixture.Repository.Head.Tip.Id.ToString(7)}'. Without a proper branch name GitVersion cannot determine the build version.");
7675
}
7776
}
7877

src/GitVersionCore.Tests/LoggerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void LoggerObscuresPassword(string protocol)
1818
var s = string.Empty;
1919
Action<string> action = info => { s = info; };
2020
using (Logger.AddLoggersTemporarily(action, action, action, action))
21-
Logger.WriteInfo(string.Format("{0}://{1}:{2}@workspace.visualstudio.com/DefaultCollection/_git/CAS",protocol,username,password));
21+
Logger.WriteInfo($"{protocol}://{username}:{password}@workspace.visualstudio.com/DefaultCollection/_git/CAS");
2222

2323
s.Contains(password).ShouldBe(false);
2424
}

src/GitVersionCore.Tests/Mocks/MockBranch.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class MockBranch : Branch, ICollection<Commit>
88
public MockBranch(string friendlyName)
99
{
1010
this.friendlyName = friendlyName;
11-
this.canonicalName = friendlyName;
11+
canonicalName = friendlyName;
1212
}
1313
public MockBranch(string friendlyName, string canonicalName)
1414
{
@@ -23,19 +23,16 @@ public MockBranch()
2323
MockCommitLog commits = new MockCommitLog();
2424
string friendlyName;
2525
string canonicalName;
26-
public override string FriendlyName { get { return friendlyName; } }
27-
public override ICommitLog Commits { get { return commits; } }
28-
public override Commit Tip { get { return commits.First(); } }
29-
public override bool IsTracking { get { return true; } }
26+
public override string FriendlyName => friendlyName;
27+
public override ICommitLog Commits => commits;
28+
public override Commit Tip => commits.First();
29+
public override bool IsTracking => true;
3030

31-
public override string CanonicalName
32-
{
33-
get { return canonicalName; }
34-
}
31+
public override string CanonicalName => canonicalName;
3532

3633
public override int GetHashCode()
3734
{
38-
return this.friendlyName.GetHashCode();
35+
return friendlyName.GetHashCode();
3936
}
4037

4138
public override bool Equals(object obj)
@@ -78,7 +75,7 @@ public bool Remove(Commit item)
7875
return commits.Remove(item);
7976
}
8077

81-
public int Count { get { return commits.Count; } }
78+
public int Count => commits.Count;
8279

83-
public bool IsReadOnly { get { return false; } }
84-
}
80+
public bool IsReadOnly => false;
81+
}

src/GitVersionCore.Tests/Mocks/MockBranchCollection.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ bool ICollection<Branch>.Remove(Branch item)
4545
return Branches.Remove(item);
4646
}
4747

48-
public int Count
49-
{
50-
get
51-
{
52-
return Branches.Count;
53-
}
54-
}
55-
public bool IsReadOnly { get { return false; } }
48+
public int Count => Branches.Count;
49+
public bool IsReadOnly => false;
5650
}

0 commit comments

Comments
 (0)