Skip to content

Commit b40215f

Browse files
authored
Merge pull request #2872 from sharwell/stabilize
Stabilize
2 parents 834c2db + dff3616 commit b40215f

1,158 files changed

Lines changed: 65239 additions & 21023 deletions

File tree

Some content is hidden

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

.codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ coverage:
77
default: false
88
patch:
99
default: false
10+
fixes:
11+
- "build/StyleCop.Analyzers/::StyleCop.Analyzers/"
12+
13+
comment:
14+
layout: "diff"
1015

1116
flags:
1217
production:

.editorconfig

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
root = true
2+
3+
[*.cs]
4+
charset = utf-8-bom
5+
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 4
8+
9+
# Sort using and Import directives with System.* appearing first
10+
dotnet_sort_system_directives_first = true
11+
12+
# Always use "this." and "Me." when applicable; let StyleCop Analyzers provide the warning and fix
13+
dotnet_style_qualification_for_field = true:none
14+
dotnet_style_qualification_for_property = true:none
15+
dotnet_style_qualification_for_method = true:none
16+
dotnet_style_qualification_for_event = true:none
17+
18+
# Use language keywords where applicable; let StyleCop Analyzers provide the warning and fix
19+
dotnet_style_predefined_type_for_locals_parameters_members = true:none
20+
dotnet_style_predefined_type_for_member_access = true:none
21+
22+
# Suggest more modern language features when available
23+
dotnet_style_object_initializer = true:none
24+
dotnet_style_collection_initializer = true:none
25+
dotnet_style_coalesce_expression = true:suggestion
26+
dotnet_style_null_propagation = true:suggestion
27+
dotnet_style_explicit_tuple_names = true:suggestion
28+
29+
# New line preferences
30+
csharp_new_line_before_open_brace = all
31+
csharp_new_line_before_else = true
32+
csharp_new_line_before_catch = true
33+
csharp_new_line_before_finally = true
34+
csharp_new_line_before_members_in_object_initializers = true
35+
csharp_new_line_before_members_in_anonymous_types = true
36+
csharp_new_line_between_query_expression_clauses = true
37+
38+
# Indentation preferences
39+
csharp_indent_block_contents = true
40+
csharp_indent_braces = false
41+
csharp_indent_case_contents = true
42+
csharp_indent_switch_labels = false
43+
csharp_indent_labels = flush_left
44+
45+
# Space preferences
46+
csharp_space_after_cast = false
47+
csharp_space_after_colon_in_inheritance_clause = true
48+
csharp_space_after_comma = true
49+
csharp_space_after_dot = false
50+
csharp_space_after_keywords_in_control_flow_statements = true
51+
csharp_space_after_semicolon_in_for_statement = true
52+
csharp_space_around_binary_operators = before_and_after
53+
csharp_space_around_declaration_statements = do_not_ignore
54+
csharp_space_before_colon_in_inheritance_clause = true
55+
csharp_space_before_comma = false
56+
csharp_space_before_dot = false
57+
csharp_space_before_open_square_brackets = false
58+
csharp_space_before_semicolon_in_for_statement = false
59+
csharp_space_between_empty_square_brackets = false
60+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
61+
csharp_space_between_method_call_name_and_opening_parenthesis = false
62+
csharp_space_between_method_call_parameter_list_parentheses = false
63+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
64+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
65+
csharp_space_between_method_declaration_parameter_list_parentheses = false
66+
csharp_space_between_parentheses = false
67+
csharp_space_between_square_brackets = false
68+
69+
# Prefer "var" only where type is obvious; disable diagnostics since no firm policy is in place yet
70+
csharp_style_var_for_built_in_types = false:none
71+
csharp_style_var_when_type_is_apparent = true:none
72+
csharp_style_var_elsewhere = false:none
73+
74+
# Prefer method-like constructs to have a block body
75+
csharp_style_expression_bodied_methods = false:none
76+
csharp_style_expression_bodied_constructors = false:none
77+
csharp_style_expression_bodied_operators = false:none
78+
79+
# Prefer property-like constructs to have an expression-body
80+
csharp_style_expression_bodied_properties = true:none
81+
csharp_style_expression_bodied_indexers = true:none
82+
csharp_style_expression_bodied_accessors = true:none
83+
84+
# Suggest more modern language features when available
85+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
86+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
87+
csharp_style_inlined_variable_declaration = true:none
88+
csharp_style_throw_expression = true:none
89+
csharp_style_conditional_delegate_call = true:suggestion

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ packages/
1010
*.user
1111
TestResults/
1212
OpenCover.Reports/
13+
OpenCover.Symbols/
1314
.nuget/NuGet.exe
1415
build/nuget/
1516
*.log

.nuget/packages.config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="NuGet.CommandLine" version="2.8.3" />
4-
<package id="OpenCover" version="4.6.247-rc" />
3+
<package id="Codecov" version="1.1.0" />
4+
<package id="Microsoft.DiaSymReader.Pdb2Pdb" version="1.1.0-beta1-62624-01" />
5+
<package id="OpenCover" version="4.6.519" />
56
<package id="ReportGenerator" version="2.3.5.0" targetFramework="net452" />
67
<package id="xunit.runner.console" version="2.1.0" targetFramework="net452" />
78
</packages>

CONTRIBUTING.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ If you want to contribute code you can get started by looking for issues marked
55
We also have the [easy](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/labels/easy) tag
66
for issues suitable if you are unfamiliar with roslyn.
77

8-
Also see the [contributing guide](CONTRIBUTING.md).
9-
108
You can also help by filing issues, participating in discussions and doing code review.
119

1210
## Implementing a diagnostic
@@ -28,6 +26,4 @@ You can also help by filing issues, participating in discussions and doing code
2826

2927
## Building
3028

31-
Visual Studio 2015 RC is required for building this repository.
32-
The Visual Studio 2015 RC SDK is required for building the vsix extension project and for
33-
debugging in an experimental visual studio hive.
29+
Visual Studio 2017 (Community Edition or higher) is required for building this repository.

DOCUMENTATION.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
StyleCop.Analyzers provides warnings that indicate style and consistency rule violations in C# code. The warnings are organized into rule areas such as documentation, layout, naming, ordering, readability, spacing, and so forth. Each warning signifies a violation of a style or consistency rule. This section provides an explanation of each of the default StyleCop.Analyzers rules.
2+
3+
### Rule areas
4+
**[Special Rules (SA0000-)](documentation/SpecialRules.md)**
5+
6+
Rules which provide special functionality like workarounds, configuration errors, etc.
7+
8+
**[Spacing Rules (SA1000-)](documentation/SpacingRules.md)**
9+
10+
Rules which enforce spacing requirements around keywords and symbols in the code.
11+
12+
**[Readability Rules (SA1100-)](documentation/ReadabilityRules.md)**
13+
14+
Rules which ensure that the code is well-formatted and readable.
15+
16+
**[Ordering Rules (SA1200-)](documentation/OrderingRules.md)**
17+
18+
Rules which enforce a standard ordering scheme for code contents.
19+
20+
**[Naming Rules (SA1300-)](documentation/NamingRules.md)**
21+
22+
Rules which enforce naming requirements for members, types, and variables.
23+
24+
**[Maintainability Rules (SA1400-)](documentation/MaintainabilityRules.md)**
25+
26+
Rules which improve code maintainability.
27+
28+
**[Layout Rules (SA1500-)](documentation/LayoutRules.md)**
29+
30+
Rules which enforce code layout and line spacing.
31+
32+
**[Documentation Rules (SA1600-)](documentation/DocumentationRules.md)**
33+
34+
Rules which verify the content and formatting of code documentation.
35+
36+
**[Alternative Rules (SX0000-)](documentation/AlternativeRules.md)**
37+
38+
Rules which offer a non-standard extension to the default StyleCop behavior.
39+
40+
### Additional documentation
41+
**[Configuration](documentation/Configuration.md)**
42+
43+
Describes the configuration options for StyleCop.Analyzers
44+
45+
**[How to enable the configuration](documentation/EnableConfiguration.md)**
46+
47+
Describes how to enable the **stylecop.json** file for usage.
48+
49+
**[Known changes](documentation/KnownChanges.md)**
50+
51+
Describes the known differences between StyleCop Analyzers and StyleCop Classic.

NuGet.config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="roslyn" value="https://dotnet.myget.org/F/roslyn/api/v3/index.json" />
5+
<add key="roslyn-analyzers" value="https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json" />
6+
<add key="symreader-converter" value="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json" />
7+
8+
<!-- Uncomment this to test unpublished builds from the AppVeyor feed. -->
9+
<!--<add key="appveyor-stylecop" value="https://ci.appveyor.com/nuget/stylecopanalyzers-jqg4a6mt0hgj" />-->
10+
</packageSources>
11+
</configuration>

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# StyleCop Analyzers for the .NET Compiler Platform
22

3+
[![NuGet](https://img.shields.io/nuget/v/StyleCop.Analyzers.svg)](https://www.nuget.org/packages/StyleCop.Analyzers)[![NuGet Beta](https://img.shields.io/nuget/vpre/StyleCop.Analyzers.svg)](https://www.nuget.org/packages/StyleCop.Analyzers)
4+
35
[![Join the chat at https://gitter.im/DotNetAnalyzers/StyleCopAnalyzers](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/DotNetAnalyzers/StyleCopAnalyzers?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
46

57
[![Build status](https://ci.appveyor.com/api/projects/status/8jw2lq431kgg44jl/branch/master?svg=true)](https://ci.appveyor.com/project/sharwell/stylecopanalyzers/branch/master)
@@ -13,31 +15,43 @@ This repository contains an implementation of the StyleCop rules using the .NET
1315
The preferable way to use the analyzers is to add the nuget package [StyleCop.Analyzers](http://www.nuget.org/packages/StyleCop.Analyzers/)
1416
to the project where you want to enforce StyleCop rules.
1517

16-
The severity of individual rules may be configured using [rule set files](https://msdn.microsoft.com/en-us/library/dd264996.aspx)
17-
in Visual Studio 2015. **Settings.StyleCop** is not supported, but a **stylecop.json** file may be used to customize the
18-
behavior of certain rules. See [Configuration.md](documentation/Configuration.md) for more information.
18+
The severity of individual rules may be configured using [rule set files](https://docs.microsoft.com/en-us/visualstudio/code-quality/using-rule-sets-to-group-code-analysis-rules)
19+
in Visual Studio 2015 or newer. **Settings.StyleCop** is not supported, but a **stylecop.json** file may be used to
20+
customize the behavior of certain rules. See [Configuration.md](documentation/Configuration.md) for more information.
21+
22+
For documentation and reasoning on the rules themselves, see the [Documentation](DOCUMENTATION.md).
1923

2024
For users upgrading from StyleCop Classic, see [KnownChanges.md](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/tree/master/documentation/KnownChanges.md)
2125
for information about known differences which you may notice when switching to StyleCop Analyzers.
2226

27+
### C# language versions
28+
Not all versions of StyleCop.Analyzers support all features of each C# language version. The table below shows the minimum version of StyleCop.Analyzers required for proper support of a C# language version.
29+
30+
| C# version | StyleCop.Analyzers version | Visual Studio version |
31+
|------------|----------------------------|-----------------------|
32+
| 1.0 - 6.0 | v1.0.2 or higher | VS2015+ |
33+
| 7.0 - 7.3 | v1.1.0-beta or higher | VS2017 |
34+
2335
## Installation
2436

25-
StyleCopAnalyzers can be installed using the NuGet Package Manager in Visual Studio 2015.
37+
StyleCopAnalyzers can be installed using the NuGet command line or the NuGet Package Manager in Visual Studio 2015.
2638

39+
**Install using the command line:**
40+
```bash
41+
Install-Package StyleCop.Analyzers
42+
```
43+
44+
**Install using the package manager:**
2745
![Install via nuget](https://cloud.githubusercontent.com/assets/1408396/8233513/491f301a-159c-11e5-8b7a-1e16a0695da6.png)
2846

2947
## Team Considerations
3048

31-
If you use older versions of Visual Studio in addition to Visual Studio 2015, you may still install these analyzers. They will be automatically disabled when you open the project back up in Visual Studio 2013 or earlier.
49+
If you use older versions of Visual Studio in addition to Visual Studio 2015 or Visual Studio 2017, you may still install these analyzers. They will be automatically disabled when you open the project back up in Visual Studio 2013 or earlier.
3250

3351
## Contributing
3452

3553
See [Contributing](CONTRIBUTING.md)
3654

3755
## Current status
3856

39-
An up-to-date list of which StyleCop rules are implemented and which have code fixes can be found [here](http://stylecop.pdelvo.com/).
40-
41-
## Source browser
42-
43-
The up-to-date source code can be browsed [here](http://source.pdelvo.com/).
57+
An up-to-date list of which StyleCop rules are implemented and which have code fixes can be found [here](https://dotnetanalyzers.github.io/StyleCopAnalyzers/).
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<PropertyGroup>
5+
<Description>An implementation of StyleCop rules using the .NET Compiler Platform</Description>
6+
<Product>StyleCop.Analyzers</Product>
7+
<Company>Tunnel Vision Laboratories, LLC</Company>
8+
<Copyright>Copyright © Tunnel Vision Laboratories, LLC 2015</Copyright>
9+
<NeutralLanguage>en-US</NeutralLanguage>
10+
</PropertyGroup>
11+
12+
<PropertyGroup>
13+
<LangVersion>7.2</LangVersion>
14+
<Features>strict</Features>
15+
</PropertyGroup>
16+
17+
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
18+
<!-- Ideally this is always enabled, but that tends to hurt developer productivity -->
19+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
20+
</PropertyGroup>
21+
22+
<PropertyGroup>
23+
<DebugType>portable</DebugType>
24+
<DebugSymbols>true</DebugSymbols>
25+
</PropertyGroup>
26+
27+
<PropertyGroup>
28+
<!--
29+
Make sure any documentation comments which are included in code get checked for syntax during the build, but do
30+
not report warnings for missing comments.
31+
32+
CS1573: Parameter 'parameter' has no matching param tag in the XML comment for 'parameter' (but other parameters do)
33+
CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member'
34+
CS1712: Type parameter 'type_parameter' has no matching typeparam tag in the XML comment on 'type_or_member' (but other type parameters do)
35+
-->
36+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
37+
<NoWarn>$(NoWarn),1573,1591,1712</NoWarn>
38+
</PropertyGroup>
39+
40+
<ItemGroup>
41+
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
42+
</ItemGroup>
43+
44+
<ItemGroup>
45+
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" PrivateAssets="all" />
46+
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.46" PrivateAssets="all" />
47+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.1-beta.61" PrivateAssets="all" />
48+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="2.11.0-beta2-63603-03" PrivateAssets="all" />
49+
</ItemGroup>
50+
51+
<ItemGroup>
52+
<None Include="$(MSBuildThisFileDirectory)*.ruleset" Link="%(Filename)%(Extension)" />
53+
54+
<!-- Show launchSettings.json in the project if it exists. -->
55+
<None Include="$(AppDesignerFolder)\launchSettings.json" Condition="Exists('$(AppDesignerFolder)\launchSettings.json')" />
56+
</ItemGroup>
57+
58+
<ItemGroup>
59+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
60+
<Link>stylecop.json</Link>
61+
</AdditionalFiles>
62+
</ItemGroup>
63+
64+
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<ItemGroup>
5+
<!-- Enable code generation for resource files -->
6+
<CodeGenerationEmbeddedResource Include="@(EmbeddedResource)" Exclude="**\*.??-??.resx" />
7+
<EmbeddedResource Update="@(CodeGenerationEmbeddedResource)" Generator="ResXFileCodeGenerator" />
8+
</ItemGroup>
9+
10+
<!-- Special handling for embedded resources and generated files to show as nested in Solution Explorer -->
11+
<ItemGroup>
12+
<!-- Update designer files for *.resx files -->
13+
<Compile Update="@(CodeGenerationEmbeddedResource->'%(RecursiveDir)%(Filename).Designer.cs')" DependentUpon="$([System.IO.Path]::ChangeExtension($([System.IO.Path]::GetFileNameWithoutExtension(%(Identity))), '.resx'))" />
14+
15+
<!-- Localized embedded resources are just dependent on the parent RESX -->
16+
<EmbeddedResource Update="**\*.??-??.resx" DependentUpon="$([System.IO.Path]::ChangeExtension($([System.IO.Path]::GetFileNameWithoutExtension(%(Identity))), '.resx'))" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<None Include="$(MSBuildProjectFileDirectory)$(AssemblyOriginatorKeyFile)" Link="%(Filename)%(Extension)" />
21+
</ItemGroup>
22+
23+
</Project>

0 commit comments

Comments
 (0)