diff --git a/Directory.Build.props b/Directory.Build.props index c109a6e1..a3e952ff 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -15,6 +15,7 @@ true + CS1591;SA1601 true $(MSBuildThisFileDirectory)Kyoo.ruleset diff --git a/Kyoo.Abstractions/Controllers/ILibraryManager.cs b/Kyoo.Abstractions/Controllers/ILibraryManager.cs index 8b63bdb9..bc3e2fa8 100644 --- a/Kyoo.Abstractions/Controllers/ILibraryManager.cs +++ b/Kyoo.Abstractions/Controllers/ILibraryManager.cs @@ -29,7 +29,7 @@ namespace Kyoo.Abstractions.Controllers ILibraryRepository LibraryRepository { get; } /// - /// The repository that handle libraries items (a wrapper around shows & collections). + /// The repository that handle libraries items (a wrapper around shows and collections). /// ILibraryItemRepository LibraryItemRepository { get; } @@ -236,7 +236,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The type of the source object /// The related resource's type - /// The param + /// The param /// /// /// @@ -254,7 +254,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The type of the source object /// The related resource's type - /// The param + /// The param /// /// /// @@ -271,7 +271,7 @@ namespace Kyoo.Abstractions.Controllers /// true if you want to load the relation even if it is not null, false otherwise. /// /// The type of the source object - /// The param + /// The param /// /// /// @@ -297,7 +297,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The ID of the library /// A filter function - /// Sort information (sort order & sort by) + /// Sort information (sort order and sort by) /// How many items to return and where to start /// A list of items that match every filters Task> GetItemsFromLibrary(int id, @@ -324,7 +324,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The slug of the library /// A filter function - /// Sort information (sort order & sort by) + /// Sort information (sort order and sort by) /// How many items to return and where to start /// A list of items that match every filters Task> GetItemsFromLibrary(string slug, @@ -351,7 +351,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The ID of the show /// A filter function - /// Sort information (sort order & sort by) + /// Sort information (sort order and sort by) /// How many items to return and where to start /// A list of items that match every filters Task> GetPeopleFromShow(int showID, @@ -378,7 +378,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The slug of the show /// A filter function - /// Sort information (sort order & sort by) + /// Sort information (sort order and sort by) /// How many items to return and where to start /// A list of items that match every filters Task> GetPeopleFromShow(string showSlug, @@ -405,7 +405,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The id of the person /// A filter function - /// Sort information (sort order & sort by) + /// Sort information (sort order and sort by) /// How many items to return and where to start /// A list of items that match every filters Task> GetRolesFromPeople(int id, @@ -432,7 +432,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The slug of the person /// A filter function - /// Sort information (sort order & sort by) + /// Sort information (sort order and sort by) /// How many items to return and where to start /// A list of items that match every filters Task> GetRolesFromPeople(string slug, @@ -476,7 +476,7 @@ namespace Kyoo.Abstractions.Controllers /// Get all resources with filters /// /// A filter function - /// Sort information (sort order & sort by) + /// Sort information (sort order and sort by) /// How many items to return and where to start /// The type of resources to load /// A list of resources that match every filters @@ -524,7 +524,7 @@ namespace Kyoo.Abstractions.Controllers /// /// The item to register /// The type of resource - /// The resource registers and completed by database's information (related items & so on) + /// The resource registers and completed by database's information (related items and so on) Task Create([NotNull] T item) where T : class, IResource; @@ -544,7 +544,7 @@ namespace Kyoo.Abstractions.Controllers /// Should old properties of the resource be discarded or should null values considered as not changed? /// The type of resources /// If the item is not found - /// The resource edited and completed by database's information (related items & so on) + /// The resource edited and completed by database's information (related items and so on) Task Edit(T item, bool resetOld) where T : class, IResource; diff --git a/Kyoo.Abstractions/Models/WatchItem.cs b/Kyoo.Abstractions/Models/WatchItem.cs index 14c5eabe..de706d9b 100644 --- a/Kyoo.Abstractions/Models/WatchItem.cs +++ b/Kyoo.Abstractions/Models/WatchItem.cs @@ -135,7 +135,7 @@ namespace Kyoo.Abstractions.Models /// /// The episode to transform. /// - /// A library manager to retrieve the next and previous episode and load the show & tracks of the episode. + /// A library manager to retrieve the next and previous episode and load the show and tracks of the episode. /// /// A new WatchItem representing the given episode. public static async Task FromEpisode(Episode ep, ILibraryManager library) diff --git a/Kyoo.Abstractions/Utility/EnumerableExtensions.cs b/Kyoo.Abstractions/Utility/EnumerableExtensions.cs index a518e54c..37008a5c 100644 --- a/Kyoo.Abstractions/Utility/EnumerableExtensions.cs +++ b/Kyoo.Abstractions/Utility/EnumerableExtensions.cs @@ -16,7 +16,7 @@ namespace Kyoo.Utils /// /// The IEnumerable to map. If self is null, an empty list is returned /// The function that will map each items - /// The type of items in + /// The type of items in /// The type of items in the returned list /// The list mapped. /// The list or the mapper can't be null @@ -48,11 +48,11 @@ namespace Kyoo.Utils /// Note: might interest you. /// /// The IEnumerable to map. - /// The asynchronous function that will map each items - /// The type of items in - /// The type of items in the returned list - /// The list mapped as an AsyncEnumerable - /// The list or the mapper can't be null + /// The asynchronous function that will map each items. + /// The type of items in . + /// The type of items in the returned list. + /// The list mapped as an AsyncEnumerable. + /// The list or the mapper can't be null. [LinqTunnel] public static IAsyncEnumerable MapAsync([NotNull] this IEnumerable self, [NotNull] Func> mapper) @@ -82,7 +82,7 @@ namespace Kyoo.Utils /// /// The IEnumerable to map /// The asynchronous function that will map each items - /// The type of items in + /// The type of items in /// The type of items in the returned list /// The list mapped as an AsyncEnumerable /// The list or the mapper can't be null @@ -198,6 +198,7 @@ namespace Kyoo.Utils /// /// The list to enumerate. If this is null, the function result in a no-op /// The action to execute for each arguments + /// A representing the asynchronous operation. public static async Task ForEachAsync([CanBeNull] this IEnumerable self, Func action) { if (self == null) @@ -212,6 +213,7 @@ namespace Kyoo.Utils /// The list to enumerate. If this is null, the function result in a no-op /// The asynchronous action to execute for each arguments /// The type of items in the list. + /// A representing the asynchronous operation. public static async Task ForEachAsync([CanBeNull] this IEnumerable self, Func action) { if (self == null) @@ -226,6 +228,7 @@ namespace Kyoo.Utils /// The async list to enumerate. If this is null, the function result in a no-op /// The action to execute for each arguments /// The type of items in the list. + /// A representing the asynchronous operation. public static async Task ForEachAsync([CanBeNull] this IAsyncEnumerable self, Action action) { if (self == null) diff --git a/Kyoo.Abstractions/Utility/Merger.cs b/Kyoo.Abstractions/Utility/Merger.cs index bb391c56..7a1a88ec 100644 --- a/Kyoo.Abstractions/Utility/Merger.cs +++ b/Kyoo.Abstractions/Utility/Merger.cs @@ -146,7 +146,7 @@ namespace Kyoo.Utils /// The object to assign /// The object containing new values /// Fields of T will be used - /// + /// public static T Assign(T first, T second) { Type type = typeof(T); @@ -189,7 +189,7 @@ namespace Kyoo.Utils /// Filter fields that will be merged /// /// Fields of T will be completed - /// + /// /// If first is null public static T Complete([NotNull] T first, [CanBeNull] T second, @@ -244,7 +244,7 @@ namespace Kyoo.Utils } /// - /// This will set missing values of to the corresponding values of . + /// This will set missing values of to the corresponding values of . /// Enumerable will be merged (concatenated) and Dictionaries too. /// At the end, the OnMerge method of first will be called if first is a . /// @@ -261,7 +261,7 @@ namespace Kyoo.Utils /// Filter fields that will be merged /// /// Fields of T will be merged - /// + /// [ContractAnnotation("first:notnull => notnull; second:notnull => notnull", true)] public static T Merge([CanBeNull] T first, [CanBeNull] T second, @@ -329,11 +329,11 @@ namespace Kyoo.Utils } /// - /// Set every fields of to the default value. + /// Set every fields of to the default value. /// /// The object to nullify /// Fields of T will be nullified - /// + /// public static T Nullify(T obj) { Type type = typeof(T); diff --git a/Kyoo.Abstractions/Utility/MethodOfUtils.cs b/Kyoo.Abstractions/Utility/MethodOfUtils.cs index 462249dd..6db738c5 100644 --- a/Kyoo.Abstractions/Utility/MethodOfUtils.cs +++ b/Kyoo.Abstractions/Utility/MethodOfUtils.cs @@ -22,6 +22,7 @@ namespace Kyoo.Utils /// Get a MethodInfo from a direct method. /// /// The method (without any arguments or return value. + /// The first parameter of the action. /// The of the given method public static MethodInfo MethodOf(Action action) { @@ -32,6 +33,8 @@ namespace Kyoo.Utils /// Get a MethodInfo from a direct method. /// /// The method (without any arguments or return value. + /// The first parameter of the action. + /// The second parameter of the action. /// The of the given method public static MethodInfo MethodOf(Action action) { @@ -42,6 +45,9 @@ namespace Kyoo.Utils /// Get a MethodInfo from a direct method. /// /// The method (without any arguments or return value. + /// The first parameter of the action. + /// The second parameter of the action. + /// The third parameter of the action. /// The of the given method public static MethodInfo MethodOf(Action action) { @@ -52,6 +58,7 @@ namespace Kyoo.Utils /// Get a MethodInfo from a direct method. /// /// The method (without any arguments or return value. + /// The return type of function. /// The of the given method public static MethodInfo MethodOf(Func action) { @@ -62,6 +69,8 @@ namespace Kyoo.Utils /// Get a MethodInfo from a direct method. /// /// The method (without any arguments or return value. + /// The first parameter of the function. + /// The return type of function. /// The of the given method public static MethodInfo MethodOf(Func action) { @@ -72,6 +81,9 @@ namespace Kyoo.Utils /// Get a MethodInfo from a direct method. /// /// The method (without any arguments or return value. + /// The first parameter of the function. + /// The second parameter of the function. + /// The return type of function. /// The of the given method public static MethodInfo MethodOf(Func action) { @@ -82,6 +94,10 @@ namespace Kyoo.Utils /// Get a MethodInfo from a direct method. /// /// The method (without any arguments or return value. + /// The first parameter of the function. + /// The second parameter of the function. + /// The third parameter of the function. + /// The return type of function. /// The of the given method public static MethodInfo MethodOf(Func action) { diff --git a/Kyoo.Abstractions/Utility/TaskUtils.cs b/Kyoo.Abstractions/Utility/TaskUtils.cs index 79609de4..40d5bfcd 100644 --- a/Kyoo.Abstractions/Utility/TaskUtils.cs +++ b/Kyoo.Abstractions/Utility/TaskUtils.cs @@ -18,7 +18,6 @@ namespace Kyoo.Utils /// /// The type of the item in the task. /// A continuation task wrapping the initial task and adding a continuation method. - /// /// The source task has been canceled. public static Task Then(this Task task, Action then) { diff --git a/Kyoo.Authentication/Controllers/Certificates.cs b/Kyoo.Authentication/Controllers/Certificates.cs index 498d5ba9..94894d0a 100644 --- a/Kyoo.Authentication/Controllers/Certificates.cs +++ b/Kyoo.Authentication/Controllers/Certificates.cs @@ -74,7 +74,7 @@ namespace Kyoo.Authentication } /// - /// Generate a new certificate key and put it in the file at . + /// Generate a new certificate key and put it in the file at . /// /// The path of the output file /// The password of the new certificate diff --git a/Kyoo.Authentication/Extensions.cs b/Kyoo.Authentication/Extensions.cs index 5e3f42c6..9b7f3bcd 100644 --- a/Kyoo.Authentication/Extensions.cs +++ b/Kyoo.Authentication/Extensions.cs @@ -30,11 +30,11 @@ namespace Kyoo.Authentication /// /// Convert a user to an . /// - /// The user to convert + /// The user to convert. /// The corresponding identity server user. public static IdentityServerUser ToIdentityUser(this User user) { - return new(user.ID.ToString()) + return new IdentityServerUser(user.ID.ToString()) { DisplayName = user.Username, AdditionalClaims = new[] { new Claim("permissions", string.Join(',', user.Permissions)) } diff --git a/Kyoo.Authentication/Models/DTO/RegisterRequest.cs b/Kyoo.Authentication/Models/DTO/RegisterRequest.cs index edf21742..82cad672 100644 --- a/Kyoo.Authentication/Models/DTO/RegisterRequest.cs +++ b/Kyoo.Authentication/Models/DTO/RegisterRequest.cs @@ -31,7 +31,7 @@ namespace Kyoo.Authentication.Models.DTO /// /// Convert this register request to a new class. /// - /// + /// A user representing this request. public User ToUser() { return new User diff --git a/Kyoo.Core/Controllers/ConfigurationManager.cs b/Kyoo.Core/Controllers/ConfigurationManager.cs index 93a64c75..8959abaa 100644 --- a/Kyoo.Core/Controllers/ConfigurationManager.cs +++ b/Kyoo.Core/Controllers/ConfigurationManager.cs @@ -168,7 +168,7 @@ namespace Kyoo.Core.Controllers /// /// The configuration to transform /// A strongly typed representation of the configuration. - [SuppressMessage("ReSharper", "RedundantJumpStatement")] + [SuppressMessage("ReSharper", "RedundantJumpStatement", Justification = "A catch block should not be empty.")] private ExpandoObject _ToObject(IConfiguration config) { ExpandoObject obj = new(); diff --git a/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs b/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs index 0d780ea9..5c7f512d 100644 --- a/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs +++ b/Kyoo.Core/Controllers/Repositories/EpisodeRepository.cs @@ -142,7 +142,7 @@ namespace Kyoo.Core.Controllers /// Set track's index and ensure that every tracks is well-formed. /// /// The resource to fix. - /// The parameter is returned. + /// The parameter is returned. private async Task _ValidateTracks(Episode resource) { if (resource.Tracks == null) diff --git a/Kyoo.Core/Controllers/Repositories/LibraryItemRepository.cs b/Kyoo.Core/Controllers/Repositories/LibraryItemRepository.cs index f9b20b19..96f12b32 100644 --- a/Kyoo.Core/Controllers/Repositories/LibraryItemRepository.cs +++ b/Kyoo.Core/Controllers/Repositories/LibraryItemRepository.cs @@ -106,7 +106,7 @@ namespace Kyoo.Core.Controllers => throw new InvalidOperationException(); /// - /// Get a basic queryable for a library with the right mapping from shows & collections. + /// Get a basic queryable for a library with the right mapping from shows and collections. /// Shows contained in a collection are excluded. /// /// Only items that are part of a library that match this predicate will be returned. diff --git a/Kyoo.Core/Controllers/Repositories/LocalRepository.cs b/Kyoo.Core/Controllers/Repositories/LocalRepository.cs index f3e52ccb..b5b9d46e 100644 --- a/Kyoo.Core/Controllers/Repositories/LocalRepository.cs +++ b/Kyoo.Core/Controllers/Repositories/LocalRepository.cs @@ -34,7 +34,7 @@ namespace Kyoo.Core.Controllers /// /// Create a new base with the given database handle. /// - /// A database connection to load resources of type + /// A database connection to load resources of type protected LocalRepository(DbContext database) { Database = database; @@ -114,11 +114,11 @@ namespace Kyoo.Core.Controllers } /// - /// Apply filters to a query to ease sort, pagination & where queries for resources of this repository + /// Apply filters to a query to ease sort, pagination and where queries for resources of this repository /// /// The base query to filter. /// An expression to filter based on arbitrary conditions - /// The sort settings (sort order & sort by) + /// The sort settings (sort order and sort by) /// Pagination information (where to start and how many to get) /// The filtered query protected Task> ApplyFilters(IQueryable query, @@ -130,14 +130,14 @@ namespace Kyoo.Core.Controllers } /// - /// Apply filters to a query to ease sort, pagination & where queries for any resources types. - /// For resources of type , see + /// Apply filters to a query to ease sort, pagination and where queries for any resources types. + /// For resources of type , see /// /// The base query to filter. /// A function to asynchronously get a resource from the database using it's ID. /// The default sort order of this resource's type. /// An expression to filter based on arbitrary conditions - /// The sort settings (sort order & sort by) + /// The sort settings (sort order and sort by) /// Pagination information (where to start and how many to get) /// The type of items to query. /// The filtered query @@ -247,8 +247,8 @@ namespace Kyoo.Core.Controllers /// The non edited resource /// /// - /// The new version of . - /// This item will be saved on the database and replace + /// The new version of . + /// This item will be saved on the database and replace /// /// /// A boolean to indicate if all values of resource should be discarded or not. diff --git a/Kyoo.Core/Tasks/MetadataProviderLoader.cs b/Kyoo.Core/Tasks/MetadataProviderLoader.cs index f8d07894..18fe6fc2 100644 --- a/Kyoo.Core/Tasks/MetadataProviderLoader.cs +++ b/Kyoo.Core/Tasks/MetadataProviderLoader.cs @@ -31,16 +31,16 @@ namespace Kyoo.Core.Tasks private readonly ICollection _metadataProviders; /// - /// Create a new task. + /// Create a new task. /// /// - /// The provider repository used to create in-db providers from metadata providers. + /// The provider repository used to create in-db providers from metadata providers. /// /// - /// The thumbnail manager used to download providers logo. + /// The thumbnail manager used to download providers logo. /// /// - /// The list of metadata providers to register. + /// The list of metadata providers to register. /// public MetadataProviderLoader(IProviderRepository providers, IThumbnailsManager thumbnails, diff --git a/Kyoo.Core/Views/Helper/Serializers/PeopleRoleConverter.cs b/Kyoo.Core/Views/Helper/Serializers/PeopleRoleConverter.cs index c376f4c4..3a5affb1 100644 --- a/Kyoo.Core/Views/Helper/Serializers/PeopleRoleConverter.cs +++ b/Kyoo.Core/Views/Helper/Serializers/PeopleRoleConverter.cs @@ -1,19 +1,11 @@ -using System; -using System.Collections; +using System; using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text.RegularExpressions; using Kyoo.Abstractions.Models; -using Kyoo.Abstractions.Models.Attributes; -using Kyoo.Utils; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; namespace Kyoo.Core.Api { - public class PeopleRoleConverter : JsonConverter { public override void WriteJson(JsonWriter writer, PeopleRole value, JsonSerializer serializer) diff --git a/Kyoo.Core/Views/Helper/Serializers/SerializeAsProvider.cs b/Kyoo.Core/Views/Helper/Serializers/SerializeAsProvider.cs index 479ea8ac..e40c6ec2 100644 --- a/Kyoo.Core/Views/Helper/Serializers/SerializeAsProvider.cs +++ b/Kyoo.Core/Views/Helper/Serializers/SerializeAsProvider.cs @@ -1,19 +1,11 @@ -using System; -using System.Collections; -using System.Collections.Generic; +using System; using System.Linq; using System.Reflection; using System.Text.RegularExpressions; -using Kyoo.Abstractions.Models; -using Kyoo.Abstractions.Models.Attributes; -using Kyoo.Utils; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; namespace Kyoo.Core.Api { - public class SerializeAsProvider : IValueProvider { private string _format; diff --git a/Kyoo.Database/DatabaseContext.cs b/Kyoo.Database/DatabaseContext.cs index c70d41a7..3ebd8c75 100644 --- a/Kyoo.Database/DatabaseContext.cs +++ b/Kyoo.Database/DatabaseContext.cs @@ -348,7 +348,7 @@ namespace Kyoo.Database /// Return a new or an in cache temporary object wih the same ID as the one given /// /// If a resource with the same ID is found in the database, it will be used. - /// will be used otherwise + /// will be used otherwise /// The type of the resource /// A resource that is now tracked by this context. public T GetTemporaryObject(T model) diff --git a/Kyoo.Host.Console/Program.cs b/Kyoo.Host.Console/Program.cs index 6d5edb49..201f7fc2 100644 --- a/Kyoo.Host.Console/Program.cs +++ b/Kyoo.Host.Console/Program.cs @@ -22,6 +22,7 @@ namespace Kyoo.Host.Console /// Main function of the program /// /// Command line arguments + /// A representing the lifetime of the program. public static Task Main(string[] args) { Application application = new(Environment); diff --git a/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.linux.target b/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.linux.target index 82db79bc..99c68350 100644 --- a/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.linux.target +++ b/Kyoo.Host.WindowsTrait/Kyoo.Host.WindowsTrait.linux.target @@ -1,15 +1,15 @@ - + - + net5.0 NU1503 - + @@ -18,9 +18,9 @@ - + - + - \ No newline at end of file +