Skip to content

Commit

Permalink
analizators/ca1507
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhorukovAnton committed Jan 24, 2022
1 parent 0fcac47 commit fce8d26
Show file tree
Hide file tree
Showing 110 changed files with 315 additions and 315 deletions.
2 changes: 1 addition & 1 deletion common/ASC.Api.Core/Core/ApiDateTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static ApiDateTime Parse(string data, TenantManager tenantManager, TimeZo

public static ApiDateTime Parse(string data, TimeZoneInfo tz, TenantManager tenantManager, TimeZoneConverter timeZoneConverter)
{
if (string.IsNullOrEmpty(data)) throw new ArgumentNullException("data");
if (string.IsNullOrEmpty(data)) throw new ArgumentNullException(nameof(data));

if (data.Length < 7) throw new ArgumentException("invalid date time format");

Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Common/Data/StreamExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public static class StreamExtension

public static void StreamCopyTo(this Stream srcStream, Stream dstStream, int length)
{
if (srcStream == null) throw new ArgumentNullException("srcStream");
if (dstStream == null) throw new ArgumentNullException("dstStream");
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
if (dstStream == null) throw new ArgumentNullException(nameof(dstStream));

var buffer = new byte[BufferSize];
int totalRead = 0;
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Common/Data/TempStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public TempStream(TempPath tempPath)

public Stream GetBuffered(Stream srcStream)
{
if (srcStream == null) throw new ArgumentNullException("srcStream");
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
if (!srcStream.CanSeek || srcStream.CanTimeout)
{
//Buffer it
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Billing/BillingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public IEnumerable<PaymentInfo> GetPayments(string portalId)
{
if (productIds == null)
{
throw new ArgumentNullException("productIds");
throw new ArgumentNullException(nameof(productIds));
}

var parameters = productIds.Select(pid => Tuple.Create("ProductId", pid)).ToList();
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Billing/License/LicenseReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public DateTime SaveLicenseTemp(Stream licenseStream)

private static void SaveLicense(Stream licenseStream, string path)
{
if (licenseStream == null) throw new ArgumentNullException("licenseStream");
if (licenseStream == null) throw new ArgumentNullException(nameof(licenseStream));

if (licenseStream.CanSeek)
{
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Billing/TariffService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public void SetTariff(int tenantId, Tariff tariff)
{
if (tariff == null)
{
throw new ArgumentNullException("tariff");
throw new ArgumentNullException(nameof(tariff));
}

var q = QuotaService.GetTenantQuota(tariff.QuotaId);
Expand Down Expand Up @@ -432,7 +432,7 @@ public Uri GetShoppingUri(int? tenant, int quotaId, string affiliateId, string c
{
if (productIds == null)
{
throw new ArgumentNullException("productIds");
throw new ArgumentNullException(nameof(productIds));
}
try
{
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Caching/CachedAzService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CachedAzService : IAzService

public CachedAzService(DbAzService service, AzServiceCache azServiceCache)
{
this.service = service ?? throw new ArgumentNullException("service");
this.service = service ?? throw new ArgumentNullException(nameof(service));
Cache = azServiceCache.Cache;
cacheNotify = azServiceCache.CacheNotify;
CacheExpiration = TimeSpan.FromMinutes(10);
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Caching/CachedQuotaService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public CachedQuotaService()

public CachedQuotaService(DbQuotaService service, QuotaServiceCache quotaServiceCache) : this()
{
Service = service ?? throw new ArgumentNullException("service");
Service = service ?? throw new ArgumentNullException(nameof(service));
QuotaServiceCache = quotaServiceCache;
Cache = quotaServiceCache.Cache;
CacheNotify = quotaServiceCache.CacheNotify;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CachedSubscriptionService : ISubscriptionService

public CachedSubscriptionService(DbSubscriptionService service, SubscriptionServiceCache subscriptionServiceCache)
{
this.service = service ?? throw new ArgumentNullException("service");
this.service = service ?? throw new ArgumentNullException(nameof(service));
cache = subscriptionServiceCache.Cache;
notifyRecord = subscriptionServiceCache.NotifyRecord;
notifyMethod = subscriptionServiceCache.NotifyMethod;
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Caching/CachedTenantService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public CachedTenantService()
public CachedTenantService(DbTenantService service, TenantServiceCache tenantServiceCache, ICache cache) : this()
{
this.cache = cache;
Service = service ?? throw new ArgumentNullException("service");
Service = service ?? throw new ArgumentNullException(nameof(service));
TenantServiceCache = tenantServiceCache;
CacheNotifyItem = tenantServiceCache.CacheNotifyItem;
CacheNotifySettings = tenantServiceCache.CacheNotifySettings;
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Caching/CachedUserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public CachedUserService()
UserServiceCache userServiceCache
) : this()
{
Service = service ?? throw new ArgumentNullException("service");
Service = service ?? throw new ArgumentNullException(nameof(service));
CoreBaseSettings = coreBaseSettings;
UserServiceCache = userServiceCache;
Cache = userServiceCache.Cache;
Expand Down
10 changes: 5 additions & 5 deletions common/ASC.Core.Common/Configuration/SmtpSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ public SmtpSettings(string host, int port, string senderAddress, string senderDi
{
if (string.IsNullOrEmpty(host))
{
throw new ArgumentException("Empty smtp host.", "host");
throw new ArgumentException("Empty smtp host.", nameof(host));
}
if (string.IsNullOrEmpty(senderAddress))
{
throw new ArgumentException("Empty sender address.", "senderAddress");
throw new ArgumentException("Empty sender address.", nameof(senderAddress));
}

Host = host;
Port = port;
SenderAddress = senderAddress;
SenderDisplayName = senderDisplayName ?? throw new ArgumentNullException("senderDisplayName");
SenderDisplayName = senderDisplayName ?? throw new ArgumentNullException(nameof(senderDisplayName));
}

public void SetCredentials(string userName, string password)
Expand All @@ -105,11 +105,11 @@ public void SetCredentials(string userName, string password, string domain)
{
if (string.IsNullOrEmpty(userName))
{
throw new ArgumentException("Empty user name.", "userName");
throw new ArgumentException("Empty user name.", nameof(userName));
}
if (string.IsNullOrEmpty(password))
{
throw new ArgumentException("Empty password.", "password");
throw new ArgumentException("Empty password.", nameof(password));
}
CredentialsUserName = userName;
CredentialsUserPassword = password;
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Context/Impl/CoreConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void SaveSetting(string key, string value, int tenant = Tenant.DEFAULT_TE
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("key");
throw new ArgumentNullException(nameof(key));
}
byte[] bytes = null;
if (value != null)
Expand All @@ -193,7 +193,7 @@ public string GetSetting(string key, int tenant = Tenant.DEFAULT_TENANT)
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("key");
throw new ArgumentNullException(nameof(key));
}
var bytes = TenantService.GetTenantSettings(tenant, key);

Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Context/Impl/PaymentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void ActivateKey(string key)
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentNullException("key");
throw new ArgumentNullException(nameof(key));
}

var now = DateTime.UtcNow;
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Context/Impl/TenantManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public Tenant GetTenant(string domain)

public Tenant SetTenantVersion(Tenant tenant, int version)
{
if (tenant == null) throw new ArgumentNullException("tenant");
if (tenant == null) throw new ArgumentNullException(nameof(tenant));
if (tenant.Version != version)
{
tenant.Version = version;
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Context/SecurityContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ IOptionsMonitor<ILog> options

public string AuthenticateMe(string login, string passwordHash)
{
if (login == null) throw new ArgumentNullException("login");
if (passwordHash == null) throw new ArgumentNullException("passwordHash");
if (login == null) throw new ArgumentNullException(nameof(login));
if (passwordHash == null) throw new ArgumentNullException(nameof(passwordHash));

var tenantid = TenantManager.GetCurrentTenant().TenantId;
var u = UserManager.GetUsersByPasswordHash(tenantid, login, passwordHash);
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Core/DBResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ class DBResourceSet : ResourceSet
{
if (culture == null)
{
throw new ArgumentNullException("culture");
throw new ArgumentNullException(nameof(culture));
}
if (string.IsNullOrEmpty(filename))
{
throw new ArgumentNullException("filename");
throw new ArgumentNullException(nameof(filename));
}

DbContext = dbContext;
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Data/DbQuotaService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public TenantQuota GetTenantQuota(int id)

public TenantQuota SaveTenantQuota(TenantQuota quota)
{
if (quota == null) throw new ArgumentNullException("quota");
if (quota == null) throw new ArgumentNullException(nameof(quota));

var dbQuota = new DbQuota
{
Expand Down Expand Up @@ -155,7 +155,7 @@ public void RemoveTenantQuota(int id)

public void SetTenantQuotaRow(TenantQuotaRow row, bool exchange)
{
if (row == null) throw new ArgumentNullException("row");
if (row == null) throw new ArgumentNullException(nameof(row));

using var tx = CoreDbContext.Database.BeginTransaction();

Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Data/DbSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private Guid CurrentUserID

public bool SaveSettingsFor<T>(T settings, int tenantId, Guid userId) where T : ISettings
{
if (settings == null) throw new ArgumentNullException("settings");
if (settings == null) throw new ArgumentNullException(nameof(settings));
try
{
var key = settings.ID.ToString() + tenantId + userId;
Expand Down
38 changes: 19 additions & 19 deletions common/ASC.Core.Common/Data/DbSubscriptionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public DbSubscriptionService(DbContextManager<UserDbContext> dbContextManager)

public string[] GetRecipients(int tenant, string sourceId, string actionId, string objectId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));

var q = GetQuery(tenant, sourceId, actionId)
.Where(r => r.Object == (objectId ?? string.Empty))
Expand All @@ -83,8 +83,8 @@ public string[] GetRecipients(int tenant, string sourceId, string actionId, stri

public IEnumerable<SubscriptionRecord> GetSubscriptions(int tenant, string sourceId, string actionId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));

var q = GetQuery(tenant, sourceId, actionId);
return GetSubscriptions(q, tenant);
Expand All @@ -108,7 +108,7 @@ public IEnumerable<SubscriptionRecord> GetSubscriptions(int tenant, string sourc

public SubscriptionRecord GetSubscription(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (recipientId == null) throw new ArgumentNullException(nameof(recipientId));

var q = GetQuery(tenant, sourceId, actionId)
.Where(r => r.Recipient == recipientId)
Expand All @@ -119,9 +119,9 @@ public SubscriptionRecord GetSubscription(int tenant, string sourceId, string ac

public bool IsUnsubscribe(int tenant, string sourceId, string actionId, string recipientId, string objectId)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (recipientId == null) throw new ArgumentNullException(nameof(recipientId));
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));

var q = UserDbContext.Subscriptions
.Where(r => r.Source == sourceId &&
Expand All @@ -144,9 +144,9 @@ public bool IsUnsubscribe(int tenant, string sourceId, string actionId, string r

public string[] GetSubscriptions(int tenant, string sourceId, string actionId, string recipientId, bool checkSubscribe)
{
if (recipientId == null) throw new ArgumentNullException("recipientId");
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (recipientId == null) throw new ArgumentNullException(nameof(recipientId));
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));

var q = GetQuery(tenant, sourceId, actionId)
.Where(r=> r.Recipient == recipientId)
Expand All @@ -163,7 +163,7 @@ public string[] GetSubscriptions(int tenant, string sourceId, string actionId, s

public void SaveSubscription(SubscriptionRecord s)
{
if (s == null) throw new ArgumentNullException("s");
if (s == null) throw new ArgumentNullException(nameof(s));

var subs = new Subscription
{
Expand All @@ -186,8 +186,8 @@ public void RemoveSubscriptions(int tenant, string sourceId, string actionId)

public void RemoveSubscriptions(int tenant, string sourceId, string actionId, string objectId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));

using var tr = UserDbContext.Database.BeginTransaction();
var q = UserDbContext.Subscriptions
Expand All @@ -213,8 +213,8 @@ public void RemoveSubscriptions(int tenant, string sourceId, string actionId, st

public IEnumerable<SubscriptionMethod> GetSubscriptionMethods(int tenant, string sourceId, string actionId, string recipientId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));

var q = UserDbContext.SubscriptionMethods
.Where(r => r.Tenant == -1 || r.Tenant == tenant)
Expand Down Expand Up @@ -258,7 +258,7 @@ public IEnumerable<SubscriptionMethod> GetSubscriptionMethods(int tenant, string

public void SetSubscriptionMethod(SubscriptionMethod m)
{
if (m == null) throw new ArgumentNullException("m");
if (m == null) throw new ArgumentNullException(nameof(m));

using var tr = UserDbContext.Database.BeginTransaction();

Expand Down Expand Up @@ -297,8 +297,8 @@ public void SetSubscriptionMethod(SubscriptionMethod m)

private IQueryable<Subscription> GetQuery(int tenant, string sourceId, string actionId)
{
if (sourceId == null) throw new ArgumentNullException("sourceId");
if (actionId == null) throw new ArgumentNullException("actionId");
if (sourceId == null) throw new ArgumentNullException(nameof(sourceId));
if (actionId == null) throw new ArgumentNullException(nameof(actionId));

return
UserDbContext.Subscriptions
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Data/DbTenantService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public IEnumerable<Tenant> GetTenants(DateTime from, bool active = true)

public IEnumerable<Tenant> GetTenants(string login, string passwordHash)
{
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException("login");
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException(nameof(login));

IQueryable<TenantUserSecurity> query() => TenantsQuery()
.Where(r => r.Status == TenantStatus.Active)
Expand Down Expand Up @@ -245,7 +245,7 @@ public Tenant GetTenant(int id)

public Tenant GetTenant(string domain)
{
if (string.IsNullOrEmpty(domain)) throw new ArgumentNullException("domain");
if (string.IsNullOrEmpty(domain)) throw new ArgumentNullException(nameof(domain));

domain = domain.ToLowerInvariant();

Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Data/DbUserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public UserInfo GetUserByUserName(int tenant, string userName)

public UserInfo GetUserByPasswordHash(int tenant, string login, string passwordHash)
{
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException("login");
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException(nameof(login));

if (Guid.TryParse(login, out var userId))
{
Expand Down Expand Up @@ -548,7 +548,7 @@ public Group SaveGroup(int tenant, Group group)

public UserInfo SaveUser(int tenant, UserInfo user)
{
if (user == null) throw new ArgumentNullException("user");
if (user == null) throw new ArgumentNullException(nameof(user));
if (string.IsNullOrEmpty(user.UserName)) throw new ArgumentOutOfRangeException("Empty username.");

if (user.ID == default) user.ID = Guid.NewGuid();
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Encryption/EncryptionSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ public string GeneratePassword(int length, int numberOfNonAlphanumericCharacters

if (length < 1 || length > 128)
{
throw new ArgumentException("password_length_incorrect", "length");
throw new ArgumentException("password_length_incorrect", nameof(length));
}

if (numberOfNonAlphanumericCharacters > length || numberOfNonAlphanumericCharacters < 0)
{
throw new ArgumentException("min_required_non_alphanumeric_characters_incorrect", "numberOfNonAlphanumericCharacters");
throw new ArgumentException("min_required_non_alphanumeric_characters_incorrect", nameof(numberOfNonAlphanumericCharacters));
}

var array2 = new char[length];
Expand Down

0 comments on commit fce8d26

Please sign in to comment.