CodingStyle: Fixing windows's host warnings

This commit is contained in:
Zoe Roux 2021-09-05 21:36:34 +02:00
parent aef5ce59cb
commit c84baf67a6
8 changed files with 18 additions and 14 deletions

View File

@ -15,7 +15,7 @@
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>CS1591;SA1601</NoWarn>
<NoWarn>CS1591;SA1600;SA1601</NoWarn>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Kyoo.ruleset</CodeAnalysisRuleSet>
<!-- <AnalysisMode>AllEnabledByDefault</AnalysisMode>-->

View File

@ -24,7 +24,7 @@ namespace Kyoo.Core.Controllers
/// <summary>
/// The Entity Framework's Database handle.
/// </summary>
protected readonly DbContext Database;
protected DbContext Database { get; }
/// <summary>
/// The default sort order that will be used for this resource's type.

View File

@ -16,7 +16,8 @@ namespace Kyoo.Core.Api
where T : class, IResource
{
private readonly IRepository<T> _repository;
protected readonly Uri BaseURL;
protected Uri BaseURL { get; }
public CrudApi(IRepository<T> repository, Uri baseURL)
{

View File

@ -1,8 +1,4 @@
<Project ToolsVersion="Current">
<PropertyGroup>
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup Condition="$(IsWindows) == true">

View File

@ -20,6 +20,8 @@ namespace Kyoo.Host.WindowsTrait
/// It adds a system trait for windows and since the host is build as a windows executable instead of a console
/// app, the console is not showed.
/// </summary>
/// <param name="args">Command line arguments</param>
/// <returns>A <see cref="Task"/> representing the lifetime of the program.</returns>
public static Task Main(string[] args)
{
Application application = new(Environment);

View File

@ -55,7 +55,7 @@ namespace Kyoo.Host.WindowsTrait
/// <inheritdoc />
public void Dispose()
{
System.Windows.Forms.Application.Exit();
Application.Exit();
_thread?.Join();
_thread = null;
}
@ -92,7 +92,7 @@ namespace Kyoo.Host.WindowsTrait
_options = options;
AppDomain.CurrentDomain.ProcessExit += (_, _) => Dispose();
System.Windows.Forms.Application.ApplicationExit += (_, _) => Dispose();
Application.ApplicationExit += (_, _) => Dispose();
_icon = new NotifyIcon
{
@ -125,7 +125,7 @@ namespace Kyoo.Host.WindowsTrait
public static void Run(IApplication application, IOptions<BasicOptions> options)
{
using InternalSystemTrait trait = new(application, options);
System.Windows.Forms.Application.Run(trait);
Application.Run(trait);
}
/// <inheritdoc />

View File

@ -41,6 +41,5 @@
<Rule Id="SA1633" Action="None" /> <!-- FileMustHaveHeader TODO remove this, this is only temporary -->
<Rule Id="SA1629" Action="None" /> <!-- DocumentationTextMustEndWithAPeriod TODO remove this, this is only temporary -->
<Rule Id="SA1600" Action="None" /> <!-- ElementsMustBeDocumented TODO remove this, this is only temporary -->
</Rules>
</RuleSet>

View File

@ -1,6 +1,12 @@
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
"documentationRules": {
"copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} license. See {licenseFile} file in the project root for full license information.",
"variables": {
"licenseName": "GPL-3.0",
"licenseFile": "LICENSE"
}
}
}
}