Skip to content

Commit 1a4df25

Browse files
committed
Merge remote-tracking branch 'upstream/master' into add-tuplewise-operator
Conflicts resolved: - MoreLinq.Test/MoreLinq.Test.csproj
2 parents 9607605 + 283c44c commit 1a4df25

File tree

249 files changed

+8581
-4262
lines changed

Some content is hidden

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

249 files changed

+8581
-4262
lines changed

.config/dotnet-tools.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"isRoot": true,
44
"tools": {
55
"dotnet-t4": {
6-
"version": "2.0.5",
6+
"version": "2.3.0",
77
"commands": [
88
"t4"
99
]
1010
},
1111
"dotnet-reportgenerator-globaltool": {
12-
"version": "4.3.6",
12+
"version": "5.1.11",
1313
"commands": [
1414
"reportgenerator"
1515
]
1616
}
1717
}
18-
}
18+
}

.editorconfig

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ trim_trailing_whitespace = true
1010
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
1111
indent_size = 2
1212

13+
[*.Build.{props,targets}]
14+
indent_size = 2
15+
1316
[*.{sln}]
1417
indent_style = tab
1518

@@ -23,28 +26,33 @@ indent_size = 4
2326
max_line_length = 100
2427

2528
[*.cs]
29+
dotnet_analyzer_diagnostic.category-Style.severity = warning
30+
31+
# IDE0022: Use expression/block body for methods
32+
dotnet_diagnostic.IDE0022.severity = suggestion
33+
2634
# Prefer "var" everywhere
27-
csharp_style_var_for_built_in_types = true:suggestion
28-
csharp_style_var_when_type_is_apparent = true:suggestion
29-
csharp_style_var_elsewhere = true:suggestion
35+
csharp_style_var_for_built_in_types = true
36+
csharp_style_var_when_type_is_apparent = true
37+
csharp_style_var_elsewhere = true
3038

3139
# Prefer method-like constructs to have a block body
32-
csharp_style_expression_bodied_methods = false:none
33-
csharp_style_expression_bodied_constructors = false:none
34-
csharp_style_expression_bodied_operators = false:none
40+
csharp_style_expression_bodied_methods = true
41+
csharp_style_expression_bodied_constructors = true
42+
csharp_style_expression_bodied_operators = true
3543

3644
# Prefer property-like constructs to have an expression-body
37-
csharp_style_expression_bodied_properties = true:none
38-
csharp_style_expression_bodied_indexers = true:none
39-
csharp_style_expression_bodied_accessors = true:none
45+
csharp_style_expression_bodied_properties = true
46+
csharp_style_expression_bodied_indexers = true
47+
csharp_style_expression_bodied_accessors = true
4048

4149
# Suggest more modern language features when available
42-
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
43-
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
44-
csharp_style_inlined_variable_declaration = true:suggestion
45-
csharp_style_throw_expression = true:suggestion
46-
csharp_style_conditional_delegate_call = true:suggestion
47-
csharp_prefer_simple_default_expression = true:suggestion
50+
csharp_style_pattern_matching_over_is_with_cast_check = true
51+
csharp_style_pattern_matching_over_as_with_null_check = true
52+
csharp_style_inlined_variable_declaration = true
53+
csharp_style_throw_expression = true
54+
csharp_style_conditional_delegate_call = true
55+
csharp_prefer_simple_default_expression = true
4856

4957
# Spacing
5058
csharp_space_after_cast = false
@@ -54,3 +62,27 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
5462
# Wrapping
5563
csharp_preserve_single_line_statements = true
5664
csharp_preserve_single_line_blocks = true
65+
66+
# Indentation
67+
csharp_indent_case_contents_when_block = false
68+
69+
# Modifier preferences
70+
dotnet_style_require_accessibility_modifiers = omit_if_default
71+
72+
# IDE0011: Add braces
73+
csharp_prefer_braces = when_multiline
74+
75+
# IDE0061: Use block body for local functions
76+
csharp_style_expression_bodied_local_functions = true
77+
78+
# IDE0065: Misplaced using directive
79+
csharp_using_directive_placement = inside_namespace
80+
81+
# IDE0048: Add parentheses for clarity
82+
dotnet_diagnostic.IDE0048.severity = suggestion
83+
84+
# IDE0055: Fix formatting
85+
dotnet_diagnostic.IDE0055.severity = suggestion
86+
87+
# IDE0046: Convert to conditional expression
88+
dotnet_diagnostic.IDE0046.severity = suggestion

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.opencover.xml
2+
**/TestResults/
23

34
### VisualStudio ###
45
## Ignore Visual Studio temporary files, build results, and

.travis.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

Directory.Build.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<PropertyGroup>
3+
<LangVersion>11</LangVersion>
4+
<Nullable>enable</Nullable>
5+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
6+
<AnalysisLevel>7.0-all</AnalysisLevel>
7+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
8+
</PropertyGroup>
9+
</Project>

MoreLinq.Test/.editorconfig

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[*.cs]
2+
3+
# CA1034: Nested types should not be visible
4+
dotnet_diagnostic.CA1034.severity = none
5+
6+
# CA1062: Validate arguments of public methods
7+
dotnet_diagnostic.CA1062.severity = none
8+
9+
# CA1825: Avoid zero-length array allocations
10+
dotnet_diagnostic.CA1825.severity = suggestion
11+
12+
# CA1032: Implement standard exception constructors
13+
dotnet_diagnostic.CA1032.severity = none
14+
15+
# CA1064: Exceptions should be public
16+
dotnet_diagnostic.CA1064.severity = none
17+
18+
# CA1303: Do not pass literals as localized parameters
19+
dotnet_diagnostic.CA1303.severity = none
20+
21+
# CA5394: Do not use insecure randomness
22+
dotnet_diagnostic.CA5394.severity = none
23+
24+
# CA1707: Identifiers should not contain underscores
25+
dotnet_diagnostic.CA1707.severity = none
26+
27+
# CA1308: Normalize strings to uppercase
28+
dotnet_diagnostic.CA1308.severity = none
29+
30+
# IDE0047: Remove unnecessary parentheses
31+
dotnet_diagnostic.IDE0047.severity = suggestion
32+
33+
[*{Test,Tests}.cs]
34+
35+
# IDE0022: Use expression/block body for methods
36+
dotnet_diagnostic.IDE0022.severity = none

MoreLinq.Test/AcquireTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public class AcquireTest
2626
[Test]
2727
public void AcquireAll()
2828
{
29-
Disposable a = null;
30-
Disposable b = null;
31-
Disposable c = null;
29+
Disposable? a = null;
30+
Disposable? b = null;
31+
Disposable? c = null;
3232

3333
var allocators = MoreEnumerable.From(() => a = new Disposable(),
3434
() => b = new Disposable(),
@@ -48,16 +48,16 @@ public void AcquireAll()
4848
[Test]
4949
public void AcquireSome()
5050
{
51-
Disposable a = null;
52-
Disposable b = null;
53-
Disposable c = null;
51+
Disposable? a = null;
52+
Disposable? b = null;
53+
Disposable? c = null;
5454

5555
var allocators = MoreEnumerable.From(() => a = new Disposable(),
5656
() => b = new Disposable(),
5757
() => throw new TestException(),
5858
() => c = new Disposable());
5959

60-
Assert.Throws<TestException>(() => allocators.Acquire());
60+
Assert.That(allocators.Acquire, Throws.TypeOf<TestException>());
6161

6262
Assert.That(a, Is.Not.Null);
6363
Assert.That(a.Disposed, Is.True);
@@ -66,10 +66,10 @@ public void AcquireSome()
6666
Assert.That(c, Is.Null);
6767
}
6868

69-
class Disposable : IDisposable
69+
sealed class Disposable : IDisposable
7070
{
7171
public bool Disposed { get; private set; }
72-
public void Dispose() { Disposed = true; }
72+
public void Dispose() => Disposed = true;
7373
}
7474
}
7575
}

MoreLinq.Test/AggregateRightTest.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
namespace MoreLinq.Test
1919
{
20-
using System;
2120
using NUnit.Framework;
2221

2322
[TestFixture]
@@ -28,8 +27,8 @@ public class AggregateRightTest
2827
[Test]
2928
public void AggregateRightWithEmptySequence()
3029
{
31-
Assert.Throws<InvalidOperationException>(
32-
() => new int[0].AggregateRight((a, b) => a + b));
30+
Assert.That(() => new int[0].AggregateRight((a, b) => a + b),
31+
Throws.InvalidOperationException);
3332
}
3433

3534
[Test]
@@ -47,9 +46,9 @@ public void AggregateRightFuncIsNotInvokedOnSingleElementSequence()
4746
[TestCase(SourceKind.Sequence)]
4847
public void AggregateRight(SourceKind sourceKind)
4948
{
50-
var enumerable = Enumerable.Range(1, 5).Select(x => x.ToString()).ToSourceKind(sourceKind);
49+
var enumerable = Enumerable.Range(1, 5).Select(x => x.ToInvariantString()).ToSourceKind(sourceKind);
5150

52-
var result = enumerable.AggregateRight((a, b) => string.Format("({0}+{1})", a, b));
51+
var result = enumerable.AggregateRight((a, b) => $"({a}+{b})");
5352

5453
Assert.That(result, Is.EqualTo("(1+(2+(3+(4+5))))"));
5554
}
@@ -61,7 +60,7 @@ public void AggregateRight(SourceKind sourceKind)
6160
[TestCase(true)]
6261
public void AggregateRightSeedWithEmptySequence(object defaultValue)
6362
{
64-
Assert.That(new int[0].AggregateRight(defaultValue, (a, b) => b), Is.EqualTo(defaultValue));
63+
Assert.That(new int[0].AggregateRight(defaultValue, (_, b) => b), Is.EqualTo(defaultValue));
6564
}
6665

6766
[Test]
@@ -78,7 +77,7 @@ public void AggregateRightSeedFuncIsNotInvokedOnEmptySequence()
7877
public void AggregateRightSeed()
7978
{
8079
var result = Enumerable.Range(1, 4)
81-
.AggregateRight("5", (a, b) => string.Format("({0}+{1})", a, b));
80+
.AggregateRight("5", (a, b) => $"({a}+{b})");
8281

8382
Assert.That(result, Is.EqualTo("(1+(2+(3+(4+5))))"));
8483
}
@@ -90,14 +89,14 @@ public void AggregateRightSeed()
9089
[TestCase(true)]
9190
public void AggregateRightResultorWithEmptySequence(object defaultValue)
9291
{
93-
Assert.That(new int[0].AggregateRight(defaultValue, (a, b) => b, a => a == defaultValue), Is.EqualTo(true));
92+
Assert.That(new int[0].AggregateRight(defaultValue, (_, b) => b, a => a == defaultValue), Is.EqualTo(true));
9493
}
9594

9695
[Test]
9796
public void AggregateRightResultor()
9897
{
9998
var result = Enumerable.Range(1, 4)
100-
.AggregateRight("5", (a, b) => string.Format("({0}+{1})", a, b), a => a.Length);
99+
.AggregateRight("5", (a, b) => $"({a}+{b})", a => a.Length);
101100

102101
Assert.That(result, Is.EqualTo("(1+(2+(3+(4+5))))".Length));
103102
}

0 commit comments

Comments
 (0)