Skip to content

Commit ece21e6

Browse files
authored
Merge branch 'coverlet-coverage:master' into master
2 parents 6ccffce + 03ff455 commit ece21e6

File tree

135 files changed

+1709
-1161
lines changed

Some content is hidden

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

135 files changed

+1709
-1161
lines changed

.editorconfig

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
###############################
7+
# Core EditorConfig Options #
8+
###############################
9+
# All files
10+
[*]
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 4
14+
trim_trailing_whitespace = true
15+
16+
# XML project files
17+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
18+
indent_size = 2
19+
charset = utf-8
20+
21+
# XML config files
22+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
23+
indent_size = 2
24+
25+
# Xml build files
26+
[*.builds]
27+
indent_size = 2
28+
29+
# Xml files
30+
[*.{xml,stylecop,resx,ruleset}]
31+
indent_size = 2
32+
33+
# YAML config files
34+
[*.{yml,yaml}]
35+
indent_size = 2
36+
37+
# Shell scripts
38+
[*.sh]
39+
end_of_line = lf
40+
[*.{cmd,bat}]
41+
end_of_line = crlf
42+
43+
# Code files
44+
[*.{cs,csx,vb,vbx}]
45+
indent_size = 4
46+
insert_final_newline = true
47+
charset = utf-8-bom
48+
###############################
49+
# .NET Coding Conventions #
50+
###############################
51+
[*.{cs,vb}]
52+
# Organize usings
53+
dotnet_sort_system_directives_first = true
54+
## IDE0005: Using directive is unnecessary.
55+
dotnet_diagnostic.IDE0005.severity = warning
56+
# License header
57+
file_header_template = Copyright (c) Toni Solarin-Sodara\nLicensed under the MIT license. See LICENSE file in the project root for full license information.
58+
## IDE0073: The file header is missing or not located at the top of the file
59+
dotnet_diagnostic.IDE0073.severity = warning
60+
# this. preferences
61+
dotnet_style_qualification_for_field = false:warning
62+
dotnet_style_qualification_for_property = false:warning
63+
dotnet_style_qualification_for_method = false:warning
64+
dotnet_style_qualification_for_event = false:warning
65+
# Language keywords vs BCL types preferences
66+
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
67+
dotnet_style_predefined_type_for_member_access = true:silent
68+
# Parentheses preferences
69+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
70+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
71+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
72+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
73+
# Modifier preferences
74+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
75+
dotnet_style_readonly_field = true:warning
76+
## IDE0044: Add readonly modifier
77+
dotnet_diagnostic.IDE0044.severity = warning
78+
# Expression-level preferences
79+
dotnet_style_object_initializer = true:suggestion
80+
dotnet_style_collection_initializer = true:suggestion
81+
dotnet_style_explicit_tuple_names = true:suggestion
82+
dotnet_style_null_propagation = true:suggestion
83+
dotnet_style_coalesce_expression = true:suggestion
84+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
85+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
86+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
87+
dotnet_style_prefer_auto_properties = true:warning
88+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
89+
dotnet_style_prefer_conditional_expression_over_return = true:silent
90+
###############################
91+
# Naming Conventions #
92+
###############################
93+
# Name all constant fields using PascalCase
94+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
95+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
96+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
97+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
98+
dotnet_naming_symbols.constant_fields.required_modifiers = const
99+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
100+
# Static fields should have s_ prefix
101+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
102+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
103+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
104+
dotnet_naming_symbols.static_fields.applicable_kinds = field
105+
dotnet_naming_symbols.static_fields.required_modifiers = static
106+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
107+
dotnet_naming_style.static_prefix_style.required_prefix = s_
108+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
109+
# Internal and private fields should be _camelCase
110+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
111+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
112+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
113+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
114+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
115+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
116+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
117+
###############################
118+
# C# Coding Conventions #
119+
###############################
120+
[*.cs]
121+
# Organize usings
122+
csharp_using_directive_placement = outside_namespace:warning
123+
# var preferences - use keywords instead of BCL types, and permit var only when the type is clear
124+
csharp_style_var_for_built_in_types = false:warning
125+
csharp_style_var_when_type_is_apparent = true:warning
126+
csharp_style_var_elsewhere = false:warning
127+
# Expression-bodied members
128+
csharp_style_expression_bodied_methods = false:silent
129+
csharp_style_expression_bodied_constructors = false:silent
130+
csharp_style_expression_bodied_operators = false:silent
131+
csharp_style_expression_bodied_properties = true:silent
132+
csharp_style_expression_bodied_indexers = true:silent
133+
csharp_style_expression_bodied_accessors = true:silent
134+
# Pattern matching preferences
135+
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
136+
csharp_style_pattern_matching_over_as_with_null_check = true:warning
137+
csharp_style_prefer_not_pattern = true
138+
## IDE0083: Use pattern matching
139+
dotnet_diagnostic.IDE0083.severity = warning
140+
# Null-checking preferences
141+
csharp_style_throw_expression = true:warning
142+
csharp_style_conditional_delegate_call = true:warning
143+
# Modifier preferences
144+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
145+
# Expression-level preferences
146+
csharp_prefer_braces = true:silent
147+
csharp_style_deconstructed_variable_declaration = true:suggestion
148+
csharp_prefer_simple_default_expression = true:warning
149+
## IDE0034: Simplify 'default' expression
150+
dotnet_diagnostic.IDE0034.severity = warning
151+
csharp_style_pattern_local_over_anonymous_function = true:suggestion
152+
csharp_style_inlined_variable_declaration = true:warning
153+
###############################
154+
# C# Formatting Rules #
155+
###############################
156+
# New line preferences
157+
csharp_new_line_before_open_brace = all
158+
csharp_new_line_before_else = true
159+
csharp_new_line_before_catch = true
160+
csharp_new_line_before_finally = true
161+
csharp_new_line_before_members_in_object_initializers = true
162+
csharp_new_line_before_members_in_anonymous_types = true
163+
csharp_new_line_between_query_expression_clauses = true
164+
dotnet_style_allow_multiple_blank_lines_experimental=false:warning
165+
# Indentation preferences
166+
csharp_indent_case_contents = true
167+
csharp_indent_switch_labels = true
168+
csharp_indent_block_contents = true
169+
csharp_indent_braces = false
170+
csharp_indent_case_contents_when_block = true
171+
csharp_indent_labels = one_less_than_current
172+
# Space preferences
173+
csharp_space_after_cast = false
174+
csharp_space_after_colon_in_inheritance_clause = true
175+
csharp_space_after_comma = true
176+
csharp_space_after_dot = false
177+
csharp_space_after_keywords_in_control_flow_statements = true
178+
csharp_space_after_semicolon_in_for_statement = true
179+
csharp_space_around_binary_operators = before_and_after
180+
csharp_space_around_declaration_statements = do_not_ignore
181+
csharp_space_before_colon_in_inheritance_clause = true
182+
csharp_space_before_comma = false
183+
csharp_space_before_dot = false
184+
csharp_space_before_open_square_brackets = false
185+
csharp_space_before_semicolon_in_for_statement = false
186+
csharp_space_between_empty_square_brackets = false
187+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
188+
csharp_space_between_method_call_name_and_opening_parenthesis = false
189+
csharp_space_between_method_call_parameter_list_parentheses = false
190+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
191+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
192+
csharp_space_between_method_declaration_parameter_list_parentheses = false
193+
csharp_space_between_parentheses = false
194+
csharp_space_between_square_brackets = false
195+
# Wrapping preferences
196+
csharp_preserve_single_line_statements = true
197+
csharp_preserve_single_line_blocks = true

Directory.Build.props

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
<IncludeSymbols>true</IncludeSymbols>
1010
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1111
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
12+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
13+
<AnalysisLevel>preview</AnalysisLevel>
14+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1215
<LangVersion>preview</LangVersion>
13-
<NoWarn>$(NoWarn);NU5105</NoWarn>
16+
<NoWarn>$(NoWarn);NU5105</NoWarn>
1417
<RestoreSources>
1518
https://api.nuget.org/v3/index.json;
1619
</RestoreSources>

coverlet.sln

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.28902.138
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.2.32208.508
55
MinimumVisualStudioVersion = 15.0.26124.0
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E877EBA4-E78B-4F7D-A2D3-1E070FED04CD}"
77
EndProject
@@ -27,6 +27,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.tests.projectsampl
2727
EndProject
2828
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77A15177-8262-488F-AF2B-91B9055715DA}"
2929
ProjectSection(SolutionItems) = preProject
30+
.editorconfig = .editorconfig
3031
.gitignore = .gitignore
3132
eng\azure-pipelines-nightly.yml = eng\azure-pipelines-nightly.yml
3233
eng\azure-pipelines.yml = eng\azure-pipelines.yml
@@ -53,9 +54,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{9A8B19D4
5354
test\Directory.Build.targets = test\Directory.Build.targets
5455
EndProjectSection
5556
EndProject
56-
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "coverlet.tests.projectsample.fsharp", "test\coverlet.tests.projectsample.fsharp\coverlet.tests.projectsample.fsharp.fsproj", "{1CBF6966-2A67-4D2C-8598-D174B83072F4}"
57+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "coverlet.tests.projectsample.fsharp", "test\coverlet.tests.projectsample.fsharp\coverlet.tests.projectsample.fsharp.fsproj", "{1CBF6966-2A67-4D2C-8598-D174B83072F4}"
5758
EndProject
58-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "coverlet.tests.projectsample.netframework", "test\coverlet.tests.projectsample.netframework\coverlet.tests.projectsample.netframework.csproj", "{E69D68C9-78ED-4076-A14B-D07295A4B2A5}"
59+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.tests.projectsample.netframework", "test\coverlet.tests.projectsample.netframework\coverlet.tests.projectsample.netframework.csproj", "{E69D68C9-78ED-4076-A14B-D07295A4B2A5}"
5960
EndProject
6061
Global
6162
GlobalSection(SolutionConfigurationPlatforms) = preSolution

src/coverlet.collector/DataCollection/AttachmentManager.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
using System;
1+
// Copyright (c) Toni Solarin-Sodara
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
25
using System.ComponentModel;
36
using System.IO;
4-
57
using coverlet.collector.Resources;
68
using Coverlet.Collector.Utilities;
79
using Coverlet.Collector.Utilities.Interfaces;
@@ -50,7 +52,7 @@ public AttachmentManager(DataCollectionSink dataSink, DataCollectionContext data
5052
_reportDirectory = Path.Combine(Path.GetTempPath(), reportDirectoryName);
5153

5254
// Register events
53-
_dataSink.SendFileCompleted += this.OnSendFileCompleted;
55+
_dataSink.SendFileCompleted += OnSendFileCompleted;
5456
}
5557

5658
/// <summary>
@@ -61,10 +63,10 @@ public AttachmentManager(DataCollectionSink dataSink, DataCollectionContext data
6163
public void SendCoverageReport(string coverageReport, string coverageReportFileName)
6264
{
6365
// Save coverage report to file
64-
string coverageReportPath = this.SaveCoverageReport(coverageReport, coverageReportFileName);
66+
string coverageReportPath = SaveCoverageReport(coverageReport, coverageReportFileName);
6567

6668
// Send coverage attachment to test platform.
67-
this.SendAttachment(coverageReportPath);
69+
SendAttachment(coverageReportPath);
6870
}
6971

7072
/// <summary>
@@ -78,9 +80,9 @@ public void Dispose()
7880
_countDownEvent.Wait();
7981
if (_dataSink != null)
8082
{
81-
_dataSink.SendFileCompleted -= this.OnSendFileCompleted;
83+
_dataSink.SendFileCompleted -= OnSendFileCompleted;
8284
}
83-
this.CleanupReportDirectory();
85+
CleanupReportDirectory();
8486
}
8587
catch (Exception ex)
8688
{

src/coverlet.collector/DataCollection/CoverageManager.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System;
1+
// Copyright (c) Toni Solarin-Sodara
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
25
using System.Collections.Generic;
36
using System.IO;
47
using System.Linq;
@@ -77,8 +80,8 @@ public void InstrumentModules()
7780
public IEnumerable<(string report, string fileName)> GetCoverageReports()
7881
{
7982
// Get coverage result
80-
CoverageResult coverageResult = this.GetCoverageResult();
81-
return this.GetCoverageReports(coverageResult);
83+
CoverageResult coverageResult = GetCoverageResult();
84+
return GetCoverageReports(coverageResult);
8285
}
8386

8487
/// <summary>

src/coverlet.collector/DataCollection/CoverageWrapper.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using Coverlet.Collector.Utilities.Interfaces;
1+
// Copyright (c) Toni Solarin-Sodara
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using Coverlet.Collector.Utilities.Interfaces;
25
using Coverlet.Core;
36
using Coverlet.Core.Abstractions;
47

src/coverlet.collector/DataCollection/CoverletCoverageCollector.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System;
1+
// Copyright (c) Toni Solarin-Sodara
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
25
using System.Collections.Generic;
36
using System.Diagnostics;
47
using System.Linq;
@@ -124,7 +127,7 @@ private void OnSessionStart(object sender, SessionStartEventArgs sessionStartEve
124127
try
125128
{
126129
// Get coverlet settings
127-
IEnumerable<string> testModules = this.GetTestModules(sessionStartEventArgs);
130+
IEnumerable<string> testModules = GetTestModules(sessionStartEventArgs);
128131
var coverletSettingsParser = new CoverletSettingsParser(_eqtTrace);
129132
CoverletSettings coverletSettings = coverletSettingsParser.Parse(_configurationElement, testModules);
130133

@@ -142,7 +145,7 @@ private void OnSessionStart(object sender, SessionStartEventArgs sessionStartEve
142145
catch (Exception ex)
143146
{
144147
_logger.LogWarning(ex.ToString());
145-
this.Dispose(true);
148+
Dispose(true);
146149
}
147150
}
148151

@@ -179,7 +182,7 @@ private void OnSessionEnd(object sender, SessionEndEventArgs e)
179182
catch (Exception ex)
180183
{
181184
_logger.LogWarning(ex.ToString());
182-
this.Dispose(true);
185+
Dispose(true);
183186
}
184187
}
185188

src/coverlet.collector/DataCollection/CoverletLogger.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using System;
1+
// Copyright (c) Toni Solarin-Sodara
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
23

4+
using System;
35
using Coverlet.Collector.Utilities;
46
using Coverlet.Core.Abstractions;
57

src/coverlet.collector/DataCollection/CoverletSettings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System.Linq;
1+
// Copyright (c) Toni Solarin-Sodara
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System.Linq;
25
using System.Text;
36

47
namespace Coverlet.Collector.DataCollection

0 commit comments

Comments
 (0)