-
Notifications
You must be signed in to change notification settings - Fork 4
Add editorconfig and analyzers #240
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6a79613
Add editorconfig and analyzers
elsand 15a5c10
cleanup
oskogstad 080cf36
Merge branch 'main' into analyzers-and-editorconfig
oskogstad bcb4277
Cleanup
oskogstad 9cdfcc0
Rename enums
oskogstad 87dacce
Disable CA1716, move to namespace continuation
oskogstad 4852c37
Allow underscores in test names
oskogstad bf34b75
Fix typos
oskogstad 1c7f8c4
Rename List to Search
oskogstad 8b4a0d3
CA1720 Identifiers should not contain type names
oskogstad 0117561
CA1309: Use ordinal StringComparison
oskogstad 2529ea9
Use array initializer
oskogstad 2af56eb
Minor cleanups
oskogstad 56c18eb
Cleanup
oskogstad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # EditorConfig is awesome: https://EditorConfig.org | ||
|
|
||
| # See also Directory.Build.Props for additional analyzer settings | ||
|
|
||
| root = true | ||
|
|
||
| [*] | ||
| # Enforce line endings to be LF | ||
| end_of_line = lf | ||
| # Enforce indentation to be 4 spaces | ||
| indent_style = spaces | ||
| indent_size = 4 | ||
| # Insert a final new line at the end of the file | ||
| insert_final_newline = true | ||
|
|
||
| [*.cs] | ||
|
|
||
| # Style faults should be warnings | ||
| dotnet_analyzer_diagnostic.category-Style.severity = warning | ||
|
|
||
| # Enforce file scoped namespaces | ||
| csharp_style_namespace_declarations = file_scoped:suggestion | ||
| # Place 'using' directives outside of namespaces | ||
| csharp_using_directive_placement = outside_namespace:true | ||
| # Order 'using' directives with System.* appearing first | ||
| dotnet_sort_system_directives_first = true | ||
| # Suggest the use of var when the type is apparent | ||
| csharp_style_var_for_built_in_types = true:suggestion | ||
| csharp_style_var_when_type_is_apparent = true:suggestion | ||
| csharp_style_var_elsewhere = true:suggestion | ||
| # Suggest using expression bodies | ||
| csharp_style_expression_bodied_methods = when_on_single_line | ||
| dotnet_diagnostic.IDE0022.severity = suggestion | ||
| # Don't mix non-braces and braces for ifs | ||
| csharp_prefer_braces = when_multiline | ||
|
|
||
| # "Expression body is never used" | ||
| dotnet_diagnostic.IDE0058.severity = none | ||
| # "'if' statement can be simplified" | ||
| dotnet_diagnostic.IDE0046.severity = suggestion | ||
| # "Do not declare static members on generic types" | ||
| dotnet_diagnostic.CA1000.severity = none | ||
| # "Instantiate argument exceptions correctly" | ||
| dotnet_diagnostic.CA2208.severity = suggestion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <Project> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.4" PrivateAssets="all" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- | ||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| </PropertyGroup> | ||
| --> | ||
|
|
||
| <PropertyGroup> | ||
| <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild> | ||
| <AnalysisMode>Recommended</AnalysisMode> | ||
| <EnableNETAnalyzers>true</EnableNETAnalyzers> | ||
| <AnalysisLevel>latest</AnalysisLevel> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.