diff --git a/.editorconfig b/.editorconfig
index 7b812979..db19b724 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -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
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 823f045a..31fdbf88 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -28,10 +28,6 @@
true
true
-
-
-
-
true
@@ -48,8 +44,7 @@
- true
$(MSBuildThisFileDirectory)../Kyoo.ruleset
-
+
diff --git a/src/Kyoo.Abstractions/Models/Attributes/EditableRelationAttribute.cs b/src/Kyoo.Abstractions/Models/Attributes/EditableRelationAttribute.cs
index 5b78b3f8..a94f401b 100644
--- a/src/Kyoo.Abstractions/Models/Attributes/EditableRelationAttribute.cs
+++ b/src/Kyoo.Abstractions/Models/Attributes/EditableRelationAttribute.cs
@@ -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.
diff --git a/src/Kyoo.Abstractions/Models/Attributes/Serializer/DeserializeIgnoreAttribute.cs b/src/Kyoo.Abstractions/Models/Attributes/Serializer/DeserializeIgnoreAttribute.cs
index e1ab8bcc..8b10ee87 100644
--- a/src/Kyoo.Abstractions/Models/Attributes/Serializer/DeserializeIgnoreAttribute.cs
+++ b/src/Kyoo.Abstractions/Models/Attributes/Serializer/DeserializeIgnoreAttribute.cs
@@ -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.
diff --git a/src/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeIgnoreAttribute.cs b/src/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeIgnoreAttribute.cs
index 9fc37750..4a87d3f9 100644
--- a/src/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeIgnoreAttribute.cs
+++ b/src/Kyoo.Abstractions/Models/Attributes/Serializer/SerializeIgnoreAttribute.cs
@@ -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.
diff --git a/src/Kyoo.Abstractions/Models/Resources/Episode.cs b/src/Kyoo.Abstractions/Models/Resources/Episode.cs
index 42e9ecee..10d5f5b6 100644
--- a/src/Kyoo.Abstractions/Models/Resources/Episode.cs
+++ b/src/Kyoo.Abstractions/Models/Resources/Episode.cs
@@ -34,7 +34,8 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; }
///
- [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));
diff --git a/src/Kyoo.Abstractions/Models/Resources/Season.cs b/src/Kyoo.Abstractions/Models/Resources/Season.cs
index 29d22d44..f07055e8 100644
--- a/src/Kyoo.Abstractions/Models/Resources/Season.cs
+++ b/src/Kyoo.Abstractions/Models/Resources/Season.cs
@@ -34,7 +34,8 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; }
///
- [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, @"(?.+)-s(?\d+)");
diff --git a/src/Kyoo.Abstractions/Models/Resources/Track.cs b/src/Kyoo.Abstractions/Models/Resources/Track.cs
index 8e41c7ee..4c86f9f8 100644
--- a/src/Kyoo.Abstractions/Models/Resources/Track.cs
+++ b/src/Kyoo.Abstractions/Models/Resources/Track.cs
@@ -67,7 +67,8 @@ namespace Kyoo.Abstractions.Models
public int ID { get; set; }
///
- [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
///
/// The episode that uses this track.
///
- [LoadableRelation(nameof(EpisodeID))] public Episode Episode
+ [LoadableRelation(nameof(EpisodeID))]
+ public Episode Episode
{
get => _episode;
set
diff --git a/src/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs b/src/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs
index 631c417f..66a11a3c 100644
--- a/src/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs
+++ b/src/Kyoo.Abstractions/Models/Resources/WatchedEpisode.cs
@@ -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.
diff --git a/src/Kyoo.Abstractions/Models/Utils/Pagination.cs b/src/Kyoo.Abstractions/Models/Utils/Pagination.cs
index e52bbf63..233b317d 100644
--- a/src/Kyoo.Abstractions/Models/Utils/Pagination.cs
+++ b/src/Kyoo.Abstractions/Models/Utils/Pagination.cs
@@ -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.
diff --git a/src/Kyoo.Abstractions/Models/Utils/Sort.cs b/src/Kyoo.Abstractions/Models/Utils/Sort.cs
index e68c8a8e..1aa88673 100644
--- a/src/Kyoo.Abstractions/Models/Utils/Sort.cs
+++ b/src/Kyoo.Abstractions/Models/Utils/Sort.cs
@@ -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.
diff --git a/src/Kyoo.Abstractions/Utility/Merger.cs b/src/Kyoo.Abstractions/Utility/Merger.cs
index f8bb8286..237eff06 100644
--- a/src/Kyoo.Abstractions/Utility/Merger.cs
+++ b/src/Kyoo.Abstractions/Utility/Merger.cs
@@ -170,7 +170,7 @@ namespace Kyoo.Utils
Type type = typeof(T);
IEnumerable 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 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 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
diff --git a/src/Kyoo.Abstractions/Utility/Utility.cs b/src/Kyoo.Abstractions/Utility/Utility.cs
index 04a1f948..bce40f4e 100644
--- a/src/Kyoo.Abstractions/Utility/Utility.cs
+++ b/src/Kyoo.Abstractions/Utility/Utility.cs
@@ -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);
}
///
@@ -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 =>
// {
diff --git a/src/Kyoo.Authentication/Controllers/PermissionValidator.cs b/src/Kyoo.Authentication/Controllers/PermissionValidator.cs
index 490c7649..4af4d963 100644
--- a/src/Kyoo.Authentication/Controllers/PermissionValidator.cs
+++ b/src/Kyoo.Authentication/Controllers/PermissionValidator.cs
@@ -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.");
}
}
diff --git a/src/Kyoo.Core/Controllers/ConfigurationManager.cs b/src/Kyoo.Core/Controllers/ConfigurationManager.cs
index 10e0843b..ba3372ad 100644
--- a/src/Kyoo.Core/Controllers/ConfigurationManager.cs
+++ b/src/Kyoo.Core/Controllers/ConfigurationManager.cs
@@ -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);
}
diff --git a/src/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs b/src/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs
index d54d251f..4a139a33 100644
--- a/src/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs
+++ b/src/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs
@@ -73,16 +73,16 @@ namespace Kyoo.Core.Controllers
public Task 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);
}
///
public Task 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);
}
///
@@ -107,14 +107,14 @@ namespace Kyoo.Core.Controllers
public Task GetAbsolute(int showID, int absoluteNumber)
{
return _database.Episodes.FirstOrDefaultAsync(x => x.ShowID == showID
- && x.AbsoluteNumber == absoluteNumber);
+ && x.AbsoluteNumber == absoluteNumber);
}
///
public Task GetAbsolute(string showSlug, int absoluteNumber)
{
return _database.Episodes.FirstOrDefaultAsync(x => x.Show.Slug == showSlug
- && x.AbsoluteNumber == absoluteNumber);
+ && x.AbsoluteNumber == absoluteNumber);
}
///
diff --git a/src/Kyoo.Core/Controllers/Repositories/SeasonRepository.cs b/src/Kyoo.Core/Controllers/Repositories/SeasonRepository.cs
index 3a85e98a..db36be70 100644
--- a/src/Kyoo.Core/Controllers/Repositories/SeasonRepository.cs
+++ b/src/Kyoo.Core/Controllers/Repositories/SeasonRepository.cs
@@ -82,14 +82,14 @@ namespace Kyoo.Core.Controllers
public Task GetOrDefault(int showID, int seasonNumber)
{
return _database.Seasons.FirstOrDefaultAsync(x => x.ShowID == showID
- && x.SeasonNumber == seasonNumber);
+ && x.SeasonNumber == seasonNumber);
}
///
public Task GetOrDefault(string showSlug, int seasonNumber)
{
return _database.Seasons.FirstOrDefaultAsync(x => x.Show.Slug == showSlug
- && x.SeasonNumber == seasonNumber);
+ && x.SeasonNumber == seasonNumber);
}
///
diff --git a/src/Kyoo.Core/Controllers/Transcoder.cs b/src/Kyoo.Core/Controllers/Transcoder.cs
index e23896d9..d3480669 100644
--- a/src/Kyoo.Core/Controllers/Transcoder.cs
+++ b/src/Kyoo.Core/Controllers/Transcoder.cs
@@ -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
///
diff --git a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs
index b1e58c1b..6ed67ac8 100644
--- a/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs
+++ b/src/Kyoo.Core/Views/Helper/Serializers/JsonSerializerContract.cs
@@ -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.
diff --git a/src/Kyoo.SqLite/SqLiteContext.cs b/src/Kyoo.SqLite/SqLiteContext.cs
index a19151bf..3a0cf6b9 100644
--- a/src/Kyoo.SqLite/SqLiteContext.cs
+++ b/src/Kyoo.SqLite/SqLiteContext.cs
@@ -184,8 +184,9 @@ namespace Kyoo.SqLite
///
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 */ };
}
///
diff --git a/src/Kyoo.Swagger/SwaggerModule.cs b/src/Kyoo.Swagger/SwaggerModule.cs
index d5b51e71..fafb1281 100644
--- a/src/Kyoo.Swagger/SwaggerModule.cs
+++ b/src/Kyoo.Swagger/SwaggerModule.cs
@@ -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.
diff --git a/tests/Kyoo.Tests/Database/TestSample.cs b/tests/Kyoo.Tests/Database/TestSample.cs
index a7327753..634c104a 100644
--- a/tests/Kyoo.Tests/Database/TestSample.cs
+++ b/tests/Kyoo.Tests/Database/TestSample.cs
@@ -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,