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

Add StyleCop.Analyzers and enable some basic suggestions #14074

Merged
merged 15 commits into from
Aug 14, 2023
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
206 changes: 205 additions & 1 deletion .editorconfig

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/OrchardCore.Build/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<PackageManagement Include="Shortcodes" Version="1.3.3" />
<PackageManagement Include="SixLabors.ImageSharp.Web" Version="3.0.1" />
<PackageManagement Include="StackExchange.Redis" Version="2.6.122" />
<PackageManagement Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageManagement Include="System.Linq.Async" Version="6.0.1" />
<PackageManagement Include="xunit" Version="2.5.0" />
<PackageManagement Include="xunit.analyzers" Version="1.2.0" />
Expand Down
4 changes: 4 additions & 0 deletions src/OrchardCore.Build/OrchardCore.Commons.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="all" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AdminMenu(IStringLocalizer<AdminMenu> localizer)
S = localizer;
}

///<inheritdocs />
/// <inheritdocs />
public Task BuildNavigationAsync(string name, NavigationBuilder builder)
{
if (String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public int Create()
.Column<bool>("IsRead")
.Column<DateTime>("ReadAtUtc")
.Column<DateTime>("CreatedAtUtc")
.Column<string>("Content", column => column.WithLength(NotificationConstants.NotificationIndexContentLength))
, collection: NotificationConstants.NotificationCollection
.Column<string>("Content", column => column.WithLength(NotificationConstants.NotificationIndexContentLength)),
collection: NotificationConstants.NotificationCollection
);

SchemaBuilder.AlterIndexTable<NotificationIndex>(table => table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

Expand Down Expand Up @@ -55,7 +56,7 @@ internal string Build()

for (var i = 0; i < _contentPartBuilders.Count; i++)
{
sbo.Append(_contentPartBuilders[i].Build()).AppendLine((i == (_contentPartBuilders.Count - 1)) ? "" : ",");
sbo.Append(_contentPartBuilders[i].Build()).AppendLine((i == (_contentPartBuilders.Count - 1)) ? String.Empty : ",");
}

sbo.Append('}').AppendLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CultureDictionaryRecord
/// Creates new instance of <see cref="CultureDictionaryRecord"/>.
/// </summary>
/// <param name="messageId">The message Id.</param>
/// <param name="translations">a list of translations</param>
/// <param name="translations">a list of translations.</param>
public CultureDictionaryRecord(string messageId, params string[] translations)
: this(messageId, null, translations)
{
Expand All @@ -23,7 +23,7 @@ public CultureDictionaryRecord(string messageId, params string[] translations)
/// </summary>
/// <param name="messageId">The message Id.</param>
/// <param name="context">The message context.</param>
/// <param name="translations">a list of translations</param>
/// <param name="translations">a list of translations.</param>
public CultureDictionaryRecord(string messageId, string context, string[] translations)
{
Key = GetKey(messageId, context);
Expand Down
12 changes: 4 additions & 8 deletions src/OrchardCore/OrchardCore.OpenId.Core/OpenIdExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ public static OpenIddictCoreBuilder UseOrchardManagers(this OpenIddictCoreBuilde

// Register proxy delegates so that the Orchard managers can be directly
// resolved from the DI using the non-generic, Orchard-specific interfaces.
builder.Services.TryAddScoped(provider => (IOpenIdApplicationManager)
provider.GetRequiredService<IOpenIddictApplicationManager>());
builder.Services.TryAddScoped(provider => (IOpenIdAuthorizationManager)
provider.GetRequiredService<IOpenIddictAuthorizationManager>());
builder.Services.TryAddScoped(provider => (IOpenIdScopeManager)
provider.GetRequiredService<IOpenIddictScopeManager>());
builder.Services.TryAddScoped(provider => (IOpenIdTokenManager)
provider.GetRequiredService<IOpenIddictTokenManager>());
builder.Services.TryAddScoped(provider => (IOpenIdApplicationManager)provider.GetRequiredService<IOpenIddictApplicationManager>());
builder.Services.TryAddScoped(provider => (IOpenIdAuthorizationManager)provider.GetRequiredService<IOpenIddictAuthorizationManager>());
builder.Services.TryAddScoped(provider => (IOpenIdScopeManager)provider.GetRequiredService<IOpenIddictScopeManager>());
builder.Services.TryAddScoped(provider => (IOpenIdTokenManager)provider.GetRequiredService<IOpenIddictTokenManager>());

return builder;
}
Expand Down