Fixing dotnet format on all the code

This commit is contained in:
Zoe Roux 2022-03-27 23:53:20 +02:00
parent 34b06bd2fb
commit 0f06033b42
No known key found for this signature in database
GPG Key ID: 6AA5AE82CCC0D9DD
22 changed files with 65 additions and 49 deletions

View File

@ -14,6 +14,12 @@ indent_style = space
indent_size = 2 indent_size = 2
[*.cs] [*.cs]
csharp_prefer_braces = false
dotnet_diagnostic.IDE0130.severity = none
dotnet_diagnostic.IDE0058.severity = none
dotnet_diagnostic.IDE0046.severity = none
dotnet_diagnostic.CA1848.severity = none
dotnet_diagnostic.CA2007.severity = none
# Sort using and Import directives with System.* appearing first # Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true dotnet_sort_system_directives_first = true
csharp_using_directive_placement = outside_namespace:warning csharp_using_directive_placement = outside_namespace:warning

View File

@ -28,10 +28,6 @@
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX> <IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
<IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux> <IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux>
<!-- TODO the next thing does not work on rider, enabling coding style check by default. -->
<!--<CheckCodingStyle Condition="$(BuildingInsideVisualStudio) == true">true</CheckCodingStyle>-->
<!--<CheckCodingStyle Condition="$(BuildingInsideReSharper) == true">true</CheckCodingStyle>-->
<CheckCodingStyle Condition="$(CheckCodingStyle) == ''">true</CheckCodingStyle> <CheckCodingStyle Condition="$(CheckCodingStyle) == ''">true</CheckCodingStyle>
</PropertyGroup> </PropertyGroup>
@ -48,8 +44,7 @@
</ItemGroup> </ItemGroup>
<PropertyGroup Condition="$(CheckCodingStyle) == true"> <PropertyGroup Condition="$(CheckCodingStyle) == true">
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)../Kyoo.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)../Kyoo.ruleset</CodeAnalysisRuleSet>
<!-- <AnalysisMode>AllEnabledByDefault</AnalysisMode>--> <!-- <AnalysisMode>All</AnalysisMode> -->
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.

View File

@ -34,7 +34,8 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; } public int ID { get; set; }
/// <inheritdoc /> /// <inheritdoc />
[Computed] public string Slug [Computed]
public string Slug
{ {
get get
{ {
@ -45,7 +46,9 @@ namespace Kyoo.Abstractions.Models
: null; : null;
} }
[UsedImplicitly] [NotNull] private set [UsedImplicitly]
[NotNull]
private set
{ {
if (value == null) if (value == null)
throw new ArgumentNullException(nameof(value)); throw new ArgumentNullException(nameof(value));

View File

@ -34,7 +34,8 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; } public int ID { get; set; }
/// <inheritdoc /> /// <inheritdoc />
[Computed] public string Slug [Computed]
public string Slug
{ {
get get
{ {
@ -43,7 +44,9 @@ namespace Kyoo.Abstractions.Models
return $"{ShowSlug ?? Show?.Slug}-s{SeasonNumber}"; return $"{ShowSlug ?? Show?.Slug}-s{SeasonNumber}";
} }
[UsedImplicitly] [NotNull] private set [UsedImplicitly]
[NotNull]
private set
{ {
Match match = Regex.Match(value ?? string.Empty, @"(?<show>.+)-s(?<season>\d+)"); Match match = Regex.Match(value ?? string.Empty, @"(?<show>.+)-s(?<season>\d+)");

View File

@ -67,7 +67,8 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; } public int ID { get; set; }
/// <inheritdoc /> /// <inheritdoc />
[Computed] public string Slug [Computed]
public string Slug
{ {
get get
{ {
@ -77,7 +78,8 @@ namespace Kyoo.Abstractions.Models
return $"{episode}.{Language ?? "und"}{index}{(IsForced ? ".forced" : string.Empty)}.{type}"; return $"{episode}.{Language ?? "und"}{index}{(IsForced ? ".forced" : string.Empty)}.{type}";
} }
[UsedImplicitly] private set [UsedImplicitly]
private set
{ {
if (value == null) if (value == null)
throw new ArgumentNullException(nameof(value)); throw new ArgumentNullException(nameof(value));
@ -86,8 +88,10 @@ namespace Kyoo.Abstractions.Models
if (!match.Success) if (!match.Success)
{ {
throw new ArgumentException("Invalid track slug. " + throw new ArgumentException(
"Format: {episodeSlug}.{language}[-{index}][.forced].{type}[.{extension}]"); "Invalid track slug. " +
"Format: {episodeSlug}.{language}[-{index}][.forced].{type}[.{extension}]"
);
} }
_episodeSlug = match.Groups["ep"].Value; _episodeSlug = match.Groups["ep"].Value;
@ -148,7 +152,8 @@ namespace Kyoo.Abstractions.Models
/// <summary> /// <summary>
/// The episode that uses this track. /// The episode that uses this track.
/// </summary> /// </summary>
[LoadableRelation(nameof(EpisodeID))] public Episode Episode [LoadableRelation(nameof(EpisodeID))]
public Episode Episode
{ {
get => _episode; get => _episode;
set set

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.

View File

@ -43,8 +43,8 @@ namespace Kyoo.Utils
{ {
if (ex == null) if (ex == null)
return false; return false;
return ex.Body is MemberExpression || return ex.Body is MemberExpression
(ex.Body.NodeType == ExpressionType.Convert && ((UnaryExpression)ex.Body).Operand is MemberExpression); || (ex.Body.NodeType == ExpressionType.Convert && ((UnaryExpression)ex.Body).Operand is MemberExpression);
} }
/// <summary> /// <summary>
@ -242,9 +242,12 @@ namespace Kyoo.Utils
.Where(x => x.Name == name) .Where(x => x.Name == name)
.Where(x => x.GetGenericArguments().Length == generics.Length) .Where(x => x.GetGenericArguments().Length == generics.Length)
.Where(x => x.GetParameters().Length == args.Length) .Where(x => x.GetParameters().Length == args.Length)
.IfEmpty(() => throw new ArgumentException($"A method named {name} with " + .IfEmpty(() =>
{
throw new ArgumentException($"A method named {name} with " +
$"{args.Length} arguments and {generics.Length} generic " + $"{args.Length} arguments and {generics.Length} generic " +
$"types could not be found on {type.Name}.")) $"types could not be found on {type.Name}.");
})
// TODO this won't work but I don't know why. // TODO this won't work but I don't know why.
// .Where(x => // .Where(x =>
// { // {

View File

@ -260,7 +260,7 @@ namespace Kyoo.Core.Controllers
_logger = logger; _logger = logger;
} }
// We use threads so tasks are not always awaited. // We use threads so tasks are not always awaited.
#pragma warning disable 4014 #pragma warning disable 4014
/// <inheritdoc /> /// <inheritdoc />

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.

View File

@ -184,7 +184,8 @@ namespace Kyoo.SqLite
/// <inheritdoc /> /// <inheritdoc />
protected override bool IsDuplicateException(Exception ex) protected override bool IsDuplicateException(Exception ex)
{ {
return ex.InnerException is SqliteException { SqliteExtendedErrorCode: 2067 /* SQLITE_CONSTRAINT_UNIQUE */ } return ex.InnerException
is SqliteException { SqliteExtendedErrorCode: 2067 /* SQLITE_CONSTRAINT_UNIQUE */ }
or SqliteException { SqliteExtendedErrorCode: 1555 /* SQLITE_CONSTRAINT_PRIMARYKEY */ }; or SqliteException { SqliteExtendedErrorCode: 1555 /* SQLITE_CONSTRAINT_PRIMARYKEY */ };
} }

View File

@ -1,4 +1,4 @@
// Kyoo - A portable and vast media library solution. // Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo. // Copyright (c) Kyoo.
// //
// See AUTHORS.md and LICENSE file in the project root for full license information. // See AUTHORS.md and LICENSE file in the project root for full license information.