Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
dd66dbaf
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
dd66dbaf
编写于
6月 06, 2020
作者:
C
CyrusNajmabadi
提交者:
GitHub
6月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #44922 from CyrusNajmabadi/removeSuppression
Rename new feature to 'remove confusing suppression'
上级
695da895
dab17484
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
26 addition
and
26 deletion
+26
-26
src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
+1
-1
src/Analyzers/CSharp/Analyzers/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs
...ion/CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs
+4
-4
src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
+2
-2
src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs
...ession/CSharpRemoveConfusingSuppressionCodeFixProvider.cs
+5
-5
src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionFixAllProvider.cs
...ression/CSharpRemoveConfusingSuppressionFixAllProvider.cs
+4
-4
src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems
...nalyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems
+1
-1
src/Analyzers/CSharp/Tests/RemoveConfusingSuppression/RemoveConfusingSuppressionTests.cs
...veConfusingSuppression/RemoveConfusingSuppressionTests.cs
+8
-8
src/Analyzers/Core/Analyzers/IDEDiagnosticIds.cs
src/Analyzers/Core/Analyzers/IDEDiagnosticIds.cs
+1
-1
未找到文件。
src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
浏览文件 @
dd66dbaf
...
...
@@ -20,7 +20,7 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnnecessarySuppressions\CSharpRemoveUnnecessarySuppressionsDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
UnnecessarySuppression\CSharpRemoveUnnecessary
SuppressionDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
ConfusingSuppression\CSharpRemoveConfusing
SuppressionDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"..\..\..\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ConvertAnonymousTypeToTuple\CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionConstants.cs"
/>
...
...
src/Analyzers/CSharp/Analyzers/Remove
UnnecessarySuppression/CSharpRemoveUnnecessary
SuppressionDiagnosticAnalyzer.cs
→
src/Analyzers/CSharp/Analyzers/Remove
ConfusingSuppression/CSharpRemoveConfusing
SuppressionDiagnosticAnalyzer.cs
浏览文件 @
dd66dbaf
...
...
@@ -10,13 +10,13 @@
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.CSharp.Remove
Unnecessary
Suppression
namespace
Microsoft.CodeAnalysis.CSharp.Remove
Confusing
Suppression
{
[
DiagnosticAnalyzer
(
LanguageNames
.
CSharp
)]
internal
class
CSharpRemove
Unnecessary
SuppressionDiagnosticAnalyzer
:
AbstractCodeStyleDiagnosticAnalyzer
internal
class
CSharpRemove
Confusing
SuppressionDiagnosticAnalyzer
:
AbstractCodeStyleDiagnosticAnalyzer
{
public
CSharpRemove
Unnecessary
SuppressionDiagnosticAnalyzer
()
:
base
(
IDEDiagnosticIds
.
Remove
Unnecessary
SuppressionForIsExpressionDiagnosticId
,
public
CSharpRemove
Confusing
SuppressionDiagnosticAnalyzer
()
:
base
(
IDEDiagnosticIds
.
Remove
Confusing
SuppressionForIsExpressionDiagnosticId
,
new
LocalizableResourceString
(
nameof
(
CSharpAnalyzersResources
.
Remove_unnecessary_suppression_operator
),
CSharpAnalyzersResources
.
ResourceManager
,
typeof
(
CSharpAnalyzersResources
)),
new
LocalizableResourceString
(
nameof
(
CSharpAnalyzersResources
.
Suppression_operator_has_no_effect_and_can_be_misinterpreted
),
CSharpAnalyzersResources
.
ResourceManager
,
typeof
(
CSharpAnalyzersResources
)))
{
...
...
src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
浏览文件 @
dd66dbaf
...
...
@@ -30,8 +30,8 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)QualifyMemberAccess\CSharpQualifyMemberAccessCodeFixProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnnecessaryImports\CSharpRemoveUnnecessaryImportsCodeFixProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
UnnecessarySuppression\CSharpRemoveUnnecessary
SuppressionCodeFixProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
UnnecessarySuppression\CSharpRemoveUnnecessary
SuppressionFixAllProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
ConfusingSuppression\CSharpRemoveConfusing
SuppressionCodeFixProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
ConfusingSuppression\CSharpRemoveConfusing
SuppressionFixAllProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryParenthesesCodeFixProvider.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnusedMembers\CSharpRemoveUnusedMembersCodeFixProvider.cs"
/>
...
...
src/Analyzers/CSharp/CodeFixes/Remove
UnnecessarySuppression/CSharpRemoveUnnecessary
SuppressionCodeFixProvider.cs
→
src/Analyzers/CSharp/CodeFixes/Remove
ConfusingSuppression/CSharpRemoveConfusing
SuppressionCodeFixProvider.cs
浏览文件 @
dd66dbaf
...
...
@@ -20,25 +20,25 @@
using
Microsoft.CodeAnalysis.Shared.Extensions
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.CSharp.Remove
Unnecessary
Suppression
namespace
Microsoft.CodeAnalysis.CSharp.Remove
Confusing
Suppression
{
[
ExportCodeFixProvider
(
LanguageNames
.
CSharp
),
Shared
]
internal
sealed
partial
class
CSharpRemove
Unnecessary
SuppressionCodeFixProvider
:
CodeFixProvider
internal
sealed
partial
class
CSharpRemove
Confusing
SuppressionCodeFixProvider
:
CodeFixProvider
{
public
const
string
RemoveOperator
=
nameof
(
RemoveOperator
);
public
const
string
NegateExpression
=
nameof
(
NegateExpression
);
[
ImportingConstructor
]
[
Obsolete
(
MefConstruction
.
ImportingConstructorMessage
,
error
:
true
)]
public
CSharpRemove
Unnecessary
SuppressionCodeFixProvider
()
public
CSharpRemove
Confusing
SuppressionCodeFixProvider
()
{
}
public
override
ImmutableArray
<
string
>
FixableDiagnosticIds
=>
ImmutableArray
.
Create
(
IDEDiagnosticIds
.
Remove
Unnecessary
SuppressionForIsExpressionDiagnosticId
);
=>
ImmutableArray
.
Create
(
IDEDiagnosticIds
.
Remove
Confusing
SuppressionForIsExpressionDiagnosticId
);
public
override
FixAllProvider
GetFixAllProvider
()
=>
new
CSharpRemove
Unnecessary
SuppressionFixAllProvider
();
=>
new
CSharpRemove
Confusing
SuppressionFixAllProvider
();
public
override
Task
RegisterCodeFixesAsync
(
CodeFixContext
context
)
{
...
...
src/Analyzers/CSharp/CodeFixes/Remove
UnnecessarySuppression/CSharpRemoveUnnecessary
SuppressionFixAllProvider.cs
→
src/Analyzers/CSharp/CodeFixes/Remove
ConfusingSuppression/CSharpRemoveConfusing
SuppressionFixAllProvider.cs
浏览文件 @
dd66dbaf
...
...
@@ -8,13 +8,13 @@
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.CodeFixes
;
namespace
Microsoft.CodeAnalysis.CSharp.Remove
Unnecessary
Suppression
namespace
Microsoft.CodeAnalysis.CSharp.Remove
Confusing
Suppression
{
internal
partial
class
CSharpRemove
Unnecessary
SuppressionCodeFixProvider
internal
partial
class
CSharpRemove
Confusing
SuppressionCodeFixProvider
{
private
class
CSharpRemove
Unnecessary
SuppressionFixAllProvider
:
DocumentBasedFixAllProvider
private
class
CSharpRemove
Confusing
SuppressionFixAllProvider
:
DocumentBasedFixAllProvider
{
public
CSharpRemove
Unnecessary
SuppressionFixAllProvider
()
public
CSharpRemove
Confusing
SuppressionFixAllProvider
()
{
}
...
...
src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems
浏览文件 @
dd66dbaf
...
...
@@ -25,7 +25,7 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProviderTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)OrderModifiers\OrderModifiersCompilerErrorTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)OrderModifiers\OrderModifiersTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
UnnecessarySuppression\RemoveUnnecessary
SuppressionTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)Remove
ConfusingSuppression\RemoveConfusing
SuppressionTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UpdateLegacySuppressions\UpdateLegacySuppressionsTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnnecessarySuppressions\RemoveUnnecessarySuppressionsTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)RemoveUnnecessaryParentheses\RemoveUnnecessaryPatternParenthesesTests.cs"
/>
...
...
src/Analyzers/CSharp/Tests/Remove
UnnecessarySuppression/RemoveUnnecessary
SuppressionTests.cs
→
src/Analyzers/CSharp/Tests/Remove
ConfusingSuppression/RemoveConfusing
SuppressionTests.cs
浏览文件 @
dd66dbaf
...
...
@@ -4,17 +4,17 @@
using
System.Threading.Tasks
;
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.CSharp.Remove
Unnecessary
Suppression
;
using
Microsoft.CodeAnalysis.CSharp.Remove
Confusing
Suppression
;
using
Microsoft.CodeAnalysis.CSharp.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.
RemoveUnnecessarySuppression
namespace
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.
Confusing
{
using
VerifyCS
=
CSharpCodeFixVerifier
<
CSharpRemove
UnnecessarySuppressionDiagnosticAnalyzer
,
CSharpRemoveUnnecessary
SuppressionCodeFixProvider
>;
using
VerifyCS
=
CSharpCodeFixVerifier
<
CSharpRemove
ConfusingSuppressionDiagnosticAnalyzer
,
CSharpRemoveConfusing
SuppressionCodeFixProvider
>;
public
class
Remove
Unnecessary
SuppressionTests
public
class
Remove
Confusing
SuppressionTests
{
[
Fact
,
WorkItem
(
44872
,
"https://github.com/dotnet/roslyn/issues/44872"
)]
public
async
Task
TestRemoveWithIsExpression1
()
...
...
@@ -240,7 +240,7 @@ void M(object o)
}
}"
,
NumberOfFixAllIterations
=
1
,
CodeActionEquivalenceKey
=
CSharpRemove
Unnecessary
SuppressionCodeFixProvider
.
RemoveOperator
,
CodeActionEquivalenceKey
=
CSharpRemove
Confusing
SuppressionCodeFixProvider
.
RemoveOperator
,
}.
RunAsync
();
}
...
...
@@ -278,7 +278,7 @@ void M(object o)
}
}"
,
CodeActionIndex
=
1
,
CodeActionEquivalenceKey
=
CSharpRemove
Unnecessary
SuppressionCodeFixProvider
.
NegateExpression
,
CodeActionEquivalenceKey
=
CSharpRemove
Confusing
SuppressionCodeFixProvider
.
NegateExpression
,
NumberOfFixAllIterations
=
1
,
}.
RunAsync
();
}
...
...
@@ -317,7 +317,7 @@ void M(object o)
}
}"
,
NumberOfFixAllIterations
=
1
,
CodeActionEquivalenceKey
=
CSharpRemove
Unnecessary
SuppressionCodeFixProvider
.
RemoveOperator
,
CodeActionEquivalenceKey
=
CSharpRemove
Confusing
SuppressionCodeFixProvider
.
RemoveOperator
,
}.
RunAsync
();
}
...
...
@@ -356,7 +356,7 @@ void M(object o)
}"
,
NumberOfFixAllIterations
=
1
,
CodeActionIndex
=
1
,
CodeActionEquivalenceKey
=
CSharpRemove
Unnecessary
SuppressionCodeFixProvider
.
NegateExpression
,
CodeActionEquivalenceKey
=
CSharpRemove
Confusing
SuppressionCodeFixProvider
.
NegateExpression
,
}.
RunAsync
();
}
}
...
...
src/Analyzers/Core/Analyzers/IDEDiagnosticIds.cs
浏览文件 @
dd66dbaf
...
...
@@ -133,7 +133,7 @@ internal static class IDEDiagnosticIds
public
const
string
InvalidSuppressMessageAttributeDiagnosticId
=
"IDE0076"
;
public
const
string
LegacyFormatSuppressMessageAttributeDiagnosticId
=
"IDE0077"
;
public
const
string
Remove
Unnecessary
SuppressionForIsExpressionDiagnosticId
=
"IDE0080"
;
public
const
string
Remove
Confusing
SuppressionForIsExpressionDiagnosticId
=
"IDE0080"
;
// Analyzer error Ids
public
const
string
AnalyzerChangedId
=
"IDE1001"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录