Skip to content

Commit

Permalink
Merge branch 'main' into patch-18
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Dec 24, 2022
2 parents 42ae81c + 5a425e7 commit 7a83a9a
Show file tree
Hide file tree
Showing 2,412 changed files with 372,323 additions and 116,320 deletions.
10 changes: 10 additions & 0 deletions .config/tsaoptions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"instanceUrl": "https://devdiv.visualstudio.com/",
"template": "TFSDEVDIV",
"projectName": "DEVDIV",
"areaPath": "DevDiv\\NET Developer Experience\\Productivity",
"iterationPath": "DevDiv",
"notificationAliases": [ "mlinfraswat@microsoft.com" ],
"repositoryName":"roslyn-analyzers",
"codebaseName": "roslyn-analyzers"
}
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"postCreateCommand": "devinit init"
}
7 changes: 7 additions & 0 deletions .devcontainer/devinit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"run": [
{
"tool": "require-dotnetcoresdk"
}
]
}
87 changes: 77 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ root = true
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# RS1024: Compare symbols correctly
# https://github.com/dotnet/roslyn-analyzers/issues/3389
dotnet_diagnostic.RS1024.severity = none

# IDE0078: Use pattern matching
# https://github.com/dotnet/roslyn/issues/51691
# https://github.com/dotnet/roslyn/issues/51693
dotnet_diagnostic.IDE0078.severity = silent

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
Expand Down Expand Up @@ -71,11 +80,6 @@ dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion

# Dispose rules (CA2000 and CA2213) ported to IDE analyzers. We already execute the CA rules on the repo, so disable the IDE ones.
dotnet_diagnostic.IDE0067.severity = none
dotnet_diagnostic.IDE0068.severity = none
dotnet_diagnostic.IDE0069.severity = none

### CSharp code style settings ###
[*.cs]

Expand Down Expand Up @@ -187,7 +191,7 @@ dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning
dotnet_diagnostic.IDE0066.severity = suggestion

# IDE0073: File header
file_header_template = Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
file_header_template = Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.

# IDE0001: Name can be simplified
dotnet_diagnostic.IDE0001.severity = silent
Expand All @@ -198,9 +202,6 @@ dotnet_diagnostic.IDE0002.severity = silent
# IDE0003: Name can be simplified
dotnet_diagnostic.IDE0003.severity = silent

# IDE005_gen: Remove unnecessary usings in generated code
dotnet_diagnostic.IDE0005_gen.severity = silent

# IDE0007: Use 'var' instead of explicit type
dotnet_diagnostic.IDE0007.severity = silent

Expand Down Expand Up @@ -229,7 +230,34 @@ dotnet_diagnostic.IDE0065.severity = silent
# IDE0072: Populate switch
dotnet_diagnostic.IDE0072.severity = silent

### Configuration for FxCop analyzers executed on this repo ###
# IDE0083: Use pattern matching
dotnet_diagnostic.IDE0083.severity = silent

# IDE0120: Simplify linq expression
dotnet_diagnostic.IDE0120.severity = silent

# IDE0130: Namespace does not match folder structure
dotnet_diagnostic.IDE0130.severity = silent

# IDE0150: Null check can be clarified
dotnet_diagnostic.IDE0150.severity = silent

# IDE2000: Allow multiple blank lines
dotnet_style_allow_multiple_blank_lines_experimental = false

# IDE2001: Embedded statements must be on their own line
csharp_style_allow_embedded_statements_on_same_line_experimental = false

# IDE2002: Consecutive braces must not have blank line between them
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false

# IDE2003: Blank line required between block and subsequent statement
dotnet_style_allow_statement_immediately_after_block_experimental = false

# IDE2004: Blank line not allowed after constructor initializer colon
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false

### Configuration for .Net analyzers executed on this repo ###
[*.{cs,vb}]

# Default analyzed API surface = 'all' (public APIs + non-public APIs)
Expand All @@ -246,3 +274,42 @@ dotnet_code_quality.CA1720.api_surface = public
# Exclude single letter type parameter names
# CA1715: Identifiers should have correct prefix
dotnet_code_quality.CA1715.exclude_single_letter_type_parameters = true

# CA1002: Do not expose generic lists
dotnet_diagnostic.CA1002.severity = suggestion

# CA1024: Use properties where appropriate
dotnet_diagnostic.CA1024.severity = suggestion

# CA1033: Interface methods should be callable by child types
dotnet_diagnostic.CA1033.severity = suggestion

# CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1307.severity = suggestion

# CA1711: Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1711.severity = suggestion

# CA1309: Use ordinal string comparison
dotnet_diagnostic.CA1309.severity = suggestion

# CA1305: Pass IFormatProvider - https://github.com/dotnet/roslyn-analyzers/issues/6379
dotnet_diagnostic.CA1305.severity = suggestion

# CA1851: Possible multiple enumerations of 'IEnumerable' collection - https://github.com/dotnet/roslyn-analyzers/issues/6379
dotnet_diagnostic.CA1851.severity = suggestion

### Configuration for PublicAPI analyzers executed on this repo ###
[*.{cs,vb}]

# Analyzers bail-out if the PublicAPI.*.txt file is not found
dotnet_public_api_analyzer.require_api_files = true

### Configuration for vs-threading analyzers executed on this repo ###
[*.{cs,vb}]

# VSTHRD002: Avoid problematic synchronous waits
dotnet_diagnostic.VSTHRD002.severity = none

# VSTHRD011: Use AsyncLazy<T>
dotnet_diagnostic.VSTHRD011.severity = none
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

56 changes: 56 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Bug report
about: Report a bug, false-positive or false-negative for a CAxxxx rule. For IDExxxx, please open an issue in dotnet/roslyn repository.
title: ''
labels: ''
assignees: ''

---

### Analyzer

**Diagnostic ID**: [CA2013](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2013): `Do not use ReferenceEquals with value types`

### Analyzer source

**SDK**: [Built-in CA analyzers in .NET 5 SDK or later](https://learn.microsoft.com/dotnet/fundamentals/productivity/code-analysis)

**Version**: [SDK 5.0.100](https://dotnet.microsoft.com/download/dotnet/5.0)

<!--
Note: Updates to NuGet package are more frequent than SDK, which means the NuGet package has fixes that haven't yet made it into the SDK.
Please check whether you can reproduce the bug you encountered in the latest NuGet package.
-->

_OR_

**NuGet Package**: [Microsoft.CodeAnalysis.NetAnalyzers](https://www.nuget.org/packages/Microsoft.CodeAnalysis.NetAnalyzers)

**Version**: 5.0.3 (Latest)

<!--
NOTE: `Microsoft.CodeAnalysis.FxCopAnalyzers` package has been deprecated in favor of 'Microsoft.CodeAnalysis.NetAnalyzers', that ships with the .NET SDK.
Please refer to https://learn.microsoft.com/visualstudio/code-quality/migrate-from-fxcop-analyzers-to-net-analyzers to migrate to .NET analyzers.
-->

### Describe the bug

<!-- A clear and concise description of what the bug is. -->

### Steps To Reproduce

<!--
Provide the steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
-->

### Expected behavior

### Actual behavior

## Additional context

<!-- Add any other context about the problem here. -->
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/rule-improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Rule improvement suggestion
about: Suggest an improvement for a rule
title: ''
labels: ''
assignees: ''

---

### Analyzer

**Diagnostic ID**: [CA1716](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1716)

### Describe the improvement

<!-- A clear and concise description of the improvement. -->

### Describe suggestions on how to achieve the rule

<!-- A clear description to how to achieve the rule. -->

### Additional context

<!-- Add any other context or screenshots about the rule request here. -->
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/suggest-a-new-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: New rule suggestion
about: Suggest a new rule
title: ''
labels: 'new-rule'
assignees: ''

---

<!-- Please refer to https://github.com/dotnet/roslyn-analyzers/blob/main/GuidelinesForNewRules.md -->

### Describe the problem you are trying to solve

<!-- A clear and concise description of what you want to the rule to prevent. -->

### Describe suggestions on how to achieve the rule

<!-- A clear description to how to achieve the rule. Suggest how a code-fix could automatically fix the issue/problem -->

### Additional context

<!-- Add any other context or screenshots about the rule request here. -->
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Make sure you have read the contribution guidelines:
- https://learn.microsoft.com/contribute/dotnet/dotnet-contribute-code-analysis#contribute-docs-for-caxxxx-rules
- https://github.com/dotnet/roslyn-analyzers/blob/main/GuidelinesForNewRules.md
If your Pull Request is doing one of the following:
- Adding a new diagnostic analyzer or a code fix
- Adding or updating resource strings used by analyzers and code fixes
- Updating analyzer package versions in [Versions.props](../eng/Versions.props)
Then, make sure to run `msbuild /t:pack /v:m` in the repository root; otherwise, the CI build will fail.
- This command must be run from a Visual Studio Developer Command Prompt
- Alternatively, `dotnet msbuild RoslynAnalyzers.sln -t:pack -v:m` can be used from a standard terminal window
Note: Consider merging the PR base branch (`2.9.x`, `main`, or `release/*`) into your branch before you run the pack command to reduce merge conflicts.
-->
48 changes: 48 additions & 0 deletions .github/workflows/community-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Label community PRs
on:
pull_request_target:
types: [opened]
permissions:
issues: write
pull-requests: write
jobs:
add_community_label:
runs-on: ubuntu-latest
if: ${{ github.repository == 'dotnet/roslyn-analyzers' && github.event.pull_request.user.login != 'dotnet-bot' && github.event.pull_request.user.login != 'dotnet-maestro[bot]' }}
steps:
- name: Get data
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORGANIZATION: dotnet
REPOSITORY: roslyn-analyzers
LABEL_NAME: Community
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
run: |
gh api graphql -f query='
query($org: String!, $repo: String!, $pull: Int!, $label: String!) {
repository(name: $repo, owner: $org) {
label(name: $label) {
id
}
pullRequest(number: $pull) {
authorAssociation
}
}
}' -f org=$ORGANIZATION -f repo=$REPOSITORY -F pull=$PULL_REQUEST_NUMBER -f label="$LABEL_NAME" > data.json
cat data.json
echo 'LABEL_ID='$(jq -r '.data.repository.label.id' data.json) >> $GITHUB_ENV
echo 'AUTHOR_ASSOCIATION='$(jq -r '.data.repository.pullRequest.authorAssociation' data.json) >> $GITHUB_ENV
- name: Assign label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
if: ${{ env.LABEL_ID != '' && env.LABEL_ID != 'null' && env.AUTHOR_ASSOCIATION != 'MEMBER' }}
run: |
gh api graphql -f query='
mutation($pull: ID!, $label: ID!) {
addLabelsToLabelable(input: {labelableId: $pull, labelIds: [$label]}) {
clientMutationId
}
}' -f pull=$PULL_REQUEST_ID -f label=$LABEL_ID
28 changes: 28 additions & 0 deletions .github/workflows/enable-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Enable auto merge
on:
pull_request_target:
types: [opened, ready_for_review]
permissions:
contents: write
jobs:
add_milestone:
runs-on: ubuntu-latest
if: ${{ github.repository == 'dotnet/roslyn-analyzers' && github.event.pull_request.user.login == 'dotnet-bot' && startsWith(github.event.pull_request.title, 'Localized file check-in') }}
steps:
- name: Enable pull request auto-merge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
run: |
gh api graphql -f query='
mutation($pull: ID!) {
enablePullRequestAutoMerge(input: {pullRequestId: $pull}) {
pullRequest {
id
number
autoMergeRequest {
mergeMethod
}
}
}
}' -f pull=$PULL_REQUEST_ID
Loading

0 comments on commit 7a83a9a

Please sign in to comment.