[Analyzers] Update StyleCop and enable SA1200 (#22707)

* update StyleCop and enable SA1200

* Fix merge issues

* fix build and added using rule
This commit is contained in:
Davide Giacometti
2022-12-18 14:27:14 +01:00
committed by GitHub
parent 617150cf50
commit 6d138e80fb
55 changed files with 338 additions and 371 deletions

View File

@@ -2,12 +2,12 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using PowerToys.PowerAccentKeyboardService;
using Windows.Globalization;
namespace PowerAccent.Core
{
using System;
using PowerToys.PowerAccentKeyboardService;
using Windows.Globalization;
public enum Language
{
ALL,

View File

@@ -100,7 +100,8 @@ public class PowerAccent : IDisposable
{
OnChangeDisplay?.Invoke(true, _characters);
}
}, TaskScheduler.FromCurrentSynchronizationContext());
},
TaskScheduler.FromCurrentSynchronizationContext());
}
private string GetCharacterDescription(string character)

View File

@@ -2,16 +2,14 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace PowerAccent.Core.Services;
using System.IO.Abstractions;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using PowerToys.PowerAccentKeyboardService;
using System.IO.Abstractions;
using System.Text.Json;
using static Vanara.PInvoke.LANGID;
namespace PowerAccent.Core.Services;
public class SettingsService
{
private const string PowerAccentModuleName = "QuickAccent";

View File

@@ -41,7 +41,7 @@ internal static class WindowsFunctions
public static Point GetCaretPosition()
{
User32.GUITHREADINFO guiInfo = new ();
User32.GUITHREADINFO guiInfo = default;
guiInfo.cbSize = (uint)Marshal.SizeOf(guiInfo);
User32.GetGUIThreadInfo(0, ref guiInfo);
POINT caretPosition = new POINT(guiInfo.rcCaret.left, guiInfo.rcCaret.top);
@@ -59,12 +59,12 @@ internal static class WindowsFunctions
public static (Point Location, Size Size, double Dpi) GetActiveDisplay()
{
User32.GUITHREADINFO guiInfo = new ();
User32.GUITHREADINFO guiInfo = default;
guiInfo.cbSize = (uint)Marshal.SizeOf(guiInfo);
User32.GetGUIThreadInfo(0, ref guiInfo);
var res = User32.MonitorFromWindow(guiInfo.hwndActive, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
User32.MONITORINFO monitorInfo = new ();
User32.MONITORINFO monitorInfo = default;
monitorInfo.cbSize = (uint)Marshal.SizeOf(monitorInfo);
User32.GetMonitorInfo(res, ref monitorInfo);

View File

@@ -47,7 +47,8 @@ internal static class Program
{
Terminate();
}
}, _tokenSource.Token);
},
_tokenSource.Token);
}
private static void Arguments(string[] args)

View File

@@ -13,7 +13,7 @@ namespace PowerAccent.UI;
public partial class Selector : Window, IDisposable, INotifyPropertyChanged
{
private readonly Core.PowerAccent _powerAccent = new ();
private readonly Core.PowerAccent _powerAccent = new();
private Visibility _characterNameVisibility = Visibility.Visible;
@@ -84,7 +84,7 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
private void SetWindowPosition()
{
Size windowSize = new (((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualWidth, ((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualHeight);
Size windowSize = new(((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualWidth, ((System.Windows.Controls.Panel)Application.Current.MainWindow.Content).ActualHeight);
Point position = _powerAccent.GetDisplayCoordinates(windowSize);
this.Left = position.X;
this.Top = position.Y;
@@ -97,7 +97,7 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
Position.Left or Position.TopLeft or Position.BottomLeft => HorizontalAlignment.Left,
Position.Right or Position.TopRight or Position.BottomRight => HorizontalAlignment.Right,
Position.Center or Position.Top or Position.Bottom => HorizontalAlignment.Center,
_ => HorizontalAlignment.Center
_ => HorizontalAlignment.Center,
};
}