Prefer flags over comments

This commit is contained in:
JustArchi
2016-05-13 19:20:24 +02:00
parent 20038e8c86
commit 622f060575
13 changed files with 33 additions and 37 deletions

View File

@@ -28,6 +28,7 @@ using SteamKit2;
using SteamKit2.Internal; using SteamKit2.Internal;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
@@ -1494,7 +1495,7 @@ namespace ArchiSteamFarm {
SteamClient.Connect(); SteamClient.Connect();
} }
// ReSharper disable once MemberCanBeMadeStatic.Local [SuppressMessage("ReSharper", "MemberCanBeMadeStatic.Local")]
private void OnFreeLicense(SteamApps.FreeLicenseCallback callback) { } private void OnFreeLicense(SteamApps.FreeLicenseCallback callback) { }
private async void OnGuestPassList(SteamApps.GuestPassListCallback callback) { private async void OnGuestPassList(SteamApps.GuestPassListCallback callback) {
@@ -1763,7 +1764,7 @@ namespace ArchiSteamFarm {
}); });
} }
// ReSharper disable once MemberCanBeMadeStatic.Local [SuppressMessage("ReSharper", "MemberCanBeMadeStatic.Local")]
private void OnWebAPIUserNonce(SteamUser.WebAPIUserNonceCallback callback) { } private void OnWebAPIUserNonce(SteamUser.WebAPIUserNonceCallback callback) { }
private async void OnNotifications(ArchiHandler.NotificationsCallback callback) { private async void OnNotifications(ArchiHandler.NotificationsCallback callback) {

View File

@@ -25,6 +25,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using SteamAuth; using SteamAuth;
using System; using System;
using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
namespace ArchiSteamFarm { namespace ArchiSteamFarm {
@@ -101,7 +102,7 @@ namespace ArchiSteamFarm {
} }
// This constructor is used only by deserializer // This constructor is used only by deserializer
// ReSharper disable once UnusedMember.Local [SuppressMessage("ReSharper", "UnusedMember.Local")]
private BotDatabase() { } private BotDatabase() { }
internal void Save() { internal void Save() {

View File

@@ -24,15 +24,16 @@
using SteamKit2; using SteamKit2;
using System; using System;
using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
namespace ArchiSteamFarm { namespace ArchiSteamFarm {
internal static class Debugging { internal static class Debugging {
#if DEBUG #if DEBUG
// ReSharper disable once ConvertToConstant.Global [SuppressMessage("ReSharper", "ConvertToConstant.Global")]
internal static readonly bool IsDebugBuild = true; internal static readonly bool IsDebugBuild = true;
#else #else
// ReSharper disable once ConvertToConstant.Global [SuppressMessage("ReSharper", "ConvertToConstant.Global")]
internal static readonly bool IsDebugBuild = false; internal static readonly bool IsDebugBuild = false;
#endif #endif

View File

@@ -30,8 +30,7 @@ using System.IO;
using System.Net.Sockets; using System.Net.Sockets;
namespace ArchiSteamFarm { namespace ArchiSteamFarm {
// ReSharper disable once ClassCannotBeInstantiated [SuppressMessage("ReSharper", "ClassCannotBeInstantiated"), SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
// ReSharper disable once ClassNeverInstantiated.Global
internal sealed class GlobalConfig { internal sealed class GlobalConfig {
[SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnusedMember.Global")]
internal enum EUpdateChannel : byte { internal enum EUpdateChannel : byte {

View File

@@ -24,6 +24,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
namespace ArchiSteamFarm { namespace ArchiSteamFarm {
@@ -83,7 +84,7 @@ namespace ArchiSteamFarm {
} }
// This constructor is used only by deserializer // This constructor is used only by deserializer
// ReSharper disable once UnusedMember.Local [SuppressMessage("ReSharper", "UnusedMember.Local")]
private GlobalDatabase() { } private GlobalDatabase() { }
private void Save() { private void Save() {

View File

@@ -28,10 +28,8 @@ using Newtonsoft.Json;
namespace ArchiSteamFarm.JSON { namespace ArchiSteamFarm.JSON {
internal static class GitHub { internal static class GitHub {
// ReSharper disable once ClassNeverInstantiated.Global [SuppressMessage("ReSharper", "ClassNeverInstantiated.Global"), SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")]
internal sealed class ReleaseResponse { internal sealed class ReleaseResponse {
// ReSharper disable once ClassNeverInstantiated.Global
internal sealed class Asset { internal sealed class Asset {
[JsonProperty(PropertyName = "name", Required = Required.Always)] [JsonProperty(PropertyName = "name", Required = Required.Always)]
internal string Name { get; private set; } internal string Name { get; private set; }

View File

@@ -50,8 +50,7 @@ namespace ArchiSteamFarm.JSON {
internal uint AppID { get; set; } internal uint AppID { get; set; }
// ReSharper disable once UnusedMember.Local [JsonProperty(PropertyName = "appid", Required = Required.DisallowNull), SuppressMessage("ReSharper", "UnusedMember.Local")]
[JsonProperty(PropertyName = "appid", Required = Required.DisallowNull)]
private string AppIDString { private string AppIDString {
get { get {
return AppID.ToString(); return AppID.ToString();
@@ -73,8 +72,7 @@ namespace ArchiSteamFarm.JSON {
internal ulong ContextID { get; set; } internal ulong ContextID { get; set; }
// ReSharper disable once UnusedMember.Local [JsonProperty(PropertyName = "contextid", Required = Required.DisallowNull), SuppressMessage("ReSharper", "UnusedMember.Local")]
[JsonProperty(PropertyName = "contextid", Required = Required.DisallowNull)]
private string ContextIDString { private string ContextIDString {
get { get {
return ContextID.ToString(); return ContextID.ToString();
@@ -116,8 +114,7 @@ namespace ArchiSteamFarm.JSON {
} }
} }
// ReSharper disable once UnusedMember.Local [JsonProperty(PropertyName = "id", Required = Required.DisallowNull), SuppressMessage("ReSharper", "UnusedMember.Local")]
[JsonProperty(PropertyName = "id", Required = Required.DisallowNull)]
private string ID { private string ID {
get { return AssetIDString; } get { return AssetIDString; }
set { AssetIDString = value; } set { AssetIDString = value; }
@@ -125,8 +122,7 @@ namespace ArchiSteamFarm.JSON {
internal ulong ClassID { get; set; } internal ulong ClassID { get; set; }
// ReSharper disable once UnusedMember.Local [JsonProperty(PropertyName = "classid", Required = Required.DisallowNull), SuppressMessage("ReSharper", "UnusedMember.Local")]
[JsonProperty(PropertyName = "classid", Required = Required.DisallowNull)]
private string ClassIDString { private string ClassIDString {
get { get {
return ClassID.ToString(); return ClassID.ToString();
@@ -148,8 +144,7 @@ namespace ArchiSteamFarm.JSON {
internal ulong InstanceID { get; set; } internal ulong InstanceID { get; set; }
// ReSharper disable once UnusedMember.Local [JsonProperty(PropertyName = "instanceid", Required = Required.DisallowNull), SuppressMessage("ReSharper", "UnusedMember.Local")]
[JsonProperty(PropertyName = "instanceid", Required = Required.DisallowNull)]
private string InstanceIDString { private string InstanceIDString {
get { get {
return InstanceID.ToString(); return InstanceID.ToString();
@@ -171,8 +166,7 @@ namespace ArchiSteamFarm.JSON {
internal uint Amount { get; set; } internal uint Amount { get; set; }
// ReSharper disable once UnusedMember.Local [JsonProperty(PropertyName = "amount", Required = Required.Always), SuppressMessage("ReSharper", "UnusedMember.Local")]
[JsonProperty(PropertyName = "amount", Required = Required.Always)]
private string AmountString { private string AmountString {
get { get {
return Amount.ToString(); return Amount.ToString();
@@ -215,8 +209,7 @@ namespace ArchiSteamFarm.JSON {
internal ulong TradeOfferID { get; set; } internal ulong TradeOfferID { get; set; }
// ReSharper disable once UnusedMember.Local [JsonProperty(PropertyName = "tradeofferid", Required = Required.Always), SuppressMessage("ReSharper", "UnusedMember.Local")]
[JsonProperty(PropertyName = "tradeofferid", Required = Required.Always)]
private string TradeOfferIDString { private string TradeOfferIDString {
get { get {
return TradeOfferID.ToString(); return TradeOfferID.ToString();

View File

@@ -24,6 +24,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@@ -104,17 +105,16 @@ namespace ArchiSteamFarm {
Log("[*] INFO: " + previousMethodName + "() <" + botName + "> " + message); Log("[*] INFO: " + previousMethodName + "() <" + botName + "> " + message);
} }
[SuppressMessage("ReSharper", "ExplicitCallerInfoArgument")]
internal static void LogNullError(string nullObjectName, string botName = "Main", [CallerMemberName] string previousMethodName = null) { internal static void LogNullError(string nullObjectName, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
if (string.IsNullOrEmpty(nullObjectName)) { if (string.IsNullOrEmpty(nullObjectName)) {
return; return;
} }
// ReSharper disable once ExplicitCallerInfoArgument
LogGenericError(nullObjectName + " is null!", botName, previousMethodName); LogGenericError(nullObjectName + " is null!", botName, previousMethodName);
} }
// ReSharper disable once UnusedMember.Global [Conditional("DEBUG"), SuppressMessage("ReSharper", "UnusedMember.Global")]
[Conditional("DEBUG")]
internal static void LogGenericDebug(string message, string botName = "Main", [CallerMemberName] string previousMethodName = null) { internal static void LogGenericDebug(string message, string botName = "Main", [CallerMemberName] string previousMethodName = null) {
if (string.IsNullOrEmpty(message)) { if (string.IsNullOrEmpty(message)) {
return; return;

View File

@@ -24,13 +24,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ArchiSteamFarm { namespace ArchiSteamFarm {
internal static class Utilities { internal static class Utilities {
// ReSharper disable once UnusedParameter.Global [SuppressMessage("ReSharper", "UnusedParameter.Global")]
internal static void Forget(this Task task) { } internal static void Forget(this Task task) { }
internal static Task ForEachAsync<T>(this IEnumerable<T> sequence, Func<T, Task> action) => action == null ? Task.FromResult(true) : Task.WhenAll(sequence.Select(action)); internal static Task ForEachAsync<T>(this IEnumerable<T> sequence, Func<T, Task> action) => action == null ? Task.FromResult(true) : Task.WhenAll(sequence.Select(action));

View File

@@ -130,8 +130,7 @@ namespace ConfigGenerator {
return botConfig; return botConfig;
} }
// This constructor is used only by deserializer [SuppressMessage("ReSharper", "UnusedMember.Local")]
// ReSharper disable once UnusedMember.Local
private BotConfig() { } private BotConfig() { }
private BotConfig(string filePath) : base(filePath) { private BotConfig(string filePath) : base(filePath) {

View File

@@ -22,13 +22,15 @@
*/ */
using System.Diagnostics.CodeAnalysis;
namespace ConfigGenerator { namespace ConfigGenerator {
internal static class Debugging { internal static class Debugging {
#if DEBUG #if DEBUG
// ReSharper disable once ConvertToConstant.Global [SuppressMessage("ReSharper", "ConvertToConstant.Global")]
internal static readonly bool IsDebugBuild = true; internal static readonly bool IsDebugBuild = true;
#else #else
// ReSharper disable once ConvertToConstant.Global [SuppressMessage("ReSharper", "ConvertToConstant.Global")]
internal static readonly bool IsDebugBuild = false; internal static readonly bool IsDebugBuild = false;
#endif #endif
} }

View File

@@ -173,7 +173,7 @@ namespace ConfigGenerator {
return globalConfig; return globalConfig;
} }
// ReSharper disable once UnusedMember.Local [SuppressMessage("ReSharper", "UnusedMember.Local")]
private GlobalConfig() { } private GlobalConfig() { }
private GlobalConfig(string filePath) : base(filePath) { private GlobalConfig(string filePath) : base(filePath) {

View File

@@ -37,7 +37,7 @@ namespace ConfigGenerator {
MessageBox.Show(message, Resources.Information, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(message, Resources.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
internal static void LogGenericError(string message, [CallerMemberName] string previousMethodName = "") { internal static void LogGenericError(string message, [CallerMemberName] string previousMethodName = null) {
if (string.IsNullOrEmpty(message)) { if (string.IsNullOrEmpty(message)) {
return; return;
} }
@@ -45,7 +45,7 @@ namespace ConfigGenerator {
MessageBox.Show(previousMethodName + @"() " + message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(previousMethodName + @"() " + message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
internal static void LogGenericException(Exception exception, [CallerMemberName] string previousMethodName = "") { internal static void LogGenericException(Exception exception, [CallerMemberName] string previousMethodName = null) {
while (true) { while (true) {
if (exception == null) { if (exception == null) {
return; return;
@@ -62,7 +62,7 @@ namespace ConfigGenerator {
} }
} }
internal static void LogGenericWarning(string message, [CallerMemberName] string previousMethodName = "") { internal static void LogGenericWarning(string message, [CallerMemberName] string previousMethodName = null) {
if (string.IsNullOrEmpty(message)) { if (string.IsNullOrEmpty(message)) {
return; return;
} }