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

Use file scoped namespaces #10696

Merged
merged 27 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5341e3e
add initial .editorconfig file
cotur Nov 21, 2021
417123b
Update .editorconfig
cotur Nov 21, 2021
9c3b340
convert file-scoped namespacing for framework
cotur Nov 21, 2021
9f5eba6
remove all .DotSettings files from projects
cotur Nov 21, 2021
1b86375
use file-scoped namespacing for account module
cotur Nov 21, 2021
3129952
use file-scoped namespacing for audit-logging module
cotur Nov 21, 2021
bd939aa
use file-scoped namespacing for backgroundJobs module
cotur Nov 21, 2021
2f672af
use file-scoped namespacing for basicTheme module
cotur Nov 21, 2021
c71a203
use file-scoped namespacing for blobStoringDatabase module
cotur Nov 21, 2021
3bcb45c
use file-scoped namespacing for clientSmulation module
cotur Nov 21, 2021
2294520
use file-scoped namespacing for cmsKit module
cotur Nov 21, 2021
3afa5f1
use file-scoped namespacing for featureManagement module
cotur Nov 21, 2021
579d898
use file-scoped namespacing for identity module
cotur Nov 21, 2021
1fb014b
use file-scoped namespacing for identityServer module
cotur Nov 21, 2021
90dc6d3
use file-scoped namespacing for permissionManagement module
cotur Nov 21, 2021
7e2f09e
use file-scoped namespacing for settingManagement module
cotur Nov 21, 2021
195138d
use file-scoped namespacing for tenantManagement module
cotur Nov 21, 2021
2f43a82
use file-scoped namespacing for users module
cotur Nov 21, 2021
73fadc0
use file-scoped namespacing for virtualFileExplorer module
cotur Nov 21, 2021
044ede1
use file-scoped namespacing for studioOpen module
cotur Nov 21, 2021
ab6c9dd
use file-scoped namespacing for app template
cotur Nov 21, 2021
7f7d883
use file-scoped namespacing for console template
cotur Nov 21, 2021
d1d9c47
use file-scoped namespacing for module template
cotur Nov 21, 2021
3a88f55
use file-scoped namespacing for wfm template
cotur Nov 21, 2021
27a87d7
update localization test
cotur Nov 21, 2021
395f8de
Merge branch 'dev' into cotur/file-scope-namespaces
maliming Nov 22, 2021
0042960
Revert "update localization test"
maliming Nov 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
137 changes: 137 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# EditorConfig is awesome: https://EditorConfig.org
# Please feel free to update it (by considering the code style of ABP Team).
# top-most EditorConfig file
root = true

[*.cs]

#Namespace settings
csharp_style_namespace_declarations = file_scoped
dotnet_diagnostic.IDE0161.severity = warning

#Core editorconfig formatting - indentation

#use tabs for indentation
indent_style = tabs

#Formatting - indentation options

#indent switch case contents.
csharp_indent_case_contents = true
#indent switch labels
csharp_indent_switch_labels = true

#Formatting - new line options

#place catch statements on a new line
csharp_new_line_before_catch = true
#place else statements on a new line
csharp_new_line_before_else = true
#require members of object intializers to be on separate lines
csharp_new_line_before_members_in_object_initializers = true
#require braces to be on a new line for object_collection_array_initializers, methods, control_blocks, types, and lambdas (also known as "Allman" style)
csharp_new_line_before_open_brace = object_collection_array_initializers, methods, control_blocks, types, lambdas

#Formatting - organize using options

#sort System.* using directives alphabetically, and place them before other usings
dotnet_sort_system_directives_first = true

#Formatting - spacing options

#require NO space between a cast and the value
csharp_space_after_cast = false
#require a space before the colon for bases or interfaces in a type declaration
csharp_space_after_colon_in_inheritance_clause = true
#require a space after a keyword in a control flow statement such as a for loop
csharp_space_after_keywords_in_control_flow_statements = true
#require a space before the colon for bases or interfaces in a type declaration
csharp_space_before_colon_in_inheritance_clause = true
#remove space within empty argument list parentheses
csharp_space_between_method_call_empty_parameter_list_parentheses = false
#remove space between method call name and opening parenthesis
csharp_space_between_method_call_name_and_opening_parenthesis = false
#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
csharp_space_between_method_call_parameter_list_parentheses = false
#remove space within empty parameter list parentheses for a method declaration
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
csharp_space_between_method_declaration_parameter_list_parentheses = false

#Formatting - wrapping options

#leave code block on single line
csharp_preserve_single_line_blocks = true

#Style - Code block preferences

#prefer curly braces even for one line of code
csharp_prefer_braces = true:suggestion

#Style - expression bodied member options

#prefer block bodies for constructors
csharp_style_expression_bodied_constructors = false:suggestion
#prefer block bodies for methods
csharp_style_expression_bodied_methods = false:suggestion
#prefer expression-bodied members for properties
csharp_style_expression_bodied_properties = true:suggestion

#Style - expression level options

#prefer out variables to be declared inline in the argument list of a method call when possible
csharp_style_inlined_variable_declaration = true:suggestion
#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
dotnet_style_predefined_type_for_member_access = true:suggestion

#Style - Expression-level preferences

#prefer default over default(T)
csharp_prefer_simple_default_expression = true:suggestion
#prefer objects to be initialized using object initializers when possible
dotnet_style_object_initializer = true:suggestion
#prefer inferred tuple element names
dotnet_style_prefer_inferred_tuple_names = true:suggestion

#Style - implicit and explicit types

#prefer var over explicit type in all cases, unless overridden by another code style rule
csharp_style_var_elsewhere = true:suggestion
#prefer var is used to declare variables with built-in system types such as int
csharp_style_var_for_built_in_types = true:suggestion
#prefer var when the type is already mentioned on the right-hand side of a declaration expression
csharp_style_var_when_type_is_apparent = true:suggestion

#Style - language keyword and framework type options

#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion

#Style - Miscellaneous preferences

#prefer local functions over anonymous functions
csharp_style_pattern_local_over_anonymous_function = true:suggestion

#Style - modifier options

#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

#Style - Modifier preferences

#when this rule is set to a list of modifiers, prefer the specified ordering.
csharp_preferred_modifier_order = public,protected,private,virtual,async,readonly,static,override,abstract:suggestion

#Style - Pattern matching

#prefer pattern matching instead of is expression with type casts
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion

#Style - qualification options

#prefer fields not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_field = false:suggestion
#prefer methods not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_method = false:suggestion
#prefer properties not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_property = false:suggestion
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*.user
*.userosscache
*.sln.docstates
*.editorconfig


# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;

namespace Volo.Abp.ApiVersioning
namespace Volo.Abp.ApiVersioning;

public class AbpApiVersioningAbstractionsModule : AbpModule
{
public class AbpApiVersioningAbstractionsModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context)
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddSingleton<IRequestedApiVersion>(NullRequestedApiVersion.Instance);
}
context.Services.AddSingleton<IRequestedApiVersion>(NullRequestedApiVersion.Instance);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace Volo.Abp.ApiVersioning
namespace Volo.Abp.ApiVersioning;

public interface IRequestedApiVersion
{
public interface IRequestedApiVersion
{
string Current { get; }
}
string Current { get; }
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
namespace Volo.Abp.ApiVersioning
namespace Volo.Abp.ApiVersioning;

public class NullRequestedApiVersion : IRequestedApiVersion
{
public class NullRequestedApiVersion : IRequestedApiVersion
{
public static NullRequestedApiVersion Instance = new NullRequestedApiVersion();
public static NullRequestedApiVersion Instance = new NullRequestedApiVersion();

public string Current => null;
public string Current => null;

private NullRequestedApiVersion()
{

private NullRequestedApiVersion()
{

}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer;

namespace Microsoft.AspNetCore.Builder
namespace Microsoft.AspNetCore.Builder;

public static class ApplicationBuilderAbpJwtTokenMiddlewareExtension
{
public static class ApplicationBuilderAbpJwtTokenMiddlewareExtension
public static IApplicationBuilder UseJwtTokenMiddleware(this IApplicationBuilder app, string schema = JwtBearerDefaults.AuthenticationScheme)
{
public static IApplicationBuilder UseJwtTokenMiddleware(this IApplicationBuilder app, string schema = JwtBearerDefaults.AuthenticationScheme)
return app.Use(async (ctx, next) =>
{
return app.Use(async (ctx, next) =>
if (ctx.User.Identity?.IsAuthenticated != true)
{
if (ctx.User.Identity?.IsAuthenticated != true)
var result = await ctx.AuthenticateAsync(schema);
if (result.Succeeded && result.Principal != null)
{
var result = await ctx.AuthenticateAsync(schema);
if (result.Succeeded && result.Principal != null)
{
ctx.User = result.Principal;
}
ctx.User = result.Principal;
}
}

await next();
});
}
await next();
});
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Volo.Abp.Modularity;
using Volo.Abp.Security;

namespace Volo.Abp.AspNetCore.Authentication.JwtBearer
namespace Volo.Abp.AspNetCore.Authentication.JwtBearer;

[DependsOn(typeof(AbpSecurityModule))]
public class AbpAspNetCoreAuthenticationJwtBearerModule : AbpModule
{
[DependsOn(typeof(AbpSecurityModule))]
public class AbpAspNetCoreAuthenticationJwtBearerModule : AbpModule
{

}
}
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
using Volo.Abp.AspNetCore.Authentication.OAuth.Claims;
using Volo.Abp.Security.Claims;

namespace Microsoft.AspNetCore.Authentication.OAuth.Claims
namespace Microsoft.AspNetCore.Authentication.OAuth.Claims;

public static class AbpClaimActionCollectionExtensions
{
public static class AbpClaimActionCollectionExtensions
public static void MapAbpClaimTypes(this ClaimActionCollection claimActions)
{
public static void MapAbpClaimTypes(this ClaimActionCollection claimActions)
if (AbpClaimTypes.UserName != "name")
{
claimActions.MapJsonKey(AbpClaimTypes.UserName, "name");
claimActions.DeleteClaim("name");
claimActions.RemoveDuplicate(AbpClaimTypes.UserName);
}

if (AbpClaimTypes.Email != "email")
{
claimActions.MapJsonKey(AbpClaimTypes.Email, "email");
claimActions.DeleteClaim("email");
claimActions.RemoveDuplicate(AbpClaimTypes.Email);
}

if (AbpClaimTypes.EmailVerified != "email_verified")
{
claimActions.MapJsonKey(AbpClaimTypes.EmailVerified, "email_verified");
}

if (AbpClaimTypes.PhoneNumber != "phone_number")
{
if (AbpClaimTypes.UserName != "name")
{
claimActions.MapJsonKey(AbpClaimTypes.UserName, "name");
claimActions.DeleteClaim("name");
claimActions.RemoveDuplicate(AbpClaimTypes.UserName);
}

if (AbpClaimTypes.Email != "email")
{
claimActions.MapJsonKey(AbpClaimTypes.Email, "email");
claimActions.DeleteClaim("email");
claimActions.RemoveDuplicate(AbpClaimTypes.Email);
}

if (AbpClaimTypes.EmailVerified != "email_verified")
{
claimActions.MapJsonKey(AbpClaimTypes.EmailVerified, "email_verified");
}

if (AbpClaimTypes.PhoneNumber != "phone_number")
{
claimActions.MapJsonKey(AbpClaimTypes.PhoneNumber, "phone_number");
}

if (AbpClaimTypes.PhoneNumberVerified != "phone_number_verified")
{
claimActions.MapJsonKey(AbpClaimTypes.PhoneNumberVerified, "phone_number_verified");
}

if (AbpClaimTypes.Role != "role")
{
claimActions.MapJsonKeyMultiple(AbpClaimTypes.Role, "role");
}

claimActions.RemoveDuplicate(AbpClaimTypes.Name);
claimActions.MapJsonKey(AbpClaimTypes.PhoneNumber, "phone_number");
}

public static void MapJsonKeyMultiple(this ClaimActionCollection claimActions, string claimType, string jsonKey)
if (AbpClaimTypes.PhoneNumberVerified != "phone_number_verified")
{
claimActions.Add(new MultipleClaimAction(claimType, jsonKey));
claimActions.MapJsonKey(AbpClaimTypes.PhoneNumberVerified, "phone_number_verified");
}
public static void RemoveDuplicate(this ClaimActionCollection claimActions, string claimType)

if (AbpClaimTypes.Role != "role")
{
claimActions.Add(new RemoveDuplicateClaimAction(claimType));
claimActions.MapJsonKeyMultiple(AbpClaimTypes.Role, "role");
}

claimActions.RemoveDuplicate(AbpClaimTypes.Name);
}

public static void MapJsonKeyMultiple(this ClaimActionCollection claimActions, string claimType, string jsonKey)
{
claimActions.Add(new MultipleClaimAction(claimType, jsonKey));
}

public static void RemoveDuplicate(this ClaimActionCollection claimActions, string claimType)
{
claimActions.Add(new RemoveDuplicateClaimAction(claimType));
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Volo.Abp.Modularity;
using Volo.Abp.Security;

namespace Volo.Abp.AspNetCore.Authentication.OAuth
namespace Volo.Abp.AspNetCore.Authentication.OAuth;

[DependsOn(typeof(AbpSecurityModule))]
public class AbpAspNetCoreAuthenticationOAuthModule : AbpModule
{
[DependsOn(typeof(AbpSecurityModule))]
public class AbpAspNetCoreAuthenticationOAuthModule : AbpModule
{

}
}
Loading