Update code analyzers and fix new warnings

New (latest) versions:
Microsoft.CodeAnalysis.NetAnalyzers 8.0.0-preview1.23165.1
StyleCop.Analyzers 1.2.0-beta.507
This commit is contained in:
Peter Kirmeier 2023-08-13 02:46:13 +02:00
parent da4ec8bec4
commit 0eef578377
6 changed files with 17 additions and 18 deletions

8
.stylecop.json Normal file
View file

@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"orderingRules": {
"usingDirectivesPlacement": "insideNamespace"
}
}
}

View file

@ -52,8 +52,9 @@ namespace SystemTrayMenu
{
Settings.Default.PathIcoDirectory = System.IO.Path.Combine(
System.IO.Path.Combine(
Environment.GetFolderPath(
Environment.SpecialFolder.ApplicationData), $"SystemTrayMenu"), "ico");
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
$"SystemTrayMenu"),
"ico");
if (!Directory.Exists(Settings.Default.PathIcoDirectory))
{
Directory.CreateDirectory(Settings.Default.PathIcoDirectory);

View file

@ -61,7 +61,7 @@ namespace SystemTrayMenu.Helpers
// Only this ensures caller and registrator are talking about the SAME registration.
internal static IHotkeyFunction? GetLastCreatedHotkeyFunction() => lastCreatedHotkeyFunction;
internal static (ModifierKeys, Key) ModifiersAndKeyFromInvariantString(string hotKeyString)
internal static (ModifierKeys Modifiers, Key Key) ModifiersAndKeyFromInvariantString(string hotKeyString)
{
if (string.IsNullOrEmpty(hotKeyString))
{

View file

@ -104,19 +104,8 @@
<Optimize>True</Optimize>
<NoWarn>1701;1702;WFAC010;MSB3061</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Remove="UserInterface\HotkeyTextboxControl\**" />
<EmbeddedResource Remove="UserInterface\HotkeyTextboxControl\**" />
<None Remove="UserInterface\HotkeyTextboxControl\**" />
<Page Remove="UserInterface\HotkeyTextboxControl\**" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="UserInterface\Menu.resx" />
</ItemGroup>
<ItemGroup>
<Page Remove="Business\App.xaml" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="Business\App.xaml" />
</ItemGroup>
<ItemGroup>
@ -124,6 +113,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>ThirdParty\Clearcove.Logging.dll</HintPath>
</Reference>
<AdditionalFiles Include=".stylecop.json" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
@ -167,12 +157,12 @@
<ItemGroup>
<PackageReference Include="H.NotifyIcon" Version="2.0.115" />
<PackageReference Include="HidSharp" Version="2.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.3">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview1.23165.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="PixiEditor.ColorPicker" Version="3.3.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View file

@ -69,7 +69,7 @@ namespace SystemTrayMenu.UserInterface
private string? strParentFolder;
public ShellContextMenu()
: base(new())
: base(default)
{
hook = new HwndSourceHook(WndProc);
AddHook(hook);

View file

@ -56,7 +56,7 @@ namespace SystemTrayMenu.Utilities
internal static Point GetRelativeChildPositionTo(this Visual parent, Visual? child)
{
return child == null ? new() : child.TransformToAncestor(parent).Transform(new ());
return child == null ? default : child.TransformToAncestor(parent).Transform(default);
}
}
}