core: don't enforce expression body on constructors (#14138)

This commit is contained in:
Bogdan 2023-03-07 20:21:46 +02:00 committed by GitHub
parent c1f019bb37
commit 05e8e1e94f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 65 additions and 19 deletions

View File

@ -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

View File

@ -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;
}
}
}

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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<IFallbackStrategy> FallbackStrategiesForQuery(TorznabQuery query)
{

View File

@ -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<IResultFilter> FiltersForQuery(TorznabQuery query)
{

View File

@ -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<string>();
}
public ServerConfig(IEnumerable<string> notices, Models.Config.ServerConfig config, string version, bool canRunNetCore)
{

View File

@ -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 };
}
}
}

View File

@ -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 };
}
}
}

View File

@ -257,7 +257,10 @@ namespace Jackett.Common.Models.IndexerConfig
public Dictionary<string, string> Options { get; }
public SingleSelectConfigurationItem(string name, Dictionary<string, string> 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<string, string> Options { get; }
public MultiSelectConfigurationItem(string name, Dictionary<string, string> options)
: base(name, itemType: "inputcheckbox") => Options = options;
: base(name, itemType: "inputcheckbox")
{
Options = options;
}
public override JObject ToJson(IProtectionService ps, bool forDisplay)
{

View File

@ -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 };
}
}
}

View File

@ -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");
}
}
}

View File

@ -10,7 +10,10 @@ namespace Jackett.Common.Models
public List<TorznabCategory> SubCategories { get; private set; }
public TorznabCategory() => SubCategories = new List<TorznabCategory>();
public TorznabCategory()
{
SubCategories = new List<TorznabCategory>();
}
public TorznabCategory(int id, string name)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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; }
}