Skip to content

Commit

Permalink
analizators/U2U1022
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhorukovAnton committed Jan 19, 2022
1 parent a30b276 commit 20b6095
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 39 deletions.
5 changes: 3 additions & 2 deletions common/ASC.Core.Common/Caching/CachedTenantService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ public byte[] GetTenantSettings(int tenant, string key)
var data = cache.Get<byte[]>(cacheKey);
if (data == null)
{
data = Service.GetTenantSettings(tenant, key);
cache.Insert(cacheKey, data ?? new byte[0], DateTime.UtcNow + SettingsExpiration);
data = Service.GetTenantSettings(tenant, key);

cache.Insert(cacheKey, data ?? Array.Empty<byte>(), DateTime.UtcNow + SettingsExpiration);
}
return data == null ? null : data.Length == 0 ? null : data;
}
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Context/Impl/SubscriptionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public string[] GetSubscriptionMethod(string sourceID, string actionID, string r
m = methods.FirstOrDefault();
}

return m != null ? m.Methods : new string[0];
return m != null ? m.Methods : Array.Empty<string>();
}

public string[] GetRecipients(string sourceID, string actionID, string objectID)
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Core/UserInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public CultureInfo GetCulture()

string[] IDirectRecipient.Addresses
{
get { return !string.IsNullOrEmpty(Email) ? new[] { Email } : new string[0]; }
get { return !string.IsNullOrEmpty(Email) ? new[] { Email } : Array.Empty<string>(); }
}

public bool CheckActivation
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Data/DbUserService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public byte[] GetUserPhoto(int tenant, Guid id)
.Select(r => r.Photo)
.FirstOrDefault();

return photo ?? new byte[0];
return photo ?? Array.Empty<byte>();
}

public IEnumerable<UserInfo> GetUsers(int tenant)
Expand Down
6 changes: 3 additions & 3 deletions common/ASC.Core.Common/Notify/Engine/NotifyEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ private void PrepareRequestFillSenders(NotifyRequest request, IServiceScope serv
var subscriptionProvider = request.GetSubscriptionProvider(serviceScope);

var senderNames = new List<string>();
senderNames.AddRange(subscriptionProvider.GetSubscriptionMethod(request.NotifyAction, request.Recipient) ?? new string[0]);
senderNames.AddRange(subscriptionProvider.GetSubscriptionMethod(request.NotifyAction, request.Recipient) ?? Array.Empty<string>());
senderNames.AddRange(request.Arguments.OfType<AdditionalSenderTag>().Select(tag => (string)tag.Value));

request.SenderNames = senderNames.ToArray();
Expand Down Expand Up @@ -554,12 +554,12 @@ private void PrepareRequestFillTags(NotifyRequest request, IServiceScope service
{
throw new NotifyException(string.Format("For pattern \"{0}\" formatter not instanced.", pattern), exc);
}
var tags = new string[0];
var tags = Array.Empty<string>();
try
{
if (formatter != null)
{
tags = formatter.GetTags(pattern) ?? new string[0];
tags = formatter.GetTags(pattern) ?? Array.Empty<string>();
}
}
catch (Exception exc)
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Notify/Patterns/PatternFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected virtual void AfterFormat(INoticeMessage message)

protected virtual string[] SearchTags(string text)
{
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(tagSearchPattern)) return new string[0];
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(tagSearchPattern)) return Array.Empty<string>();

var maches = RegEx.Matches(text);
var findedTags = new List<string>(maches.Count);
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Notify/RecipientProviderImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public virtual string[] GetRecipientAddresses(IDirectRecipient recipient, string
if (senderName == ASC.Core.Configuration.Constants.NotifyTelegramSenderSysName) return new[] { user.ID.ToString() };
}
}
return new string[0];
return Array.Empty<string>();
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions common/ASC.Core.Common/Notify/TopSubscriptionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace ASC.Notify.Model
{
public class TopSubscriptionProvider : ISubscriptionProvider
{
private readonly string[] defaultSenderMethods = new string[0];
private readonly string[] defaultSenderMethods = Array.Empty<string>();
private readonly ISubscriptionProvider subscriptionProvider;
private readonly IRecipientProvider recipientProvider;

Expand Down Expand Up @@ -165,12 +165,12 @@ public virtual string[] GetSubscriptions(INotifyAction action, IRecipient recipi
if (action == null) throw new ArgumentNullException("action");

var objects = new List<string>();
var direct = subscriptionProvider.GetSubscriptions(action, recipient, checkSubscription) ?? new string[0];
var direct = subscriptionProvider.GetSubscriptions(action, recipient, checkSubscription) ?? Array.Empty<string>();
MergeObjects(objects, direct);
var parents = WalkUp(recipient);
foreach (var parent in parents)
{
direct = subscriptionProvider.GetSubscriptions(action, parent, checkSubscription) ?? new string[0];
direct = subscriptionProvider.GetSubscriptions(action, parent, checkSubscription) ?? Array.Empty<string>();
if (recipient is IDirectRecipient)
{
foreach (var groupsubscr in direct)
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Tenants/TenantQuota.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public bool GetFeature(string feature)
internal void SetFeature(string feature, bool set)
{
var features = (Features == null
? new string[] { }
? Array.Empty<string>()
: Features.Split(' ', ',', ';')).ToList();
if (set && !features.Contains(feature))
{
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Data.Storage/DiscStorage/DiscDataStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public override string[] ListDirectoriesRelative(string domain, string path, boo
entries,
x => x.Substring(targetDir.Length));
}
return new string[0];
return Array.Empty<string>();
}

public override string[] ListFilesRelative(string domain, string path, string pattern, bool recursive)
Expand All @@ -560,7 +560,7 @@ public override string[] ListFilesRelative(string domain, string path, string pa
entries,
x => x.Substring(targetDir.Length));
}
return new string[0];
return Array.Empty<string>();
}

public override bool IsFile(string domain, string path)
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Data.Storage/StorageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public Task Invoke(HttpContext context)
return Task.CompletedTask;
}

var headers = header.Length > 0 ? header.Split('&').Select(HttpUtility.UrlDecode) : new string[] { };
var headers = header.Length > 0 ? header.Split('&').Select(HttpUtility.UrlDecode) : Array.Empty<string>();

if (storage.IsSupportInternalUri)
{
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.IPSecurity/IPSecurity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public bool Verify()
}

var ips = string.IsNullOrWhiteSpace(requestIps)
? new string[] { }
? Array.Empty<string>()
: requestIps.Split(new[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries);

if (ips.Any(requestIp => restrictions.Any(restriction => MatchIPs(GetIpWithoutPort(requestIp), restriction.Ip))))
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.MessagingSystem/MessagePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public MessagePolicy(IConfiguration configuration)
{
secretIps =
configuration["messaging.secret-ips"] == null
? new string[] { }
? Array.Empty<string>()
: configuration["messaging.secret-ips"].Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public SharpBoxStorageDisposableWrapper()

internal CloudStorage CreateStorage(AuthData _authData, nSupportedCloudConfigurations _providerKey)
{
var prms = new object[] { };
var prms = Array.Empty<object>();
if (!string.IsNullOrEmpty(_authData.Url))
{
var uri = _authData.Url;
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Helpers/ThirdpartyConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public List<string> ThirdPartyProviders
{
get
{
return thirdPartyProviders ??= (Configuration.GetSection("files:thirdparty:enable").Get<string[]>() ?? new string[] { }).ToList();
return thirdPartyProviders ??= (Configuration.GetSection("files:thirdparty:enable").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}
public ThirdpartyConfigurationData(IConfiguration configuration)
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Services/FFmpegService/FFmpeg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public FFmpegService(IOptionsMonitor<ILog> optionsMonitor, IConfiguration config
FFmpegPath = configuration["files:ffmpeg:value"];
FFmpegArgs = configuration["files:ffmpeg:args"] ?? "-i - -preset ultrafast -movflags frag_keyframe+empty_moov -f {0} -";

ConvertableMedia = (configuration.GetSection("files:ffmpeg:exts").Get<string[]>() ?? new string[] { }).ToList();
ConvertableMedia = (configuration.GetSection("files:ffmpeg:exts").Get<string[]>() ?? Array.Empty<string>()).ToList();

if (string.IsNullOrEmpty(FFmpegPath))
{
Expand Down
26 changes: 13 additions & 13 deletions web/ASC.Web.Core/Files/FileUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ public FileUtilityConfiguration(IConfiguration configuration)
}

private List<string> extsIndexing;
public List<string> ExtsIndexing { get => extsIndexing ??= (Configuration.GetSection("files:index").Get<string[]>() ?? new string[] { }).ToList(); }
public List<string> ExtsIndexing { get => extsIndexing ??= (Configuration.GetSection("files:index").Get<string[]>() ?? Array.Empty<string>()).ToList(); }

private List<string> extsImagePreviewed;
public List<string> ExtsImagePreviewed { get => extsImagePreviewed ??= (Configuration.GetSection("files:viewed-images").Get<string[]>() ?? new string[] { }).ToList(); }
public List<string> ExtsImagePreviewed { get => extsImagePreviewed ??= (Configuration.GetSection("files:viewed-images").Get<string[]>() ?? Array.Empty<string>()).ToList(); }

private List<string> extsMediaPreviewed;
public List<string> ExtsMediaPreviewed { get => extsMediaPreviewed ??= (Configuration.GetSection("files:viewed-media").Get<string[]>() ?? new string[] { }).ToList(); }
public List<string> ExtsMediaPreviewed { get => extsMediaPreviewed ??= (Configuration.GetSection("files:viewed-media").Get<string[]>() ?? Array.Empty<string>()).ToList(); }

private List<string> extsWebPreviewed;
public List<string> ExtsWebPreviewed
{
get
{
return extsWebPreviewed ??= (Configuration.GetSection("files:docservice:viewed-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsWebPreviewed ??= (Configuration.GetSection("files:docservice:viewed-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

Expand All @@ -71,19 +71,19 @@ public List<string> ExtsWebEdited
{
get
{
return extsWebEdited ??= (Configuration.GetSection("files:docservice:edited-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsWebEdited ??= (Configuration.GetSection("files:docservice:edited-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

private List<string> extsWebEncrypt;
public List<string> ExtsWebEncrypt { get => extsWebEncrypt ??= (Configuration.GetSection("files:docservice:encrypted-docs").Get<string[]>() ?? new string[] { }).ToList(); }
public List<string> ExtsWebEncrypt { get => extsWebEncrypt ??= (Configuration.GetSection("files:docservice:encrypted-docs").Get<string[]>() ?? Array.Empty<string>()).ToList(); }

private List<string> extsWebReviewed;
public List<string> ExtsWebReviewed
{
get
{
return extsWebReviewed ??= (Configuration.GetSection("files:docservice:reviewed-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsWebReviewed ??= (Configuration.GetSection("files:docservice:reviewed-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

Expand All @@ -92,7 +92,7 @@ public List<string> ExtsWebCustomFilterEditing
{
get
{
return extsWebCustomFilterEditing ??= (Configuration.GetSection("files:docservice:customfilter-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsWebCustomFilterEditing ??= (Configuration.GetSection("files:docservice:customfilter-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

Expand All @@ -101,7 +101,7 @@ public List<string> ExtsWebRestrictedEditing
{
get
{
return extsWebRestrictedEditing ??= (Configuration.GetSection("files:docservice:formfilling-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsWebRestrictedEditing ??= (Configuration.GetSection("files:docservice:formfilling-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

Expand All @@ -110,7 +110,7 @@ public List<string> ExtsWebCommented
{
get
{
return extsWebCommented ??= (Configuration.GetSection("files:docservice:commented-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsWebCommented ??= (Configuration.GetSection("files:docservice:commented-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

Expand All @@ -119,7 +119,7 @@ public List<string> ExtsWebTemplate
{
get
{
return extsWebTemplate ??= (Configuration.GetSection("files:docservice:template-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsWebTemplate ??= (Configuration.GetSection("files:docservice:template-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

Expand All @@ -128,14 +128,14 @@ public List<string> ExtsMustConvert
{
get
{
return extsMustConvert ??= (Configuration.GetSection("files:docservice:convert-docs").Get<string[]>() ?? new string[] { }).ToList();
return extsMustConvert ??= (Configuration.GetSection("files:docservice:convert-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}
}

private List<string> extsCoAuthoring;
public List<string> ExtsCoAuthoring
{
get => extsCoAuthoring ??= (Configuration.GetSection("files:docservice:coauthor-docs").Get<string[]>() ?? new string[] { }).ToList();
get => extsCoAuthoring ??= (Configuration.GetSection("files:docservice:coauthor-docs").Get<string[]>() ?? Array.Empty<string>()).ToList();
}

public Dictionary<FileType, string> InternalExtension
Expand Down
6 changes: 3 additions & 3 deletions web/ASC.Web.Core/Notify/StudioWhatsNewNotify.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void SendMsgWhatsNew(DateTime scheduleDate)
UserAbsoluteURL = f.Author != null && f.Author.UserInfo != null ? commonLinkUtility.GetFullAbsolutePath(f.Author.UserInfo.GetUserProfilePageURL(commonLinkUtility)) : string.Empty,
Title = HtmlUtil.GetText(f.Title, 512),
URL = commonLinkUtility.GetFullAbsolutePath(f.ItemUrl),
BreadCrumbs = new string[0],
BreadCrumbs = Array.Empty<string>(),
Action = GetWhatsNewActionText(f)
}).ToList());

Expand All @@ -165,7 +165,7 @@ public void SendMsgWhatsNew(DateTime scheduleDate)
UserAbsoluteURL = prawbc.Author != null && prawbc.Author.UserInfo != null ? commonLinkUtility.GetFullAbsolutePath(prawbc.Author.UserInfo.GetUserProfilePageURL(commonLinkUtility)) : string.Empty,
Title = HtmlUtil.GetText(prawbc.Title, 512),
URL = commonLinkUtility.GetFullAbsolutePath(prawbc.ItemUrl),
BreadCrumbs = new string[0],
BreadCrumbs = Array.Empty<string>(),
Action = GetWhatsNewActionText(prawbc)
});
}
Expand All @@ -185,7 +185,7 @@ public void SendMsgWhatsNew(DateTime scheduleDate)
UserAbsoluteURL = ls.Author != null && ls.Author.UserInfo != null ? commonLinkUtility.GetFullAbsolutePath(ls.Author.UserInfo.GetUserProfilePageURL(commonLinkUtility)) : string.Empty,
Title = HtmlUtil.GetText(ls.Title, 512),
URL = commonLinkUtility.GetFullAbsolutePath(ls.ItemUrl),
BreadCrumbs = i == 0 ? new string[1] { gr.Key } : new string[0],
BreadCrumbs = i == 0 ? new string[1] { gr.Key } : Array.Empty<string>(),
Action = GetWhatsNewActionText(ls)
});
}
Expand Down
2 changes: 1 addition & 1 deletion web/ASC.Web.Core/Users/Import/TextFileUserImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private UserInfo GetExportedUser(string line, IDictionary<int, PropertyInfo> map
var value = ConvertFromString(dataFields[j], propinfo.PropertyType);
if (value != null)
{
propinfo.SetValue(exportedUser, value, new object[] { });
propinfo.SetValue(exportedUser, value, Array.Empty<object>());
}
}
}
Expand Down

0 comments on commit 20b6095

Please sign in to comment.