Skip to content

Commit

Permalink
analizators/s1104
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhorukovAnton committed Jan 21, 2022
1 parent bf3b039 commit 728c1b8
Show file tree
Hide file tree
Showing 21 changed files with 66 additions and 70 deletions.
4 changes: 2 additions & 2 deletions common/ASC.Api.Core/Core/ApiContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class ApiContext : ICloneable
{
private static int MaxCount = 1000;
public IHttpContextAccessor HttpContextAccessor { get; set; }
public Tenant tenant;
public Tenant Tenant { get { return tenant ??= TenantManager.GetCurrentTenant(HttpContextAccessor?.HttpContext); } }
private Tenant _tenant;
public Tenant Tenant { get { return _tenant ??= TenantManager.GetCurrentTenant(HttpContextAccessor?.HttpContext); } }

public ApiContext(IHttpContextAccessor httpContextAccessor, SecurityContext securityContext, TenantManager tenantManager)
{
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Core/DBResourceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public class WhiteLabelHelper
{
private readonly ILog log;
private readonly ConcurrentDictionary<int, string> whiteLabelDictionary;
public string DefaultLogoText;
public string DefaultLogoText { get; }

private IConfiguration Configuration { get; }

Expand Down
1 change: 0 additions & 1 deletion common/ASC.Core.Common/EF/Context/BaseDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public enum Provider

public class BaseDbContext : DbContext
{
public string baseName;
public BaseDbContext() { }
public BaseDbContext(DbContextOptions options) : base(options)
{
Expand Down
6 changes: 3 additions & 3 deletions common/ASC.Core.Common/EF/Context/ConfigureDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void Configure(T context)

public class ConfigureMultiRegionalDbContext<T> : IConfigureNamedOptions<MultiRegionalDbContext<T>> where T : BaseDbContext, new()
{
public string baseName = "default";
private readonly string _baseName = "default";
private ConfigurationExtension Configuration { get; }
private DbContextManager<T> DbContext { get; }

Expand All @@ -57,7 +57,7 @@ public void Configure(string name, MultiRegionalDbContext<T> context)

foreach (var c in Configuration.GetConnectionStrings().Where(r =>
r.Name.Equals(name, cmp) || r.Name.StartsWith(name + ".", cmp) ||
r.Name.Equals(baseName, cmp) || r.Name.StartsWith(baseName + ".", cmp)
r.Name.Equals(_baseName, cmp) || r.Name.StartsWith(_baseName + ".", cmp)
))
{
context.Context.Add(DbContext.Get(c.Name));
Expand All @@ -66,7 +66,7 @@ public void Configure(string name, MultiRegionalDbContext<T> context)

public void Configure(MultiRegionalDbContext<T> context)
{
Configure(baseName, context);
Configure(_baseName, context);
}
}
}
26 changes: 13 additions & 13 deletions common/ASC.Core.Common/Notify/Cron/CronExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ protected virtual int StoreExpressionVals(int pos, string s, int type)
if (c >= '0' && c <= '9')
{
var vs = GetValue(val, s, i);
val = vs.theValue;
i = vs.pos;
val = vs.TheValue;
i = vs.Pos;
}
i = CheckNext(i, s, val, type);
return i;
Expand Down Expand Up @@ -665,9 +665,9 @@ protected virtual int CheckNext(int pos, string s, int val, int type)
if (c >= '0' && c <= '9')
{
var vs = GetValue(v, s, i);
var v1 = vs.theValue;
var v1 = vs.TheValue;
end = v1;
i = vs.pos;
i = vs.Pos;
}
if (i < s.Length && ((s[i]) == '/'))
{
Expand All @@ -684,9 +684,9 @@ protected virtual int CheckNext(int pos, string s, int val, int type)
if (c >= '0' && c <= '9')
{
var vs = GetValue(v2, s, i);
var v3 = vs.theValue;
var v3 = vs.TheValue;
AddToSet(val, end, v3, type);
i = vs.pos;
i = vs.Pos;
return i;
}
else
Expand Down Expand Up @@ -716,9 +716,9 @@ protected virtual int CheckNext(int pos, string s, int val, int type)
if (c >= '0' && c <= '9')
{
var vs = GetValue(v2, s, i);
var v3 = vs.theValue;
var v3 = vs.TheValue;
AddToSet(val, end, v3, type);
i = vs.pos;
i = vs.Pos;
return i;
}
else
Expand Down Expand Up @@ -1018,13 +1018,13 @@ protected virtual ValueSet GetValue(int v, string s, int i)
var val = new ValueSet();
if (i < s.Length)
{
val.pos = i;
val.Pos = i;
}
else
{
val.pos = i + 1;
val.Pos = i + 1;
}
val.theValue = Convert.ToInt32(s1, CultureInfo.InvariantCulture);
val.TheValue = Convert.ToInt32(s1, CultureInfo.InvariantCulture);
return val;
}

Expand Down Expand Up @@ -1526,7 +1526,7 @@ protected virtual int GetLastDayOfMonth(int monthNum, int year)

public class ValueSet
{
public int pos;
public int theValue;
public int Pos { get; set; }
public int TheValue { get; set; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class SignalrServiceClient
private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(1);
internal ILog Log;
private static DateTime lastErrorTime;
public bool EnableSignalr;
public bool EnableSignalr { get; set; }
internal byte[] SKey;
internal string Url;
internal bool JabberReplaceDomain;
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Core.Common/Tenants/TenantExceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ namespace ASC.Core.Tenants
[Serializable]
public class TenantTooShortException : Exception
{
public int MinLength = 0;
public int MaxLength = 0;
public int MinLength { get; set; } = 0;
public int MaxLength { get; set; } = 0;

public TenantTooShortException(string message)
: base(message)
Expand Down
2 changes: 1 addition & 1 deletion common/ASC.Core.Common/Users/UserFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static DisplayUserNameFormat GetUserDisplayDefaultOrder()
return format.IndexOf("{0}") < format.IndexOf("{1}") ? DisplayUserNameFormat.FirstLast : DisplayUserNameFormat.LastFirst;
}

public Regex UserNameRegex;
public Regex UserNameRegex { get; set; }

private IConfiguration Configuration { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace ASC.Data.Backup.Tasks.Modules
[Scope]
public class ModuleProvider
{
public List<IModuleSpecifics> AllModules;
public List<IModuleSpecifics> AllModules { get; }

public ModuleProvider(IOptionsMonitor<ILog> options, Helpers helpers, CoreSettings coreSettings)
{
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Data.Reassigns/QueueWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class QueueWorker<T> where T : DistributedTaskProgress
protected IHttpContextAccessor HttpContextAccessor { get; }
protected IServiceProvider ServiceProvider { get; }

public object SynchRoot = new object();
private readonly object _synchRoot = new object();

public QueueWorker(
IHttpContextAccessor httpContextAccessor,
Expand Down Expand Up @@ -87,7 +87,7 @@ public void Terminate(int tenantId, Guid userId)

protected DistributedTaskProgress Start(int tenantId, Guid userId, Func<T> constructor)
{
lock (SynchRoot)
lock (_synchRoot)
{
var task = GetProgressItemStatus(tenantId, userId);

Expand Down
8 changes: 3 additions & 5 deletions products/ASC.Files/Core/Core/Entries/EditHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ public List<EditHistoryChanges> Changes
try
{
var jObject = JObject.Parse(ChangesString);
ServerVersion = jObject.Value<string>("serverVersion");
var serverVersion = jObject.Value<string>("serverVersion");

if (string.IsNullOrEmpty(ServerVersion))
if (string.IsNullOrEmpty(serverVersion))
return changes;

var jChanges = jObject.Value<JArray>("changes");
Expand Down Expand Up @@ -113,7 +113,7 @@ public List<EditHistoryChanges> Changes
set { throw new NotImplementedException(); }
}

public DateTime ModifiedOn;
public DateTime ModifiedOn { get; set; }

[JsonPropertyName("created")]
public string ModifiedOnString
Expand All @@ -126,8 +126,6 @@ public string ModifiedOnString
private TenantUtil TenantUtil { get; }
private UserManager UserManager { get; }
private DisplayUserSettingsHelper DisplayUserSettingsHelper { get; }

public string ServerVersion;
}

[DebuggerDisplay("{Id} {Name}")]
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Core/Entries/FileEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public bool ProviderEntry

public abstract bool IsNew { get; set; }

public FileEntryType FileEntryType;
public FileEntryType FileEntryType { get; set; }

private string _modifiedByString;
private string _createByString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public class SharePointProviderInfo : IProviderInfo
public DateTime CreateOn { get; set; }
public string CustomerTitle { get; set; }
public string RootFolderId { get { return "spoint-" + ID; } }

public string SpRootFolderId = "/Shared Documents";
public string SpRootFolderId { get; set; } = "/Shared Documents";

public SharePointProviderInfo(
IOptionsMonitor<ILog> options,
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Helpers/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public class Global

#region Property

public string ThumbnailExtension;
public string ThumbnailExtension { get; set; }

public const int MaxTitle = 170;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static string Serialize(Configuration<T> configuration)
[Transient]
public class DocumentConfig<T>
{
public string SharedLinkKey;
private string _sharedLinkKey;

public DocumentConfig(DocumentServiceConnector documentServiceConnector, PathProvider pathProvider, InfoConfig<T> infoConfig)
{
Expand Down Expand Up @@ -185,7 +185,7 @@ public string Url
if (!string.IsNullOrEmpty(_fileUri))
return _fileUri;
var last = Permissions.Edit || Permissions.Review || Permissions.Comment;
_fileUri = DocumentServiceConnector.ReplaceCommunityAdress(PathProvider.GetFileStreamUrl(Info.GetFile(), SharedLinkKey, last));
_fileUri = DocumentServiceConnector.ReplaceCommunityAdress(PathProvider.GetFileStreamUrl(Info.GetFile(), _sharedLinkKey, last));
return _fileUri;
}
}
Expand All @@ -202,7 +202,7 @@ public class InfoConfig<T>
public File<T> GetFile() => File;
public void SetFile(File<T> file) => File = file;

public EditorType Type = EditorType.Desktop;
public EditorType Type { get; set; } = EditorType.Desktop;
private string _breadCrumbs;

public InfoConfig(BreadCrumbsManager breadCrumbsManager, FileSharing fileSharing, SecurityContext securityContext, UserManager userManager)
Expand Down Expand Up @@ -336,7 +336,7 @@ public class EditorConfiguration<T>
}
}

public bool ModeWrite = false;
public bool ModeWrite { get; set; } = false;

private Configuration<T> _configuration;

Expand Down Expand Up @@ -672,8 +672,8 @@ internal void SetConfiguration(Configuration<T> configuration)
Logo.SetConfiguration(_configuration);
}

public string GobackUrl;
public bool IsRetina = false;
private string _gobackUrl;
public bool IsRetina { get; set; } = false;


public bool About
Expand Down Expand Up @@ -717,11 +717,11 @@ public GobackConfig Goback
{
if (_configuration.EditorType == EditorType.Embedded || _configuration.EditorType == EditorType.External) return null;
if (!AuthContext.IsAuthenticated) return null;
if (GobackUrl != null)
if (_gobackUrl != null)
{
return new GobackConfig
{
Url = GobackUrl,
Url = _gobackUrl,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public class TrackerData
[DebuggerDisplay("{Type} - {UserId}")]
public class Action
{
public string Type;
public string UserId;
public string Type { get; set; }
public string UserId { get; set; }
}

public enum ForceSaveInitiator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public string Name

private DisplayUserSettingsHelper DisplayUserSettingsHelper { get; }

public UserInfo User;
public UserInfo User { get; set; }

public MentionWrapper(UserInfo user, DisplayUserSettingsHelper displayUserSettingsHelper)
{
Expand Down
16 changes: 8 additions & 8 deletions products/ASC.Files/Core/Utils/MailMergeTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public class MailMergeTask : IDisposable
{
internal const string MessageBodyFormat = "id={0}&from={1}&subject={2}&to%5B%5D={3}&body={4}&mimeReplyToId=";

public string From;
public string Subject;
public string To;
public string Message;
public string AttachTitle;
public Stream Attach;
public int MessageId;
public string StreamId;
public string From { get; set; }
public string Subject { get; set; }
public string To { get; set; }
public string Message { get; set; }
public string AttachTitle { get; set; }
public Stream Attach { get; set; }
public int MessageId { get; set; }
public string StreamId { get; set; }

public MailMergeTask()
{
Expand Down
2 changes: 1 addition & 1 deletion web/ASC.Web.Core/Files/DocumentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ public class FileLink
[Serializable]
public class DocumentServiceException : Exception
{
public ErrorCode Code;
public ErrorCode Code { get; set; }

public DocumentServiceException(ErrorCode errorCode, string message)
: base(message)
Expand Down
4 changes: 2 additions & 2 deletions web/ASC.Web.Core/Subscriptions/SubscriptionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class SubscriptionType

public bool CanSubscribe { get; set; }

public IsEmptySubscriptionTypeDelegate IsEmptySubscriptionType;
public IsEmptySubscriptionTypeDelegate IsEmptySubscriptionType { get; set; }

public GetSubscriptionObjectsDelegate GetSubscriptionObjects;
public GetSubscriptionObjectsDelegate GetSubscriptionObjects { get; set; }

}
}

0 comments on commit 728c1b8

Please sign in to comment.