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