mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing dotnet format on all the code
This commit is contained in:
parent
34b06bd2fb
commit
0f06033b42
@ -14,6 +14,12 @@ indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.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
|
||||
dotnet_sort_system_directives_first = true
|
||||
csharp_using_directive_placement = outside_namespace:warning
|
||||
|
@ -28,10 +28,6 @@
|
||||
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -48,8 +44,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="$(CheckCodingStyle) == true">
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)../Kyoo.ruleset</CodeAnalysisRuleSet>
|
||||
<!-- <AnalysisMode>AllEnabledByDefault</AnalysisMode>-->
|
||||
<!-- <AnalysisMode>All</AnalysisMode> -->
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -34,7 +34,8 @@ namespace Kyoo.Abstractions.Models
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Computed] public string Slug
|
||||
[Computed]
|
||||
public string Slug
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -45,7 +46,9 @@ namespace Kyoo.Abstractions.Models
|
||||
: null;
|
||||
}
|
||||
|
||||
[UsedImplicitly] [NotNull] private set
|
||||
[UsedImplicitly]
|
||||
[NotNull]
|
||||
private set
|
||||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
|
@ -34,7 +34,8 @@ namespace Kyoo.Abstractions.Models
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Computed] public string Slug
|
||||
[Computed]
|
||||
public string Slug
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -43,7 +44,9 @@ namespace Kyoo.Abstractions.Models
|
||||
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+)");
|
||||
|
||||
|
@ -67,7 +67,8 @@ namespace Kyoo.Abstractions.Models
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[Computed] public string Slug
|
||||
[Computed]
|
||||
public string Slug
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -77,7 +78,8 @@ namespace Kyoo.Abstractions.Models
|
||||
return $"{episode}.{Language ?? "und"}{index}{(IsForced ? ".forced" : string.Empty)}.{type}";
|
||||
}
|
||||
|
||||
[UsedImplicitly] private set
|
||||
[UsedImplicitly]
|
||||
private set
|
||||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
@ -86,8 +88,10 @@ namespace Kyoo.Abstractions.Models
|
||||
|
||||
if (!match.Success)
|
||||
{
|
||||
throw new ArgumentException("Invalid track slug. " +
|
||||
"Format: {episodeSlug}.{language}[-{index}][.forced].{type}[.{extension}]");
|
||||
throw new ArgumentException(
|
||||
"Invalid track slug. " +
|
||||
"Format: {episodeSlug}.{language}[-{index}][.forced].{type}[.{extension}]"
|
||||
);
|
||||
}
|
||||
|
||||
_episodeSlug = match.Groups["ep"].Value;
|
||||
@ -148,7 +152,8 @@ namespace Kyoo.Abstractions.Models
|
||||
/// <summary>
|
||||
/// The episode that uses this track.
|
||||
/// </summary>
|
||||
[LoadableRelation(nameof(EpisodeID))] public Episode Episode
|
||||
[LoadableRelation(nameof(EpisodeID))]
|
||||
public Episode Episode
|
||||
{
|
||||
get => _episode;
|
||||
set
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -170,7 +170,7 @@ namespace Kyoo.Utils
|
||||
Type type = typeof(T);
|
||||
IEnumerable<PropertyInfo> properties = type.GetProperties()
|
||||
.Where(x => x.CanRead && x.CanWrite
|
||||
&& Attribute.GetCustomAttribute(x, typeof(NotMergeableAttribute)) == null);
|
||||
&& Attribute.GetCustomAttribute(x, typeof(NotMergeableAttribute)) == null);
|
||||
|
||||
foreach (PropertyInfo property in properties)
|
||||
{
|
||||
@ -221,7 +221,7 @@ namespace Kyoo.Utils
|
||||
Type type = typeof(T);
|
||||
IEnumerable<PropertyInfo> properties = type.GetProperties()
|
||||
.Where(x => x.CanRead && x.CanWrite
|
||||
&& Attribute.GetCustomAttribute(x, typeof(NotMergeableAttribute)) == null);
|
||||
&& Attribute.GetCustomAttribute(x, typeof(NotMergeableAttribute)) == null);
|
||||
|
||||
if (where != null)
|
||||
properties = properties.Where(where);
|
||||
@ -293,7 +293,7 @@ namespace Kyoo.Utils
|
||||
Type type = typeof(T);
|
||||
IEnumerable<PropertyInfo> properties = type.GetProperties()
|
||||
.Where(x => x.CanRead && x.CanWrite
|
||||
&& Attribute.GetCustomAttribute(x, typeof(NotMergeableAttribute)) == null);
|
||||
&& Attribute.GetCustomAttribute(x, typeof(NotMergeableAttribute)) == null);
|
||||
|
||||
if (where != null)
|
||||
properties = properties.Where(where);
|
||||
@ -325,7 +325,7 @@ namespace Kyoo.Utils
|
||||
property.SetValue(first, newDictionary);
|
||||
}
|
||||
else if (typeof(IEnumerable).IsAssignableFrom(property.PropertyType)
|
||||
&& property.PropertyType != typeof(string))
|
||||
&& property.PropertyType != typeof(string))
|
||||
{
|
||||
Type enumerableType = Utility.GetGenericDefinition(property.PropertyType, typeof(IEnumerable<>))
|
||||
.GenericTypeArguments
|
||||
|
@ -43,8 +43,8 @@ namespace Kyoo.Utils
|
||||
{
|
||||
if (ex == null)
|
||||
return false;
|
||||
return ex.Body is MemberExpression ||
|
||||
(ex.Body.NodeType == ExpressionType.Convert && ((UnaryExpression)ex.Body).Operand is MemberExpression);
|
||||
return ex.Body is MemberExpression
|
||||
|| (ex.Body.NodeType == ExpressionType.Convert && ((UnaryExpression)ex.Body).Operand is MemberExpression);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -242,9 +242,12 @@ namespace Kyoo.Utils
|
||||
.Where(x => x.Name == name)
|
||||
.Where(x => x.GetGenericArguments().Length == generics.Length)
|
||||
.Where(x => x.GetParameters().Length == args.Length)
|
||||
.IfEmpty(() => throw new ArgumentException($"A method named {name} with " +
|
||||
$"{args.Length} arguments and {generics.Length} generic " +
|
||||
$"types could not be found on {type.Name}."))
|
||||
.IfEmpty(() =>
|
||||
{
|
||||
throw new ArgumentException($"A method named {name} with " +
|
||||
$"{args.Length} arguments and {generics.Length} generic " +
|
||||
$"types could not be found on {type.Name}.");
|
||||
})
|
||||
// TODO this won't work but I don't know why.
|
||||
// .Where(x =>
|
||||
// {
|
||||
|
@ -154,12 +154,12 @@ namespace Kyoo.Authentication
|
||||
return;
|
||||
default:
|
||||
throw new ArgumentException("Multiple non-matching partial permission attribute " +
|
||||
"are not supported.");
|
||||
"are not supported.");
|
||||
}
|
||||
if (permission == null || kind == null)
|
||||
{
|
||||
throw new ArgumentException("The permission type or kind is still missing after two partial " +
|
||||
"permission attributes, this is unsupported.");
|
||||
"permission attributes, this is unsupported.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ namespace Kyoo.Core.Controllers
|
||||
if (typeof(T).IsAssignableFrom(type))
|
||||
{
|
||||
throw new InvalidCastException($"The type {typeof(T).Name} is not valid for " +
|
||||
$"a resource of type {type.Name}.");
|
||||
$"a resource of type {type.Name}.");
|
||||
}
|
||||
return (T)GetValue(path);
|
||||
}
|
||||
|
@ -73,16 +73,16 @@ namespace Kyoo.Core.Controllers
|
||||
public Task<Episode> GetOrDefault(int showID, int seasonNumber, int episodeNumber)
|
||||
{
|
||||
return _database.Episodes.FirstOrDefaultAsync(x => x.ShowID == showID
|
||||
&& x.SeasonNumber == seasonNumber
|
||||
&& x.EpisodeNumber == episodeNumber);
|
||||
&& x.SeasonNumber == seasonNumber
|
||||
&& x.EpisodeNumber == episodeNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<Episode> GetOrDefault(string showSlug, int seasonNumber, int episodeNumber)
|
||||
{
|
||||
return _database.Episodes.FirstOrDefaultAsync(x => x.Show.Slug == showSlug
|
||||
&& x.SeasonNumber == seasonNumber
|
||||
&& x.EpisodeNumber == episodeNumber);
|
||||
&& x.SeasonNumber == seasonNumber
|
||||
&& x.EpisodeNumber == episodeNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -107,14 +107,14 @@ namespace Kyoo.Core.Controllers
|
||||
public Task<Episode> GetAbsolute(int showID, int absoluteNumber)
|
||||
{
|
||||
return _database.Episodes.FirstOrDefaultAsync(x => x.ShowID == showID
|
||||
&& x.AbsoluteNumber == absoluteNumber);
|
||||
&& x.AbsoluteNumber == absoluteNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task<Episode> GetAbsolute(string showSlug, int absoluteNumber)
|
||||
{
|
||||
return _database.Episodes.FirstOrDefaultAsync(x => x.Show.Slug == showSlug
|
||||
&& x.AbsoluteNumber == absoluteNumber);
|
||||
&& x.AbsoluteNumber == absoluteNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -82,14 +82,14 @@ namespace Kyoo.Core.Controllers
|
||||
public Task<Season> GetOrDefault(int showID, int seasonNumber)
|
||||
{
|
||||
return _database.Seasons.FirstOrDefaultAsync(x => x.ShowID == showID
|
||||
&& x.SeasonNumber == seasonNumber);
|
||||
&& x.SeasonNumber == seasonNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Task<Season> GetOrDefault(string showSlug, int seasonNumber)
|
||||
{
|
||||
return _database.Seasons.FirstOrDefaultAsync(x => x.Show.Slug == showSlug
|
||||
&& x.SeasonNumber == seasonNumber);
|
||||
&& x.SeasonNumber == seasonNumber);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
@ -260,7 +260,7 @@ namespace Kyoo.Core.Controllers
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
// We use threads so tasks are not always awaited.
|
||||
// We use threads so tasks are not always awaited.
|
||||
#pragma warning disable 4014
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -184,8 +184,9 @@ namespace Kyoo.SqLite
|
||||
/// <inheritdoc />
|
||||
protected override bool IsDuplicateException(Exception ex)
|
||||
{
|
||||
return ex.InnerException is SqliteException { SqliteExtendedErrorCode: 2067 /* SQLITE_CONSTRAINT_UNIQUE */ }
|
||||
or SqliteException { SqliteExtendedErrorCode: 1555 /* SQLITE_CONSTRAINT_PRIMARYKEY */ };
|
||||
return ex.InnerException
|
||||
is SqliteException { SqliteExtendedErrorCode: 2067 /* SQLITE_CONSTRAINT_UNIQUE */ }
|
||||
or SqliteException { SqliteExtendedErrorCode: 1555 /* SQLITE_CONSTRAINT_PRIMARYKEY */ };
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Kyoo - A portable and vast media library solution.
|
||||
// Copyright (c) Kyoo.
|
||||
//
|
||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
|
||||
|
@ -180,8 +180,8 @@ namespace Kyoo.Tests
|
||||
"We Still Don't Know the Name of the Flower We Saw That Day."
|
||||
},
|
||||
Overview = "When Yadomi Jinta was a child, he was a central piece in a group of close friends. " +
|
||||
"In time, however, these childhood friends drifted apart, and when they became high " +
|
||||
"school students, they had long ceased to think of each other as friends.",
|
||||
"In time, however, these childhood friends drifted apart, and when they became high " +
|
||||
"school students, they had long ceased to think of each other as friends.",
|
||||
Status = Status.Finished,
|
||||
StudioID = 1,
|
||||
StartAir = new DateTime(2011, 1, 1),
|
||||
@ -243,7 +243,7 @@ namespace Kyoo.Tests
|
||||
typeof(Track),
|
||||
() =>
|
||||
{
|
||||
Track ret = new()
|
||||
Track ret = new()
|
||||
{
|
||||
ID = 1,
|
||||
EpisodeID = 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user