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 System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
@@ -1494,7 +1495,7 @@ namespace ArchiSteamFarm {
SteamClient.Connect();
}
// ReSharper disable once MemberCanBeMadeStatic.Local
[SuppressMessage("ReSharper", "MemberCanBeMadeStatic.Local")]
private void OnFreeLicense(SteamApps.FreeLicenseCallback 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 async void OnNotifications(ArchiHandler.NotificationsCallback callback) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,13 +24,14 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace ArchiSteamFarm {
internal static class Utilities {
// ReSharper disable once UnusedParameter.Global
[SuppressMessage("ReSharper", "UnusedParameter.Global")]
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));

View File

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

View File

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

View File

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

View File

@@ -37,7 +37,7 @@ namespace ConfigGenerator {
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)) {
return;
}
@@ -45,7 +45,7 @@ namespace ConfigGenerator {
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) {
if (exception == null) {
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)) {
return;
}