mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
EditorConfig: Specifing naming of privates w/ prefix
This commit is contained in:
parent
b93f69cb22
commit
49dd7cf12c
@ -1,7 +1,7 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8-bom
|
||||
charset = us-ascii
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
@ -66,6 +66,15 @@ csharp_indent_switch_labels = true
|
||||
dotnet_style_readonly_field = true:suggestion
|
||||
csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
|
||||
# Naming style
|
||||
dotnet_naming_symbols.privates.applicable_kinds = property,method,event,delegate
|
||||
dotnet_naming_symbols.privates.applicable_accessibilities = private
|
||||
dotnet_naming_style.underscore_pascal.capitalization = pascal_case
|
||||
dotnet_naming_style.underscore_pascal.required_prefix = _
|
||||
dotnet_naming_rule.privates_with_underscore.symbols = privates
|
||||
dotnet_naming_rule.privates_with_underscore.style = underscore_pascal
|
||||
dotnet_naming_rule.privates_with_underscore.severity = warning
|
||||
dotnet_diagnostic.IDE1006.severity = warning
|
||||
# ReSharper properties
|
||||
resharper_align_multiline_binary_expressions_chain = false
|
||||
resharper_csharp_empty_block_style = together_same_line
|
||||
|
@ -1,4 +1,4 @@
|
||||
<Project>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
|
||||
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
|
||||
@ -14,6 +14,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Kyoo.ruleset</CodeAnalysisRuleSet>
|
||||
<!-- <AnalysisMode>AllEnabledByDefault</AnalysisMode>-->
|
||||
</PropertyGroup>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.InteropServices;
|
||||
@ -134,6 +134,7 @@ namespace Kyoo.Abstractions.Controllers
|
||||
/// <returns>The resource found</returns>
|
||||
[ItemNotNull]
|
||||
Task<T> Get(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Get a resource from it's slug.
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using Kyoo.Abstractions.Models;
|
||||
|
||||
@ -24,7 +24,6 @@ namespace Kyoo.Abstractions.Controllers
|
||||
Task<bool> DownloadImages<T>([NotNull] T item, bool alwaysDownload = false)
|
||||
where T : IThumbnails;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the local path of an image of the given item.
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using JetBrains.Annotations;
|
||||
@ -26,6 +26,7 @@ namespace Kyoo.Abstractions.Models
|
||||
? GetSlug(ShowID.ToString(), SeasonNumber, EpisodeNumber, AbsoluteNumber)
|
||||
: null;
|
||||
}
|
||||
|
||||
[UsedImplicitly] [NotNull] private set
|
||||
{
|
||||
if (value == null)
|
||||
@ -64,6 +65,7 @@ namespace Kyoo.Abstractions.Models
|
||||
/// The ID of the Show containing this episode.
|
||||
/// </summary>
|
||||
[SerializeIgnore] public int ShowID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The show that contains this episode. This must be explicitly loaded via a call to <see cref="ILibraryManager.Load"/>.
|
||||
/// </summary>
|
||||
@ -73,6 +75,7 @@ namespace Kyoo.Abstractions.Models
|
||||
/// The ID of the Season containing this episode.
|
||||
/// </summary>
|
||||
[SerializeIgnore] public int? SeasonID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The season that contains this episode.
|
||||
/// This must be explicitly loaded via a call to <see cref="ILibraryManager.Load"/>.
|
||||
@ -138,7 +141,6 @@ namespace Kyoo.Abstractions.Models
|
||||
/// </summary>
|
||||
[EditableRelation] [LoadableRelation] public ICollection<Track> Tracks { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the slug of an episode.
|
||||
/// </summary>
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
@ -149,7 +149,7 @@ namespace Kyoo.Abstractions.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
string language = GetLanguage(Language);
|
||||
string language = _GetLanguage(Language);
|
||||
|
||||
if (language == null)
|
||||
return $"Unknown (index: {TrackIndex})";
|
||||
@ -167,7 +167,7 @@ namespace Kyoo.Abstractions.Models
|
||||
}
|
||||
|
||||
// Converting mkv track language to c# system language tag.
|
||||
private static string GetLanguage(string mkvLanguage)
|
||||
private static string _GetLanguage(string mkvLanguage)
|
||||
{
|
||||
// TODO delete this and have a real way to get the language string from the ISO-639-2.
|
||||
return mkvLanguage switch
|
||||
|
@ -21,8 +21,18 @@ using ILogger = Serilog.ILogger;
|
||||
|
||||
namespace Kyoo.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// The main implementation of <see cref="IApplication"/>.
|
||||
/// Hosts of kyoo (main functions) generally only create a new <see cref="Application"/>
|
||||
/// and return <see cref="Start(string[])"/>.
|
||||
/// </summary>
|
||||
public class Application : IApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// The environment in witch Kyoo will run (ether "Production" or "Development").
|
||||
/// </summary>
|
||||
private readonly string _environment;
|
||||
|
||||
/// <summary>
|
||||
/// The path to the data directory.
|
||||
/// </summary>
|
||||
@ -38,17 +48,11 @@ namespace Kyoo.Core
|
||||
/// </summary>
|
||||
private CancellationTokenSource _tokenSource;
|
||||
|
||||
/// <summary>
|
||||
/// The environment in witch Kyoo will run (ether "Production" or "Development").
|
||||
/// </summary>
|
||||
private readonly string _environment;
|
||||
|
||||
/// <summary>
|
||||
/// The logger used for startup and error messages.
|
||||
/// </summary>
|
||||
private ILogger _logger;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="Application"/> that will use the specified environment.
|
||||
/// </summary>
|
||||
@ -58,7 +62,6 @@ namespace Kyoo.Core
|
||||
_environment = environment;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Start the application with the given console args.
|
||||
/// This is generally called from the Main entrypoint of Kyoo.
|
||||
@ -122,7 +125,6 @@ namespace Kyoo.Core
|
||||
return _dataDir;
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public string GetConfigFile()
|
||||
{
|
||||
@ -132,7 +134,7 @@ namespace Kyoo.Core
|
||||
/// <summary>
|
||||
/// Parse the data directory from environment variables and command line arguments, create it if necessary.
|
||||
/// Set the current directory to said data folder and place a default configuration file if it does not already
|
||||
/// exists.
|
||||
/// exists.
|
||||
/// </summary>
|
||||
/// <param name="args">The command line arguments</param>
|
||||
/// <returns>The current data directory.</returns>
|
||||
|
20
Kyoo.Host.Console/Properties/launchSettings.json
Normal file
20
Kyoo.Host.Console/Properties/launchSettings.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Console Host": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"KYOO_DATADIR": "./bin/KyooData"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000"
|
||||
},
|
||||
"Console Host (Browser)": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"KYOO_DATADIR": "./bin/KyooData"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5000"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<RuleSet Name="Kyoo" ToolsVersion="10.0">
|
||||
<RuleSet Name="Kyoo" ToolsVersion="10.0">
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.MaintainabilityRules">
|
||||
<Rule Id="SA1413" Action="None" /> <!-- UseTrailingCommasInMultiLineInitializers -->
|
||||
<Rule Id="SA1414" Action="None" /> <!-- UseTrailingCommasInMultiLineInitializers -->
|
||||
@ -10,6 +10,7 @@
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.NamingRules">
|
||||
<Rule Id="SA1309" Action="None" /> <!-- FieldNamesMustNotBeginWithUnderscore -->
|
||||
<Rule Id="SX1309" Action="Warning" /> <!-- FieldNamesMustBeginWithUnderscore -->
|
||||
<Rule Id="SA1300" Action="None" /> <!-- ElementMustBeginWithUpperCaseLetter (this conflict with the _ prefix for privates, enforced by an IDE rule) -->
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.ReadabilityRules">
|
||||
<Rule Id="SA1101" Action="None" /> <!-- PrefixLocalCallsWithThis -->
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
@ -229,10 +229,7 @@ namespace Kyoo.Tests.Utility
|
||||
public void MergeListTest()
|
||||
{
|
||||
int[] first = { 1 };
|
||||
int[] second = {
|
||||
3,
|
||||
3
|
||||
};
|
||||
int[] second = { 3, 3 };
|
||||
int[] ret = Merger.MergeLists(first, second);
|
||||
|
||||
Assert.Equal(3, ret.Length);
|
||||
@ -263,10 +260,7 @@ namespace Kyoo.Tests.Utility
|
||||
public void MergeListDuplicateCustomEqualityTest()
|
||||
{
|
||||
int[] first = { 1 };
|
||||
int[] second = {
|
||||
3,
|
||||
2
|
||||
};
|
||||
int[] second = { 3, 2 };
|
||||
int[] ret = Merger.MergeLists(first, second, (x, y) => x % 2 == y % 2);
|
||||
|
||||
Assert.Equal(2, ret.Length);
|
||||
@ -538,4 +532,4 @@ namespace Kyoo.Tests.Utility
|
||||
Assert.Equal("logo", ret[Images.Logo]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user