Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings related to CA1805 #16100

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

<AnalysisLevel>latest-Recommended</AnalysisLevel>

<!-- Member is explicitly initialized to its default value -->
<NoWarn>$(NoWarn);CA1805</NoWarn>

<!-- The behavior could vary based on the current user's locale setting -->
<NoWarn>$(NoWarn);CA1304;CA1305;CA1310</NoWarn>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace OrchardCore.ContentLocalization.Models
{
public class ContentCulturePickerSettings
{
public bool RedirectToHomepage { get; set; } = false;
public bool RedirectToHomepage { get; set; }
public bool SetCookie { get; set; } = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class FacebookSettings
{
public string AppId { get; set; }
public string AppSecret { get; set; }
public bool FBInit { get; set; } = false;
public bool FBInit { get; set; }

public string FBInitParams { get; set; } = @"status:true,
xfbml:true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ScriptsMiddleware
{
private readonly RequestDelegate _next;

byte[] _bytes = null;
byte[] _bytes;
string _etag;

public ScriptsMiddleware(RequestDelegate next)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public abstract class NotifyUserTaskActivityDisplayDriver<TActivity, TEditViewMo

protected readonly IStringLocalizer S;

protected virtual string EditShapeType { get; } = null;
protected virtual string EditShapeType { get; }

public NotifyUserTaskActivityDisplayDriver(
IHtmlSanitizerService htmlSanitizerService,
Expand Down Expand Up @@ -163,5 +163,5 @@ public NotifyUserTaskActivityDisplayDriver(
{
}

sealed protected override string EditShapeType { get; } = null;
protected sealed override string EditShapeType { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace OrchardCore.Placements.ViewModels
{
public class EditShapePlacementViewModel
{
public bool Creating { get; set; } = false;
public bool Creating { get; set; }

public string ShapeType { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class RolesPermissionsHandler : AuthorizationHandler<PermissionRequiremen
private readonly IPermissionGrantingService _permissionGrantingService;


private IEnumerable<RoleClaim> _anonymousClaims = null, _authenticatedClaims = null;
private IEnumerable<RoleClaim> _anonymousClaims;
private IEnumerable<RoleClaim> _authenticatedClaims;

public RolesPermissionsHandler(
RoleManager<IRole> roleManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class LuceneSettings

public string[] DefaultSearchFields { get; set; } = FullTextField;

public bool AllowLuceneQueriesInSearch { get; set; } = false;
public bool AllowLuceneQueriesInSearch { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ await HttpBackgroundJob.ExecuteAfterEndOfRequestAsync("lucene-index-rebuild", as

private sealed class LuceneIndexRebuildStepModel
{
public bool IncludeAll { get; set; } = false;
public bool IncludeAll { get; set; }
public string[] Indices { get; set; } = [];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ await HttpBackgroundJob.ExecuteAfterEndOfRequestAsync("lucene-index-reset", asyn

private sealed class LuceneIndexResetStepModel
{
public bool IncludeAll { get; set; } = false;
public bool IncludeAll { get; set; }
public string[] Indices { get; set; } = [];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ internal virtual string Categorize(params FeatureAttribute[] additionalFeatures)
/// <summary>
/// Once enabled, check whether the feature cannot be disabled. Defaults to <c>false</c>.
/// </summary>
public virtual bool IsAlwaysEnabled { get; set; } = false;
public virtual bool IsAlwaysEnabled { get; set; }

/// <summary>
/// Set to <c>true</c> to make the feature available by dependency only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace OrchardCore.Modules
public abstract class StartupBase : IStartup, IAsyncStartup
{
/// <inheritdoc />
public virtual int Order { get; } = 0;
public virtual int Order { get; }

/// <inheritdoc />
public virtual int ConfigureOrder => Order;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class GraphQLSettings
public PathString Path { get; set; } = "/api/graphql";
public Func<HttpContext, IDictionary<string, object>> BuildUserContext { get; set; }

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

public int? MaxDepth { get; set; }
public int? MaxComplexity { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace OrchardCore.DisplayManagement.Shapes
[DebuggerTypeProxy(typeof(ShapeDebugView))]
public class Shape : Composite, IShape, IPositioned, IEnumerable<object>
{
private bool _sorted = false;
private bool _sorted;

public ShapeMetadata Metadata { get; } = new ShapeMetadata();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public string Position

public IDictionary<string, object> Properties => _properties ??= [];

private bool _sorted = false;
private bool _sorted;

private List<IPositioned> _items;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class BlobFileStore : IFileStore
private readonly IClock _clock;
private readonly BlobContainerClient _blobContainer;
private readonly IContentTypeProvider _contentTypeProvider;
private readonly string _basePrefix = null;
private readonly string _basePrefix;

public BlobFileStore(BlobStorageOptions options, IClock clock, IContentTypeProvider contentTypeProvider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ namespace OrchardCore.Localization.DataAnnotations
internal sealed class DataAnnotationsDefaultErrorMessages
{
#pragma warning disable IDE1006 // Naming Styles
private readonly IStringLocalizer S = null;
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
private readonly IStringLocalizer S;
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
#pragma warning restore IDE1006 // Naming Styles

public string AssociatedMetadataTypeTypeDescriptorMetadataTypeContainsUnknownProperties => S["The associated metadata type for type '{0}' contains the following unknown properties or fields: {1}. Please make sure that the names of these members match the names of the properties on the main type."];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public AzureAISearchIndexResetDeploymentStep()
Name = "AzureAISearchIndexReset";
}

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

public string[] Indices { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class AzureAISearchIndexSettings

public IList<AzureAISearchIndexMap> IndexMappings { get; set; }

private long _lastTaskId = 0;
private long _lastTaskId;

public long GetLastTaskId()
=> _lastTaskId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ElasticConnectionOptions
/// <summary>
/// Enables compatibility mode for Elasticsearch 8.x.
/// </summary>
public bool EnableApiVersioningHeader { get; set; } = false;
public bool EnableApiVersioningHeader { get; set; }

/// <summary>
/// Whether the configuration section exists.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class DefaultTwoFactorAuthenticationHandlerCoordinator : ITwoFactorAuthen
{
private readonly IEnumerable<ITwoFactorAuthenticationHandler> _twoFactorAuthenticationHandlers;

private bool? _isRequired = null;
private bool? _isRequired;

public DefaultTwoFactorAuthenticationHandlerCoordinator(
IEnumerable<ITwoFactorAuthenticationHandler> twoFactorAuthenticationHandlers)
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore/OrchardCore/Shell/RunningShellTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class RunningShellTable : IRunningShellTable
{
private ImmutableDictionary<string, ShellSettings> _shellsByHostAndPrefix = ImmutableDictionary<string, ShellSettings>.Empty.WithComparers(StringComparer.OrdinalIgnoreCase);
private ShellSettings _default;
private bool _hasStarMapping = false;
private bool _hasStarMapping;

public void Add(ShellSettings settings)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class PermissionsContext
{
public IEnumerable<Permission> AuthorizedPermissions { get; set; } = [];

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

internal sealed class StubIdentity : IIdentity
Expand Down