Browse Source

Merge pull request #9857 from workgroupengineering/features/NetAnalyzers/CA2211

feat: Enable Rule CA2211
pull/9879/head
Max Katz 4 years ago
committed by GitHub
parent
commit
228f26f0a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .editorconfig
  2. 4
      src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs
  3. 4
      src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatHalfColorPalette.cs
  4. 4
      src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialColorPalette.cs
  5. 4
      src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialHalfColorPalette.cs
  6. 2
      src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
  7. 2
      src/Avalonia.Controls.DataGrid/DataGridColumn.cs
  8. 2
      src/Avalonia.Controls/Diagnostics/ToolTipDiagnostics.cs

2
.editorconfig

@ -169,6 +169,8 @@ dotnet_diagnostic.CA1828.severity = warning
dotnet_diagnostic.CA1829.severity = warning
#CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1847.severity = warning
#CACA2211:Non-constant fields should not be visible
dotnet_diagnostic.CA2211.severity = error
# Wrapping preferences
csharp_wrap_before_ternary_opsigns = false

4
src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs

@ -289,8 +289,8 @@ namespace Avalonia.Controls
};
// See: https://htmlcolorcodes.com/assets/downloads/flat-design-colors/flat-design-color-chart.png
protected static Color[,]? _colorChart = null;
protected static object _colorChartMutex = new object();
private static Color[,]? _colorChart = null;
private static readonly object _colorChartMutex = new();
/// <summary>
/// Initializes all color chart colors.

4
src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatHalfColorPalette.cs

@ -10,8 +10,8 @@ namespace Avalonia.Controls
/// <inheritdoc cref="FlatColorPalette"/>
public class FlatHalfColorPalette : IColorPalette
{
protected static Color[,]? _colorChart = null;
protected static object _colorChartMutex = new object();
private static Color[,]? _colorChart = null;
private static readonly object _colorChartMutex = new();
/// <summary>
/// Initializes all color chart colors.

4
src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialColorPalette.cs

@ -344,8 +344,8 @@ namespace Avalonia.Controls
// See: https://material.io/design/color/the-color-system.html#tools-for-picking-colors
// This is a reduced palette for uniformity
protected static Color[,]? _colorChart = null;
protected static object _colorChartMutex = new object();
private static Color[,]? _colorChart = null;
private static readonly object _colorChartMutex = new();
/// <summary>
/// Initializes all color chart colors.

4
src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialHalfColorPalette.cs

@ -10,8 +10,8 @@ namespace Avalonia.Controls
/// <inheritdoc cref="MaterialColorPalette"/>
public class MaterialHalfColorPalette : IColorPalette
{
protected static Color[,]? _colorChart = null;
protected static object _colorChartMutex = new object();
private static Color[,]? _colorChart = null;
private static readonly object _colorChartMutex = new();
/// <summary>
/// Initializes all color chart colors.

2
src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs

@ -31,7 +31,7 @@ namespace Avalonia.Controls
/// <summary>
/// Defines the <see cref="IsThreeState"/> property.
/// </summary>
public static StyledProperty<bool> IsThreeStateProperty =
public static readonly StyledProperty<bool> IsThreeStateProperty =
CheckBox.IsThreeStateProperty.AddOwner<DataGridCheckBoxColumn>();
/// <summary>

2
src/Avalonia.Controls.DataGrid/DataGridColumn.cs

@ -185,7 +185,7 @@ namespace Avalonia.Controls
/// <summary>
/// Defines the <see cref="IsVisible"/> property.
/// </summary>
public static StyledProperty<bool> IsVisibleProperty =
public static readonly StyledProperty<bool> IsVisibleProperty =
Control.IsVisibleProperty.AddOwner<DataGridColumn>();
/// <summary>

2
src/Avalonia.Controls/Diagnostics/ToolTipDiagnostics.cs

@ -8,6 +8,6 @@
/// <summary>
/// Provides access to the internal <see cref="ToolTip.ToolTipProperty"/> for use in DevTools.
/// </summary>
public static AvaloniaProperty<ToolTip?> ToolTipProperty = ToolTip.ToolTipProperty;
public static readonly AvaloniaProperty<ToolTip?> ToolTipProperty = ToolTip.ToolTipProperty;
}
}

Loading…
Cancel
Save