Skip to content

Commit 9ae3c19

Browse files
Add linting rule (#472)
* remove unused package * fix format issue * enforce format check
1 parent 138a4e2 commit 9ae3c19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+159
-115
lines changed

.editorconfig

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
## Default settings ##
7+
[*]
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 4
11+
trim_trailing_whitespace = true
12+
13+
## Formatting rule ##
14+
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055
15+
dotnet_diagnostic.IDE0055.severity = error
16+
17+
# 'Using' directive preferences
18+
dotnet_sort_system_directives_first = false
19+
20+
# New line preferences
21+
dotnet_diagnostic.IDE2002.severity = error
22+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
23+
dotnet_diagnostic.IDE2004.severity = error
24+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
25+
dotnet_diagnostic.IDE2005.severity = error
26+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
27+
dotnet_diagnostic.IDE2006.severity = error
28+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
29+
dotnet_diagnostic.IDE2000.severity = error
30+
dotnet_style_allow_multiple_blank_lines_experimental = false
31+
dotnet_diagnostic.IDE2003.severity = error
32+
dotnet_style_allow_statement_immediately_after_block_experimental = false
33+
34+
[*.csproj]
35+
indent_size = 2
36+
charset = utf-8
37+
38+
[*.json]
39+
indent_size = 2

examples/BlazorServerApp/BlazorServerApp.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@
99
<ProjectReference Include="..\..\src\Microsoft.FeatureManagement\Microsoft.FeatureManagement.csproj" />
1010
</ItemGroup>
1111

12+
<PropertyGroup>
13+
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
14+
</PropertyGroup>
15+
1216
</Project>

examples/BlazorServerApp/BrowserFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private static bool IsChromeBrowser(string userAgentContext)
4545
return false;
4646
}
4747

48-
return userAgentContext.Contains("chrome", StringComparison.OrdinalIgnoreCase) &&
48+
return userAgentContext.Contains("chrome", StringComparison.OrdinalIgnoreCase) &&
4949
!userAgentContext.Contains("edg", StringComparison.OrdinalIgnoreCase);
5050
}
5151

examples/BlazorServerApp/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ public static void Main(string[] args)
4848
app.Run();
4949
}
5050
}
51-
}
51+
}

examples/ConsoleApp/AccountServiceContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
class AccountServiceContext : IAccountContext
55
{
66
public string AccountId { get; set; }
7-
}
7+
}

examples/ConsoleApp/ConsoleApp.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@
2121
</None>
2222
</ItemGroup>
2323

24+
<PropertyGroup>
25+
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
26+
</PropertyGroup>
27+
2428
</Project>

examples/ConsoleApp/Program.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using Microsoft.Extensions.Configuration;
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
//
4+
using Microsoft.Extensions.Configuration;
25
using Microsoft.Extensions.DependencyInjection;
36
using Microsoft.FeatureManagement;
47

@@ -49,4 +52,4 @@
4952
// Output results
5053
Console.WriteLine($"The {FeatureName} feature is {(enabled ? "enabled" : "disabled")} for the '{account}' account.");
5154
}
52-
}
55+
}

examples/FeatureFlagDemo/Authentication/QueryStringAuthenticationHandler.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22
// Licensed under the MIT license.
33
//
44
using Microsoft.AspNetCore.Authentication;
5-
using Microsoft.Extensions.Logging;
65
using Microsoft.Extensions.Options;
76
using Microsoft.Extensions.Primitives;
8-
using System.Collections.Generic;
9-
using System.Linq;
107
using System.Security.Claims;
118
using System.Text.Encodings.Web;
12-
using System.Threading.Tasks;
139

1410
namespace FeatureFlagDemo.Authentication
1511
{

examples/FeatureFlagDemo/BrowserFilter.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33
//
4-
using Microsoft.AspNetCore.Http;
5-
using Microsoft.Extensions.Configuration;
64
using Microsoft.FeatureManagement;
7-
using System;
8-
using System.Linq;
9-
using System.Threading.Tasks;
105

116
namespace FeatureFlagDemo.FeatureManagement.FeatureFilters
127
{

examples/FeatureFlagDemo/BrowserFilterSettings.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33
//
4-
using System.Collections.Generic;
5-
64
namespace FeatureFlagDemo.FeatureManagement.FeatureFilters
75
{
86
public class BrowserFilterSettings

0 commit comments

Comments
 (0)