From 05e8e1e94f7c188d1eff22e48f0f71ba42e42638 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 7 Mar 2023 20:21:46 +0200 Subject: [PATCH] core: don't enforce expression body on constructors (#14138) --- .editorconfig | 2 +- src/Jackett.Common/ExceptionWithConfigData.cs | 5 +++-- .../Exceptions/TooManyRequestsException.cs | 5 ++++- src/Jackett.Common/IndexerException.cs | 4 +++- src/Jackett.Common/Indexers/BaseIndexer.cs | 5 ++++- src/Jackett.Common/Indexers/Meta/Fallbacks.cs | 5 ++++- src/Jackett.Common/Indexers/Meta/ResultFilters.cs | 5 ++++- src/Jackett.Common/Models/DTO/ServerConfig.cs | 6 +++++- .../IndexerConfig/Bespoke/ConfigurationDataPornolab.cs | 4 +++- .../IndexerConfig/Bespoke/ConfigurationDataToloka.cs | 4 +++- .../Models/IndexerConfig/ConfigurationData.cs | 10 ++++++++-- .../Models/IndexerConfig/ConfigurationDataAPIKey.cs | 5 ++++- .../Models/IndexerConfig/ConfigurationDataPinNumber.cs | 4 +++- src/Jackett.Common/Models/TorznabCategory.cs | 5 ++++- src/Jackett.Common/Plumbing/JackettModule.cs | 5 ++++- src/Jackett.Common/Services/ProcessService.cs | 5 ++++- src/Jackett.Common/Utils/BuildDate.cs | 5 ++++- 17 files changed, 65 insertions(+), 19 deletions(-) diff --git a/.editorconfig b/.editorconfig index 79fb06603..fe68de402 100644 --- a/.editorconfig +++ b/.editorconfig @@ -220,7 +220,7 @@ csharp_style_var_when_type_is_apparent=true:suggestion csharp_style_var_elsewhere=true:suggestion # Expression-bodied members csharp_style_expression_bodied_methods=when_on_single_line:suggestion -csharp_style_expression_bodied_constructors=when_on_single_line:suggestion +csharp_style_expression_bodied_constructors=false:suggestion csharp_style_expression_bodied_operators=when_on_single_line:suggestion csharp_style_expression_bodied_properties=true:suggestion csharp_style_expression_bodied_indexers=true:suggestion diff --git a/src/Jackett.Common/ExceptionWithConfigData.cs b/src/Jackett.Common/ExceptionWithConfigData.cs index 1884cc022..e5d89e15a 100644 --- a/src/Jackett.Common/ExceptionWithConfigData.cs +++ b/src/Jackett.Common/ExceptionWithConfigData.cs @@ -9,7 +9,8 @@ namespace Jackett.Common public ConfigurationData ConfigData { get; private set; } public ExceptionWithConfigData(string message, ConfigurationData data) : base(message) - => ConfigData = data; - + { + ConfigData = data; + } } } diff --git a/src/Jackett.Common/Exceptions/TooManyRequestsException.cs b/src/Jackett.Common/Exceptions/TooManyRequestsException.cs index d6a5b3113..9343f7b16 100644 --- a/src/Jackett.Common/Exceptions/TooManyRequestsException.cs +++ b/src/Jackett.Common/Exceptions/TooManyRequestsException.cs @@ -8,7 +8,10 @@ namespace Jackett.Common.Exceptions public TimeSpan RetryAfter { get; private set; } public TooManyRequestsException(string message, TimeSpan retryWait) - : base(message) => RetryAfter = retryWait; + : base(message) + { + RetryAfter = retryWait; + } public TooManyRequestsException(string message, WebResult response) : base(message) diff --git a/src/Jackett.Common/IndexerException.cs b/src/Jackett.Common/IndexerException.cs index bbf115398..d624449ea 100644 --- a/src/Jackett.Common/IndexerException.cs +++ b/src/Jackett.Common/IndexerException.cs @@ -9,7 +9,9 @@ namespace Jackett.Common public IndexerException(IIndexer indexer, string message, Exception innerException) : base(message, innerException) - => this.Indexer = indexer; + { + this.Indexer = indexer; + } public IndexerException(IIndexer indexer, string message) : this(indexer, message, null) diff --git a/src/Jackett.Common/Indexers/BaseIndexer.cs b/src/Jackett.Common/Indexers/BaseIndexer.cs index ed8ac7fdc..55c9c504a 100644 --- a/src/Jackett.Common/Indexers/BaseIndexer.cs +++ b/src/Jackett.Common/Indexers/BaseIndexer.cs @@ -353,7 +353,10 @@ namespace Jackett.Common.Indexers // minimal constructor used by e.g. cardigann generic indexer protected BaseWebIndexer(IIndexerConfigurationService configService, WebClient client, Logger logger, IProtectionService p, ICacheService cacheService) - : base("/", "", "", "", configService, logger, null, p, cacheService) => webclient = client; + : base("/", "", "", "", configService, logger, null, p, cacheService) + { + webclient = client; + } protected virtual int DefaultNumberOfRetryAttempts => 2; diff --git a/src/Jackett.Common/Indexers/Meta/Fallbacks.cs b/src/Jackett.Common/Indexers/Meta/Fallbacks.cs index 99014d8d2..7b51f2252 100644 --- a/src/Jackett.Common/Indexers/Meta/Fallbacks.cs +++ b/src/Jackett.Common/Indexers/Meta/Fallbacks.cs @@ -48,7 +48,10 @@ namespace Jackett.Common.Indexers.Meta public class ImdbFallbackStrategyProvider : IFallbackStrategyProvider { - public ImdbFallbackStrategyProvider(IImdbResolver resolver) => this.resolver = resolver; + public ImdbFallbackStrategyProvider(IImdbResolver resolver) + { + this.resolver = resolver; + } public IEnumerable FallbackStrategiesForQuery(TorznabQuery query) { diff --git a/src/Jackett.Common/Indexers/Meta/ResultFilters.cs b/src/Jackett.Common/Indexers/Meta/ResultFilters.cs index eb3bc42af..dc81dd17c 100644 --- a/src/Jackett.Common/Indexers/Meta/ResultFilters.cs +++ b/src/Jackett.Common/Indexers/Meta/ResultFilters.cs @@ -100,7 +100,10 @@ namespace Jackett.Common.Indexers.Meta public class ImdbTitleResultFilterProvider : IResultFilterProvider { - public ImdbTitleResultFilterProvider(IImdbResolver resolver) => this.resolver = resolver; + public ImdbTitleResultFilterProvider(IImdbResolver resolver) + { + this.resolver = resolver; + } public IEnumerable FiltersForQuery(TorznabQuery query) { diff --git a/src/Jackett.Common/Models/DTO/ServerConfig.cs b/src/Jackett.Common/Models/DTO/ServerConfig.cs index 84df88b0f..d957b634a 100644 --- a/src/Jackett.Common/Models/DTO/ServerConfig.cs +++ b/src/Jackett.Common/Models/DTO/ServerConfig.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Runtime.Serialization; using Jackett.Common.Models.Config; @@ -61,7 +62,10 @@ namespace Jackett.Common.Models.DTO [DataMember] public string proxy_password { get; set; } - public ServerConfig() => notices = new string[0]; + public ServerConfig() + { + notices = Array.Empty(); + } public ServerConfig(IEnumerable notices, Models.Config.ServerConfig config, string version, bool canRunNetCore) { diff --git a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataPornolab.cs b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataPornolab.cs index fe2a29c9b..d2524abce 100644 --- a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataPornolab.cs +++ b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataPornolab.cs @@ -8,6 +8,8 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke public BoolConfigurationItem StripRussianLetters { get; private set; } public ConfigurationDataPornolab() - => StripRussianLetters = new BoolConfigurationItem("Strip Russian Letters") { Value = false }; + { + StripRussianLetters = new BoolConfigurationItem("Strip Russian Letters") { Value = false }; + } } } diff --git a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataToloka.cs b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataToloka.cs index 66c0f1bea..576330c95 100644 --- a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataToloka.cs +++ b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataToloka.cs @@ -8,6 +8,8 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke public BoolConfigurationItem StripCyrillicLetters { get; private set; } public ConfigurationDataToloka() - => StripCyrillicLetters = new BoolConfigurationItem("Strip Cyrillic Letters") { Value = true }; + { + StripCyrillicLetters = new BoolConfigurationItem("Strip Cyrillic Letters") { Value = true }; + } } } diff --git a/src/Jackett.Common/Models/IndexerConfig/ConfigurationData.cs b/src/Jackett.Common/Models/IndexerConfig/ConfigurationData.cs index 4c36d1364..c3afab85c 100644 --- a/src/Jackett.Common/Models/IndexerConfig/ConfigurationData.cs +++ b/src/Jackett.Common/Models/IndexerConfig/ConfigurationData.cs @@ -257,7 +257,10 @@ namespace Jackett.Common.Models.IndexerConfig public Dictionary Options { get; } public SingleSelectConfigurationItem(string name, Dictionary options) - : base(name, itemType: "inputselect") => Options = options; + : base(name, itemType: "inputselect") + { + Options = options; + } public override JObject ToJson(IProtectionService ps = null, bool forDisplay = true) { @@ -286,7 +289,10 @@ namespace Jackett.Common.Models.IndexerConfig public Dictionary Options { get; } public MultiSelectConfigurationItem(string name, Dictionary options) - : base(name, itemType: "inputcheckbox") => Options = options; + : base(name, itemType: "inputcheckbox") + { + Options = options; + } public override JObject ToJson(IProtectionService ps, bool forDisplay) { diff --git a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataAPIKey.cs b/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataAPIKey.cs index c9cb3634c..fd086895d 100644 --- a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataAPIKey.cs +++ b/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataAPIKey.cs @@ -4,6 +4,9 @@ namespace Jackett.Common.Models.IndexerConfig { public StringConfigurationItem Key { get; private set; } - public ConfigurationDataAPIKey() => Key = new StringConfigurationItem("APIKey") { Value = string.Empty }; + public ConfigurationDataAPIKey() + { + Key = new StringConfigurationItem("APIKey") { Value = string.Empty }; + } } } diff --git a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataPinNumber.cs b/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataPinNumber.cs index 10b6a735d..1be66d0b4 100644 --- a/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataPinNumber.cs +++ b/src/Jackett.Common/Models/IndexerConfig/ConfigurationDataPinNumber.cs @@ -6,6 +6,8 @@ namespace Jackett.Common.Models.IndexerConfig public ConfigurationDataPinNumber(string instructionMessageOptional = null) : base(instructionMessageOptional) - => Pin = new StringConfigurationItem("Login Pin Number"); + { + Pin = new StringConfigurationItem("Login Pin Number"); + } } } diff --git a/src/Jackett.Common/Models/TorznabCategory.cs b/src/Jackett.Common/Models/TorznabCategory.cs index 83c722bcd..c70478df5 100644 --- a/src/Jackett.Common/Models/TorznabCategory.cs +++ b/src/Jackett.Common/Models/TorznabCategory.cs @@ -10,7 +10,10 @@ namespace Jackett.Common.Models public List SubCategories { get; private set; } - public TorznabCategory() => SubCategories = new List(); + public TorznabCategory() + { + SubCategories = new List(); + } public TorznabCategory(int id, string name) { diff --git a/src/Jackett.Common/Plumbing/JackettModule.cs b/src/Jackett.Common/Plumbing/JackettModule.cs index e4cbc1054..2e82599e2 100644 --- a/src/Jackett.Common/Plumbing/JackettModule.cs +++ b/src/Jackett.Common/Plumbing/JackettModule.cs @@ -12,7 +12,10 @@ namespace Jackett.Common.Plumbing { private readonly RuntimeSettings _runtimeSettings; - public JackettModule(RuntimeSettings runtimeSettings) => _runtimeSettings = runtimeSettings; + public JackettModule(RuntimeSettings runtimeSettings) + { + _runtimeSettings = runtimeSettings; + } protected override void Load(ContainerBuilder builder) { diff --git a/src/Jackett.Common/Services/ProcessService.cs b/src/Jackett.Common/Services/ProcessService.cs index b306d52bc..c1ef52a25 100644 --- a/src/Jackett.Common/Services/ProcessService.cs +++ b/src/Jackett.Common/Services/ProcessService.cs @@ -10,7 +10,10 @@ namespace Jackett.Common.Services { private readonly Logger logger; - public ProcessService(Logger l) => logger = l; + public ProcessService(Logger l) + { + logger = l; + } private void Run(string exe, string args, bool asAdmin, DataReceivedEventHandler d, DataReceivedEventHandler r) { diff --git a/src/Jackett.Common/Utils/BuildDate.cs b/src/Jackett.Common/Utils/BuildDate.cs index d8a4a7d86..5acd38756 100644 --- a/src/Jackett.Common/Utils/BuildDate.cs +++ b/src/Jackett.Common/Utils/BuildDate.cs @@ -17,7 +17,10 @@ namespace Jackett.Common.Utils [AttributeUsage(AttributeTargets.Assembly)] public class BuildDateAttribute : Attribute { - public BuildDateAttribute(string value) => DateTime = DateTime.ParseExact(value, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); + public BuildDateAttribute(string value) + { + DateTime = DateTime.ParseExact(value, "yyyyMMddHHmmss", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); + } public DateTime DateTime { get; } }