Skip to content

Commit 13c069c

Browse files
committed
format cs files
1 parent be263ea commit 13c069c

File tree

19 files changed

+3891
-2585
lines changed

19 files changed

+3891
-2585
lines changed

src/coverlet.console/ConsoleTables/ConsoleTable.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public class ConsoleTable
4141
public ConsoleTableOptions Options { get; protected set; }
4242

4343
public ConsoleTable(params string[] columns)
44-
:this(new ConsoleTableOptions { Columns = new List<string>(columns) })
45-
{
44+
: this(new ConsoleTableOptions { Columns = new List<string>(columns) })
45+
{
4646
}
4747

4848
public ConsoleTable(ConsoleTableOptions options)
@@ -80,10 +80,10 @@ public static ConsoleTable From<T>(IEnumerable<T> values)
8080
var table = new ConsoleTable();
8181

8282
var columns = GetColumns<T>();
83-
83+
8484
table.AddColumn(columns);
8585

86-
foreach (var propertyValues in values.Select(value => columns.Select(column => GetColumnValue<T>(value, column) )))
86+
foreach (var propertyValues in values.Select(value => columns.Select(column => GetColumnValue<T>(value, column))))
8787
table.AddRow(propertyValues.ToArray());
8888

8989
return table;
@@ -207,7 +207,7 @@ private string Format(List<int> columnLengths, char delimiter = '|')
207207
{
208208
var delimiterStr = delimiter == char.MinValue ? string.Empty : delimiter.ToString();
209209
var format = (Enumerable.Range(0, Columns.Count)
210-
.Select(i => " "+ delimiterStr + " {" + i + ",-" + columnLengths[i] + "}")
210+
.Select(i => " " + delimiterStr + " {" + i + ",-" + columnLengths[i] + "}")
211211
.Aggregate((s, a) => s + a) + " " + delimiterStr).Trim();
212212
return format;
213213
}
@@ -245,7 +245,7 @@ public void Write(Format format = ConsoleTables.Format.Default)
245245
}
246246

247247
private static IEnumerable<string> GetColumns<T>()
248-
{
248+
{
249249
return typeof(T).GetProperties().Select(x => x.Name).ToArray();
250250
}
251251

src/coverlet.console/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int Main(string[] args)
6161
process.StartInfo.RedirectStandardError = true;
6262
process.OutputDataReceived += (sender, eventArgs) =>
6363
{
64-
if(!string.IsNullOrEmpty(eventArgs.Data))
64+
if (!string.IsNullOrEmpty(eventArgs.Data))
6565
logger.LogInformation(eventArgs.Data);
6666
};
6767

src/coverlet.core/Instrumentation/Instrumenter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ private Instruction AddInstrumentationCode(MethodDefinition method, ILProcessor
383383

384384
var key = (branchPoint.StartLine, (int)branchPoint.Ordinal);
385385
if (!document.Branches.ContainsKey(key))
386-
{
386+
{
387387
document.Branches.Add(key,
388388
new Branch
389389
{
@@ -519,9 +519,9 @@ private bool IsExcludeAttribute(CustomAttribute customAttribute)
519519
excludeAttributeNames = _excludedAttributes.Union(excludeAttributeNames);
520520
}
521521

522-
return excludeAttributeNames.Any(a =>
523-
customAttribute.AttributeType.Name.Equals(a.EndsWith("Attribute")? a : $"{a}Attribute"));
524-
}
522+
return excludeAttributeNames.Any(a =>
523+
customAttribute.AttributeType.Name.Equals(a.EndsWith("Attribute") ? a : $"{a}Attribute"));
524+
}
525525

526526
private static Mono.Cecil.Cil.MethodBody GetMethodBody(MethodDefinition method)
527527
{

src/coverlet.core/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[assembly: System.Reflection.AssemblyKeyFileAttribute("coverlet.core.snk")]
2-
[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("Coverlet.Core.Tests,PublicKey=" +
2+
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Coverlet.Core.Tests,PublicKey=" +
33
"0024000004800000940000000602000000240000525341310004000001000100757cf9291d78a8" +
44
"2e5bb58a827a3c46c2f959318327ad30d1b52e918321ffbd847fb21565b8576d2a3a24562a93e8" +
55
"6c77a298b564a0f1b98f63d7a1441a3a8bcc206da3ed09d5dacc76e122a109a9d3ac608e21a054" +

src/coverlet.core/Reporters/CoberturaReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public string Report(CoverageResult result)
8181
{
8282
var branches = meth.Value.Branches.Where(b => b.Line == ln.Key).ToList();
8383
var branchInfoCoverage = summary.CalculateBranchCoverage(branches);
84-
line.Add(new XAttribute("condition-coverage", $"{branchInfoCoverage.Percent*100}% ({branchInfoCoverage.Covered}/{branchInfoCoverage.Total})"));
84+
line.Add(new XAttribute("condition-coverage", $"{branchInfoCoverage.Percent * 100}% ({branchInfoCoverage.Covered}/{branchInfoCoverage.Total})"));
8585
XElement conditions = new XElement("conditions");
8686
var byOffset = branches.GroupBy(b => b.Offset).ToDictionary(b => b.Key, b => b.ToList());
8787
foreach (var entry in byOffset)

src/coverlet.core/Reporters/JsonReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Coverlet.Core.Reporters
55
public class JsonReporter : IReporter
66
{
77
public ReporterOutputType OutputType => ReporterOutputType.File;
8-
8+
99
public string Format => "json";
1010

1111
public string Extension => "json";

src/coverlet.core/Reporters/LcovReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Coverlet.Core.Reporters
77
public class LcovReporter : IReporter
88
{
99
public ReporterOutputType OutputType => ReporterOutputType.File;
10-
10+
1111
public string Format => "lcov";
1212

1313
public string Extension => "info";

src/coverlet.core/Reporters/OpenCoverReporter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Coverlet.Core.Reporters
1111
public class OpenCoverReporter : IReporter
1212
{
1313
public ReporterOutputType OutputType => ReporterOutputType.File;
14-
14+
1515
public string Format => "opencover";
1616

1717
public string Extension => "opencover.xml";
@@ -72,7 +72,7 @@ public string Report(CoverageResult result)
7272
var methLineCoverage = summary.CalculateLineCoverage(meth.Value.Lines);
7373
var methBranchCoverage = summary.CalculateBranchCoverage(meth.Value.Branches);
7474
var methCyclomaticComplexity = summary.CalculateCyclomaticComplexity(meth.Value.Branches);
75-
75+
7676
XElement method = new XElement("Method");
7777

7878
method.Add(new XAttribute("cyclomaticComplexity", methCyclomaticComplexity.ToString()));

src/coverlet.core/Symbols/CecilSymbolHelper.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ public static class CecilSymbolHelper
2323
public static List<BranchPoint> GetBranchPoints(MethodDefinition methodDefinition)
2424
{
2525
var list = new List<BranchPoint>();
26-
if (methodDefinition == null)
26+
if (methodDefinition == null)
2727
return list;
2828

2929
UInt32 ordinal = 0;
3030
var instructions = methodDefinition.Body.Instructions;
31-
31+
3232
// if method is a generated MoveNext skip first branch (could be a switch or a branch)
3333
var skipFirstBranch = IsMovenext.IsMatch(methodDefinition.FullName);
3434

@@ -45,7 +45,7 @@ public static List<BranchPoint> GetBranchPoints(MethodDefinition methodDefinitio
4545
if (BranchIsInGeneratedExceptionFilter(instruction, methodDefinition))
4646
continue;
4747

48-
if (BranchIsInGeneratedFinallyBlock(instruction, methodDefinition))
48+
if (BranchIsInGeneratedFinallyBlock(instruction, methodDefinition))
4949
continue;
5050

5151
var pathCounter = 0;
@@ -59,7 +59,7 @@ public static List<BranchPoint> GetBranchPoints(MethodDefinition methodDefinitio
5959
if (instruction.Next == null)
6060
return list;
6161

62-
if (!BuildPointsForConditionalBranch(list, instruction, branchingInstructionLine, document, branchOffset, pathCounter, instructions, ref ordinal, methodDefinition))
62+
if (!BuildPointsForConditionalBranch(list, instruction, branchingInstructionLine, document, branchOffset, pathCounter, instructions, ref ordinal, methodDefinition))
6363
return list;
6464
}
6565
catch (Exception)
@@ -71,7 +71,7 @@ public static List<BranchPoint> GetBranchPoints(MethodDefinition methodDefinitio
7171
}
7272

7373
private static bool BuildPointsForConditionalBranch(List<BranchPoint> list, Instruction instruction,
74-
int branchingInstructionLine, string document, int branchOffset, int pathCounter,
74+
int branchingInstructionLine, string document, int branchOffset, int pathCounter,
7575
Collection<Instruction> instructions, ref uint ordinal, MethodDefinition methodDefinition)
7676
{
7777
// Add Default branch (Path=0)
@@ -215,12 +215,12 @@ private static bool BranchIsInGeneratedExceptionFilter(Instruction branchInstruc
215215
Instruction startFilter = exceptionHandler.FilterStart;
216216
Instruction endFilter = startFilter;
217217

218-
while(endFilter.OpCode != OpCodes.Endfilter && endFilter != null)
218+
while (endFilter.OpCode != OpCodes.Endfilter && endFilter != null)
219219
{
220220
endFilter = endFilter.Next;
221221
}
222222

223-
if(branchInstruction.Offset >= startFilter.Offset && branchInstruction.Offset <= endFilter.Offset)
223+
if (branchInstruction.Offset >= startFilter.Offset && branchInstruction.Offset <= endFilter.Offset)
224224
{
225225
return true;
226226
}
@@ -231,17 +231,17 @@ private static bool BranchIsInGeneratedExceptionFilter(Instruction branchInstruc
231231

232232
private static bool BranchIsInGeneratedFinallyBlock(Instruction branchInstruction, MethodDefinition methodDefinition)
233233
{
234-
if (!methodDefinition.Body.HasExceptionHandlers)
234+
if (!methodDefinition.Body.HasExceptionHandlers)
235235
return false;
236-
236+
237237
// a generated finally block will have no sequence points in its range
238238
var handlers = methodDefinition.Body.ExceptionHandlers
239239
.Where(e => e.HandlerType == ExceptionHandlerType.Finally)
240240
.ToList();
241241

242242
return handlers
243243
.Where(e => branchInstruction.Offset >= e.HandlerStart.Offset)
244-
.Where( e =>branchInstruction.Offset < e.HandlerEnd.Maybe(h => h.Offset, GetOffsetOfNextEndfinally(methodDefinition.Body, e.HandlerStart.Offset)))
244+
.Where(e => branchInstruction.Offset < e.HandlerEnd.Maybe(h => h.Offset, GetOffsetOfNextEndfinally(methodDefinition.Body, e.HandlerStart.Offset)))
245245
.OrderByDescending(h => h.HandlerStart.Offset) // we need to work inside out
246246
.Any(eh => !(methodDefinition.DebugInformation.GetSequencePointMapping()
247247
.Where(i => i.Value.StartLine != StepOverLineCode)
@@ -262,7 +262,7 @@ private static List<int> GetBranchPath(Instruction instruction)
262262
{
263263
var point = instruction;
264264
offsetList.Add(point.Offset);
265-
while ( point.OpCode == OpCodes.Br || point.OpCode == OpCodes.Br_S )
265+
while (point.OpCode == OpCodes.Br || point.OpCode == OpCodes.Br_S)
266266
{
267267
var nextPoint = point.Operand as Instruction;
268268
if (nextPoint != null)
@@ -283,7 +283,7 @@ private static List<int> GetBranchPath(Instruction instruction)
283283
private static Instruction FindClosestInstructionWithSequencePoint(MethodBody methodBody, Instruction instruction)
284284
{
285285
var sequencePointsInMethod = methodBody.Instructions.Where(i => HasValidSequencePoint(i, methodBody.Method)).ToList();
286-
if (!sequencePointsInMethod.Any())
286+
if (!sequencePointsInMethod.Any())
287287
return null;
288288
var idx = sequencePointsInMethod.BinarySearch(instruction, new InstructionByOffsetComparer());
289289
Instruction prev;

src/coverlet.msbuild.tasks/MSBuildLogger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class MSBuildLogger : ILogger
1616
public void LogVerbose(string message) => _log.LogMessage(MessageImportance.Low, $"{LogPrefix}{message}");
1717

1818
// We use `MessageImportance.High` because with `MessageImportance.Normal` doesn't show anything
19-
public void LogInformation(string message)=> _log.LogMessage(MessageImportance.High, $"{LogPrefix}{message}");
19+
public void LogInformation(string message) => _log.LogMessage(MessageImportance.High, $"{LogPrefix}{message}");
2020

2121
public void LogWarning(string message) => _log.LogWarning($"{LogPrefix}{message}");
2222

2323
public void LogError(string message) => _log.LogError($"{LogPrefix}{message}");
24-
24+
2525
public void LogError(Exception exception) => _log.LogErrorFromException(exception, true);
2626
}
2727
}

test/coverlet.core.tests/CoverageSummaryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void TestCalculateLineCoverage()
4646
var document = module.Value.First();
4747
var @class = document.Value.First();
4848
var method = @class.Value.First();
49-
49+
5050
Assert.Equal(0.5, summary.CalculateLineCoverage(module.Value).Percent);
5151
Assert.Equal(0.5, summary.CalculateLineCoverage(document.Value).Percent);
5252
Assert.Equal(0.5, summary.CalculateLineCoverage(@class.Value).Percent);

test/coverlet.core.tests/Helpers/InstrumentationHelperTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,16 @@ public void TestIncludeDirectories()
235235
string module = typeof(InstrumentationHelperTests).Assembly.Location;
236236

237237
var currentDirModules = InstrumentationHelper.GetCoverableModules(module,
238-
new[] {Environment.CurrentDirectory});
239-
238+
new[] { Environment.CurrentDirectory });
239+
240240
var parentDirWildcardModules = InstrumentationHelper.GetCoverableModules(module,
241-
new[] {Path.Combine(Directory.GetParent(Environment.CurrentDirectory).FullName, "*")});
241+
new[] { Path.Combine(Directory.GetParent(Environment.CurrentDirectory).FullName, "*") });
242242

243243
// There are at least as many modules found when searching the parent directory's subdirectories
244244
Assert.True(parentDirWildcardModules.Length >= currentDirModules.Length);
245245

246246
var relativePathModules = InstrumentationHelper.GetCoverableModules(module,
247-
new[] {"."});
247+
new[] { "." });
248248

249249
// Same number of modules found when using a relative path
250250
Assert.Equal(currentDirModules.Length, relativePathModules.Length);

test/coverlet.core.tests/Helpers/RetryHelperTests.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public class RetryHelperTests
1111
[Fact]
1212
public void TestRetryWithFixedRetryBackoff()
1313
{
14-
Func<TimeSpan> retryStrategy = () => {
14+
Func<TimeSpan> retryStrategy = () =>
15+
{
1516
return TimeSpan.FromMilliseconds(1);
1617
};
1718

@@ -30,14 +31,15 @@ public void TestRetryWithFixedRetryBackoff()
3031
public void TestRetryWithExponentialRetryBackoff()
3132
{
3233
var currentSleep = 6;
33-
Func<TimeSpan> retryStrategy = () => {
34+
Func<TimeSpan> retryStrategy = () =>
35+
{
3436
var sleep = TimeSpan.FromMilliseconds(currentSleep);
3537
currentSleep *= 2;
3638
return sleep;
3739
};
3840

3941
var target = new RetryTarget();
40-
try
42+
try
4143
{
4244
RetryHelper.Retry(() => target.TargetActionThrows(), retryStrategy, 3);
4345
}
@@ -51,7 +53,8 @@ public void TestRetryWithExponentialRetryBackoff()
5153
[Fact]
5254
public void TestRetryFinishesIfSuccessful()
5355
{
54-
Func<TimeSpan> retryStrategy = () => {
56+
Func<TimeSpan> retryStrategy = () =>
57+
{
5558
return TimeSpan.FromMilliseconds(1);
5659
};
5760

@@ -65,12 +68,12 @@ public void TestRetryFinishesIfSuccessful()
6568
public class RetryTarget
6669
{
6770
public int Calls { get; set; }
68-
public void TargetActionThrows()
71+
public void TargetActionThrows()
6972
{
7073
Calls++;
7174
throw new Exception("Simulating Failure");
7275
}
73-
public void TargetActionThrows5Times()
76+
public void TargetActionThrows5Times()
7477
{
7578
Calls++;
7679
if (Calls < 6) throw new Exception("Simulating Failure");

test/coverlet.core.tests/Instrumentation/ModuleTrackerTemplateTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void HitsFileWithDifferentNumberOfEntriesCausesExceptionOnUnload()
5252
Assert.Throws<InvalidOperationException>(() => ModuleTrackerTemplate.UnloadModule(null, null));
5353
}
5454

55-
[Fact(Skip="Failed CI Job: https://ci.appveyor.com/project/tonerdo/coverlet/builds/21145989/job/9gx5jnjs502vy1fv")]
55+
[Fact(Skip = "Failed CI Job: https://ci.appveyor.com/project/tonerdo/coverlet/builds/21145989/job/9gx5jnjs502vy1fv")]
5656
public void HitsOnMultipleThreadsCorrectlyCounted()
5757
{
5858
ModuleTrackerTemplate.HitsArray = new[] { 0, 0, 0, 0 };
@@ -88,7 +88,7 @@ public void MultipleSequentialUnloadsHaveCorrectTotalData()
8888
var expectedHitsArray = new[] { 0, 4, 4, 4 };
8989
Assert.Equal(expectedHitsArray, ReadHitsFile());
9090
}
91-
91+
9292
[Fact]
9393
public async void MutexBlocksMultipleWriters()
9494
{

test/coverlet.core.tests/Reporters/JsonReporterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void TestReport()
2525

2626
Documents documents = new Documents();
2727
documents.Add("doc.cs", classes);
28-
28+
2929
result.Modules = new Modules();
3030
result.Modules.Add("module", documents);
3131

0 commit comments

Comments
 (0)