Skip to content

Commit a94e1ec

Browse files
authored
Updated code to prefer concrete values over default (#8345)
1 parent fd5f63f commit a94e1ec

File tree

491 files changed

+2215
-2080
lines changed

Some content is hidden

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

491 files changed

+2215
-2080
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ resharper_enforce_if_statement_braces_highlighting = error
124124
resharper_enforce_lock_statement_braces_highlighting = error
125125
resharper_enforce_using_statement_braces_highlighting = error
126126
resharper_enforce_while_statement_braces_highlighting = error
127+
resharper_prefer_concrete_value_over_default_highlighting = error
127128

128129
# ReSharper properties
129130
resharper_align_multiline_binary_expressions_chain = false

src/CookieCrumble/src/CookieCrumble.Xunit/Attributes/UseCultureAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class UseCultureAttribute : BeforeAfterTestAttribute
1818
{
1919
private readonly Lazy<CultureInfo> _culture;
2020
private readonly Lazy<CultureInfo> _uiCulture;
21-
private CultureInfo _originalCulture = default!;
22-
private CultureInfo _originalUiCulture = default!;
21+
private CultureInfo _originalCulture = null!;
22+
private CultureInfo _originalUiCulture = null!;
2323

2424
/// <summary>
2525
/// Replaces the culture and UI culture of the current thread with

src/GreenDonut/src/GreenDonut.Data.EntityFramework/Expressions/ExpressionHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ public class Group<TKey, TValue>
353353
{
354354
public TKey Key { get; set; } = default!;
355355

356-
public List<TValue> Items { get; set; } = default!;
356+
public List<TValue> Items { get; set; } = null!;
357357
}
358358

359359
public readonly struct OrderRewriterResult(

src/GreenDonut/src/GreenDonut/Result.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public readonly record struct Result<TValue>
1313
/// <param name="value">The value.</param>
1414
public Result(TValue value) : this()
1515
{
16-
Error = default;
16+
Error = null;
1717
Value = value;
1818
Kind = ResultKind.Value;
1919
}

src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/Brand.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ public class Brand
99
public int Id { get; set; }
1010

1111
[Required]
12-
public string Name { get; set; } = default!;
12+
public string Name { get; set; } = null!;
1313

1414
public string? DisplayName { get; set; }
1515

1616
public string? AlwaysNull { get; set; }
1717

1818
public ICollection<Product> Products { get; set; } = [];
1919

20-
public BrandDetails BrandDetails { get; set; } = default!;
20+
public BrandDetails BrandDetails { get; set; } = null!;
2121
}
2222

2323
public class BrandDetails
2424
{
25-
public Country Country { get; set; } = default!;
25+
public Country Country { get; set; } = null!;
2626
}
2727

2828
public class Country
2929
{
30-
public string Name { get; set; } = default!;
30+
public string Name { get; set; } = null!;
3131
}

src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/CatalogContext.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
1010
optionsBuilder.UseNpgsql(connectionString);
1111
}
1212

13-
public DbSet<Product> Products { get; set; } = default!;
13+
public DbSet<Product> Products { get; set; } = null!;
1414

15-
public DbSet<ProductType> ProductTypes { get; set; } = default!;
15+
public DbSet<ProductType> ProductTypes { get; set; } = null!;
1616

17-
public DbSet<Brand> Brands { get; set; } = default!;
17+
public DbSet<Brand> Brands { get; set; } = null!;
1818

19-
public DbSet<Test> Tests { get; set; } = default!;
19+
public DbSet<Test> Tests { get; set; } = null!;
2020

2121
protected override void OnModelCreating(ModelBuilder builder)
2222
{

src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/FooBarContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class Foo
3636
public int Id { get; set; }
3737

3838
[MaxLength(100)]
39-
public string Name { get; set; } = default!;
39+
public string Name { get; set; } = null!;
4040

4141
public int? BarId { get; set; }
4242

@@ -51,7 +51,7 @@ public class Bar
5151
public string? Description { get; set; }
5252

5353
[MaxLength(100)]
54-
public string SomeField1 { get; set; } = default!;
54+
public string SomeField1 { get; set; } = null!;
5555

5656
[MaxLength(100)]
5757
public string? SomeField2 { get; set; }

src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/Product.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class Product
99
public int Id { get; set; }
1010

1111
[Required]
12-
public string Name { get; set; } = default!;
12+
public string Name { get; set; } = null!;
1313

1414
public string? Description { get; set; }
1515

src/GreenDonut/test/GreenDonut.Data.EntityFramework.Tests/TestContext/ProductType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class ProductType
88
{
99
public int Id { get; set; }
1010

11-
[Required] public string Name { get; set; } = default!;
11+
[Required] public string Name { get; set; } = null!;
1212

1313
public ICollection<Product> Products { get; } = [];
1414
}

src/GreenDonut/test/GreenDonut.Data.Tests/Cursors/CursorFormatterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void Format_And_Parse_Two_Keys_With_Colon()
115115

116116
public class MyClass
117117
{
118-
public string Name { get; set; } = default!;
118+
public string Name { get; set; } = null!;
119119

120120
public string? Description { get; set; }
121121
}

0 commit comments

Comments
 (0)