-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed all occurenceas of var #1
base: main
Are you sure you want to change the base?
Changes from all commits
cbf0e9e
e849b0f
89c698b
b047662
0a22179
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,8 +104,8 @@ dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:war | |
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning | ||
dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion | ||
# Expression-level preferences | ||
dotnet_style_object_initializer = true:warning | ||
dotnet_style_collection_initializer = true:warning | ||
dotnet_style_object_initializer = true:error | ||
dotnet_style_collection_initializer = true:error | ||
dotnet_style_explicit_tuple_names = true:warning | ||
dotnet_style_prefer_inferred_tuple_names = true:warning | ||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning | ||
|
@@ -135,9 +135,9 @@ csharp_style_prefer_null_check_over_type_check = true:warning | |
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules | ||
[*.{cs,csx,cake}] | ||
# 'var' preferences | ||
csharp_style_var_for_built_in_types = false:warning | ||
csharp_style_var_when_type_is_apparent = false:warning | ||
csharp_style_var_elsewhere = false:warning | ||
csharp_style_var_for_built_in_types = false:error | ||
csharp_style_var_when_type_is_apparent = false:error | ||
csharp_style_var_elsewhere = false:error | ||
Comment on lines
+138
to
+140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Changing var preferences from warning to error may be too restrictive. Consider keeping as warning to maintain flexibility where explicit types harm readability. |
||
# Expression-bodied members | ||
csharp_style_expression_bodied_methods = true:warning | ||
csharp_style_expression_bodied_constructors = true:warning | ||
|
@@ -160,7 +160,7 @@ csharp_style_pattern_local_over_anonymous_function = true:warning | |
csharp_style_deconstructed_variable_declaration = true:warning | ||
csharp_style_prefer_index_operator = true:warning | ||
csharp_style_prefer_range_operator = true:warning | ||
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning | ||
csharp_style_implicit_object_creation_when_type_is_apparent = true:error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider keeping implicit object creation as warning - error severity may force unnecessary verbosity in obvious type scenarios. |
||
# "Null" checking preferences | ||
csharp_style_throw_expression = true:warning | ||
csharp_style_conditional_delegate_call = true:warning | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FBuiltInTypes/@EntryIndexedValue">ERROR</s:String> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FElsewhere/@EntryIndexedValue">ERROR</s:String> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FSimpleTypes/@EntryIndexedValue">ERROR</s:String> | ||
Comment on lines
+2
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Setting var-to-type suggestions as errors may be too strict and could reduce code readability in cases where types are obvious or very long. Consider using WARNING instead of ERROR to provide flexibility. |
||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionExpression/@EntryIndexedValue">ERROR</s:String> | ||
<s:String x:Key="/Default/CodeInspection/Highlighting/UseCollectionExpression/ConvertEmptyCollection/@EntryValue">ERROR</s:String> | ||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseExplicitType</s:String> | ||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String> | ||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String></wpf:ResourceDictionary> |
+6 −6 | .editorconfig | |
+3 −0 | .gitattributes | |
+3 −3 | .github/workflows/build-and-test.yml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,15 +8,15 @@ namespace SixLabors.ImageSharp; | |
/// </content> | ||
public partial struct Color | ||
{ | ||
private static readonly Lazy<Color[]> WebSafePaletteLazy = new Lazy<Color[]>(CreateWebSafePalette, true); | ||
private static readonly Lazy<Color[]> WebSafePaletteLazy = new(CreateWebSafePalette, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider keeping explicit type for Lazy<Color[]> constructor since removing it doesn't improve readability here |
||
|
||
/// <summary> | ||
/// Gets a collection of named, web safe colors as defined in the CSS Color Module Level 4. | ||
/// </summary> | ||
public static ReadOnlyMemory<Color> WebSafePalette => WebSafePaletteLazy.Value; | ||
|
||
private static Color[] CreateWebSafePalette() => new[] | ||
{ | ||
private static Color[] CreateWebSafePalette() => | ||
[ | ||
AliceBlue, | ||
AntiqueWhite, | ||
Aqua, | ||
|
@@ -159,5 +159,5 @@ private static Color[] CreateWebSafePalette() => new[] | |
WhiteSmoke, | ||
Yellow, | ||
YellowGreen | ||
}; | ||
]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,16 @@ namespace SixLabors.ImageSharp; | |
/// </content> | ||
public partial struct Color | ||
{ | ||
private static readonly Lazy<Color[]> WernerPaletteLazy = new Lazy<Color[]>(CreateWernerPalette, true); | ||
private static readonly Lazy<Color[]> WernerPaletteLazy = new(CreateWernerPalette, true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider keeping the explicit type for Lazy<Color[]> since it's a field declaration. While target-typed new is cleaner, explicit types on fields can aid readability and maintainability. |
||
|
||
/// <summary> | ||
/// Gets a collection of colors as defined in the original second edition of Werner’s Nomenclature of Colours 1821. | ||
/// The hex codes were collected and defined by Nicholas Rougeux <see href="https://www.c82.net/werner"/>. | ||
/// </summary> | ||
public static ReadOnlyMemory<Color> WernerPalette => WernerPaletteLazy.Value; | ||
|
||
private static Color[] CreateWernerPalette() => new[] | ||
{ | ||
private static Color[] CreateWernerPalette() => | ||
[ | ||
ParseHex("#f1e9cd"), | ||
ParseHex("#f2e7cf"), | ||
ParseHex("#ece6d0"), | ||
|
@@ -128,5 +128,5 @@ private static Color[] CreateWernerPalette() => new[] | |
ParseHex("#9b856b"), | ||
ParseHex("#766051"), | ||
ParseHex("#453b32") | ||
}; | ||
]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ namespace SixLabors.ImageSharp.ColorProfiles; | |
/// <param name="h">The hue in degrees.</param> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public CieLchuv(float l, float c, float h) | ||
: this(new Vector3(l, c, h)) | ||
: this(new(l, c, h)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider keeping the explicit Vector3 type here for better readability, even though type inference works correctly |
||
{ | ||
} | ||
|
||
|
@@ -102,7 +102,7 @@ public static CieLchuv FromProfileConnectingSpace(ColorConversionOptions options | |
hDegrees += 360; | ||
} | ||
|
||
return new CieLchuv(l, c, hDegrees); | ||
return new(l, c, hDegrees); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider keeping the explicit CieLchuv type here for better readability, even though type inference works correctly |
||
} | ||
|
||
/// <inheritdoc/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,10 +91,10 @@ public static CieXyy FromProfileConnectingSpace(ColorConversionOptions options, | |
|
||
if (float.IsNaN(x) || float.IsNaN(y)) | ||
{ | ||
return new CieXyy(0, 0, source.Y); | ||
return new(0, 0, source.Y); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding explicit type CieXyy here for better readability and consistency with the codebase's apparent move toward explicit typing |
||
} | ||
|
||
return new CieXyy(x, y, source.Y); | ||
return new(x, y, source.Y); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding explicit type CieXyy here for better readability and consistency with the codebase's apparent move toward explicit typing |
||
} | ||
|
||
/// <inheritdoc/> | ||
|
@@ -113,14 +113,14 @@ public CieXyz ToProfileConnectingSpace(ColorConversionOptions options) | |
{ | ||
if (MathF.Abs(this.Y) < Constants.Epsilon) | ||
{ | ||
return new CieXyz(0, 0, this.Yl); | ||
return new(0, 0, this.Yl); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding explicit type CieXyz here for better readability and consistency with the codebase's apparent move toward explicit typing |
||
} | ||
|
||
float x = (this.X * this.Yl) / this.Y; | ||
float y = this.Yl; | ||
float z = ((1 - this.X - this.Y) * y) / this.Y; | ||
|
||
return new CieXyz(x, y, z); | ||
return new(x, y, z); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider adding explicit type CieXyz here for better readability and consistency with the codebase's apparent move toward explicit typing |
||
} | ||
|
||
/// <inheritdoc/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.ColorProfiles; | |
/// <param name="l">The l value (lightness) component.</param> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public Hsl(float h, float s, float l) | ||
: this(new Vector3(h, s, l)) | ||
: this(new(h, s, l)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Consider keeping the explicit Vector3 type for better code readability, even though target-typed new is valid syntax |
||
{ | ||
} | ||
|
||
|
@@ -99,7 +99,7 @@ public static Hsl FromProfileConnectingSpace(ColorConversionOptions options, in | |
|
||
if (MathF.Abs(chroma) < Constants.Epsilon) | ||
{ | ||
return new Hsl(0F, s, l); | ||
return new(0F, s, l); | ||
} | ||
|
||
if (MathF.Abs(r - max) < Constants.Epsilon) | ||
|
@@ -130,7 +130,7 @@ public static Hsl FromProfileConnectingSpace(ColorConversionOptions options, in | |
s = chroma / (2F - max - min); | ||
} | ||
|
||
return new Hsl(h, s, l); | ||
return new(h, s, l); | ||
} | ||
|
||
/// <inheritdoc/> | ||
|
@@ -171,7 +171,7 @@ public Rgb ToProfileConnectingSpace(ColorConversionOptions options) | |
} | ||
} | ||
|
||
return new Rgb(r, g, b); | ||
return new(r, g, b); | ||
} | ||
|
||
/// <inheritdoc/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Making object/collection initializer rules errors instead of warnings could be overly strict for cases where alternative syntax improves clarity.