Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c4999dac
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,发现更多精彩内容 >>
提交
c4999dac
编写于
11月 01, 2014
作者:
J
jmarolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Setting rule defaults per Alex's guidance. (changeset 1365135)
上级
baa43682
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
37 addition
and
18 deletion
+37
-18
Src/Diagnostics/FxCop/Core/Design/AssemblyAttributesDiagnosticAnalyzer.cs
...FxCop/Core/Design/AssemblyAttributesDiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Design/CA1003DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Design/CA1003DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Design/CA1008DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Design/CA1008DiagnosticAnalyzer.cs
+3
-3
Src/Diagnostics/FxCop/Core/Design/CA1012DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Design/CA1012DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Design/CA1017DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Design/CA1017DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Design/CA1019DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Design/CA1019DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Design/CA1024DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Design/CA1024DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Design/CA1060DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Design/CA1060DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs
...tics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs
+2
-2
Src/Diagnostics/FxCop/Core/Design/StaticTypeRulesDiagnosticAnalyzer.cs
...cs/FxCop/Core/Design/StaticTypeRulesDiagnosticAnalyzer.cs
+2
-2
Src/Diagnostics/FxCop/Core/Globalization/CA1309DiagnosticAnalyzer.cs
...tics/FxCop/Core/Globalization/CA1309DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Naming/CA1708DiagnosticAnalyzer.cs
...Diagnostics/FxCop/Core/Naming/CA1708DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/FxCop/Core/Performance/CA1813DiagnosticAnalyzer.cs
...ostics/FxCop/Core/Performance/CA1813DiagnosticAnalyzer.cs
+1
-1
Src/Diagnostics/Test/Utilities/DiagnosticAnalyzerTestBase.cs
Src/Diagnostics/Test/Utilities/DiagnosticAnalyzerTestBase.cs
+20
-1
未找到文件。
Src/Diagnostics/FxCop/Core/Design/AssemblyAttributesDiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -28,7 +28,7 @@ public sealed class AssemblyAttributesDiagnosticAnalyzer : DiagnosticAnalyzer
FxCopRulesResources
.
MarkAssembliesWithCLSCompliantAttribute
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
MarkAssembliesWithCLSCompliantDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182156.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/CA1003DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -20,7 +20,7 @@ public abstract class CA1003DiagnosticAnalyzer : DiagnosticAnalyzer
FxCopRulesResources
.
UseGenericEventHandlerInstances
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
helpLink
:
"http://msdn.microsoft.com/library/ms182178.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/CA1008DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -45,7 +45,7 @@ public sealed class CA1008DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
FxCopRulesResources
.
EnumsShouldZeroValueFlagsRename
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
EnumsShouldHaveZeroValueDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182149.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
.
Concat
(
RuleRenameCustomTag
).
ToArray
());
...
...
@@ -55,7 +55,7 @@ public sealed class CA1008DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
FxCopRulesResources
.
EnumsShouldZeroValueFlagsMultipleZero
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
EnumsShouldHaveZeroValueDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182149.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
.
Concat
(
RuleMultipleZeroCustomTag
).
ToArray
());
...
...
@@ -65,7 +65,7 @@ public sealed class CA1008DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
FxCopRulesResources
.
EnumsShouldZeroValueNotFlagsNoZeroValue
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
EnumsShouldHaveZeroValueDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182149.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
.
Concat
(
RuleNoZeroCustomTag
).
ToArray
());
...
...
Src/Diagnostics/FxCop/Core/Design/CA1012DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -21,7 +21,7 @@ public sealed class CA1012DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
FxCopRulesResources
.
TypeIsAbstractButHasPublicConstructors
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
helpLink
:
"http://msdn.microsoft.com/library/ms182126.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/CA1017DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -18,7 +18,7 @@ public sealed class CA1017DiagnosticAnalyzer : DiagnosticAnalyzer
"{0}"
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
MarkAllAssembliesWithComVisibleDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182157.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/CA1019DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -25,7 +25,7 @@ public abstract class CA1019DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
"{0}"
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
helpLink
:
"http://msdn.microsoft.com/library/ms182136.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/CA1024DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -23,7 +23,7 @@ public abstract class CA1024DiagnosticAnalyzer<TLanguageKindEnum> : DiagnosticAn
FxCopRulesResources
.
ChangeToAPropertyIfAppropriate
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
UsePropertiesWhereAppropriateDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182181.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/CA1060DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -21,7 +21,7 @@ public sealed class CA1060DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
FxCopRulesResources
.
MovePInvokesToNativeMethodsClass
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
helpLink
:
"http://msdn.microsoft.com/library/ms182161.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -38,7 +38,7 @@ public abstract class EnumWithFlagsDiagnosticAnalyzer : AbstractNamedTypeAnalyze
FxCopRulesResources
.
MarkEnumsWithFlagsMessage
,
FxCopDiagnosticCategory
.
Design
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
MarkEnumsWithFlagsDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182159.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
@@ -48,7 +48,7 @@ public abstract class EnumWithFlagsDiagnosticAnalyzer : AbstractNamedTypeAnalyze
FxCopRulesResources
.
DoNotMarkEnumsWithFlagsMessage
,
FxCopDiagnosticCategory
.
Usage
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
DoNotMarkEnumsWithFlagsDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182335.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Design/StaticTypeRulesDiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -24,7 +24,7 @@ public sealed class StaticTypeRulesDiagnosticAnalyzer : AbstractNamedTypeAnalyze
FxCopRulesResources
.
StaticHolderTypeIsNotStatic
,
FxCopDiagnosticCategory
.
Usage
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
helpLink
:
"http://msdn.microsoft.com/library/ms182168.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
@@ -33,7 +33,7 @@ public sealed class StaticTypeRulesDiagnosticAnalyzer : AbstractNamedTypeAnalyze
FxCopRulesResources
.
StaticHolderTypesShouldNotHaveConstructorsMessage
,
FxCopDiagnosticCategory
.
Usage
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
helpLink
:
"http://msdn.microsoft.com/library/ms182169.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Globalization/CA1309DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -16,7 +16,7 @@ public abstract class CA1309DiagnosticAnalyzer : DiagnosticAnalyzer
FxCopRulesResources
.
StringComparisonShouldBeOrdinalOrOrdinalIgnoreCase
,
FxCopDiagnosticCategory
.
Globalization
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
StringComparisonShouldBeOrdinalDescription
,
helpLink
:
"http://msdn.microsoft.com/library/bb385972.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Naming/CA1708DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -28,7 +28,7 @@ public sealed class CA1708DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
FxCopRulesResources
.
IdentifierNamesShouldDifferMoreThanCase
,
FxCopDiagnosticCategory
.
Naming
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
description
:
FxCopRulesResources
.
IdentifiersShouldDifferByMoreThanCaseDescription
,
helpLink
:
"http://msdn.microsoft.com/library/ms182242.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/FxCop/Core/Performance/CA1813DiagnosticAnalyzer.cs
浏览文件 @
c4999dac
...
...
@@ -21,7 +21,7 @@ public sealed class CA1813DiagnosticAnalyzer : AbstractNamedTypeAnalyzer
FxCopRulesResources
.
SealAttributeTypesForImprovedPerf
,
FxCopDiagnosticCategory
.
Performance
,
DiagnosticSeverity
.
Warning
,
isEnabledByDefault
:
tru
e
,
isEnabledByDefault
:
fals
e
,
helpLink
:
"http://msdn.microsoft.com/library/ms182267.aspx"
,
customTags
:
DiagnosticCustomTags
.
Microsoft
);
...
...
Src/Diagnostics/Test/Utilities/DiagnosticAnalyzerTestBase.cs
浏览文件 @
c4999dac
...
...
@@ -261,6 +261,8 @@ protected static Diagnostic[] GetSortedDiagnostics(DiagnosticAnalyzer analyzer,
foreach
(
var
project
in
projects
)
{
var
compilation
=
project
.
GetCompilationAsync
().
Result
;
compilation
=
EnableAnalyzer
(
analyzer
,
compilation
);
var
diags
=
compilation
.
GetAnalyzerDiagnostics
(
new
[]
{
analyzer
});
foreach
(
var
diag
in
diags
)
...
...
@@ -293,10 +295,27 @@ protected static Diagnostic[] GetSortedDiagnostics(DiagnosticAnalyzer analyzer,
return
results
;
}
private
static
Compilation
EnableAnalyzer
(
DiagnosticAnalyzer
analyzer
,
Compilation
compilation
)
{
return
compilation
.
WithOptions
(
compilation
.
Options
.
WithSpecificDiagnosticOptions
(
analyzer
.
SupportedDiagnostics
.
Select
(
x
=>
KeyValuePair
.
Create
(
x
.
Id
,
ReportDiagnostic
.
Default
))
.
ToImmutableDictionaryOrEmpty
()));
}
protected
static
void
AnalyzeDocumentCore
(
DiagnosticAnalyzer
analyzer
,
Document
document
,
Action
<
Diagnostic
>
addDiagnostic
,
TextSpan
?
span
=
null
,
Func
<
Exception
,
DiagnosticAnalyzer
,
bool
>
continueOnAnalyzerException
=
null
)
{
var
semanticModel
=
document
.
GetSemanticModelAsync
().
Result
;
var
diagnostics
=
semanticModel
.
Compilation
.
GetAnalyzerDiagnostics
(
new
[]
{
analyzer
},
continueOnAnalyzerException
:
continueOnAnalyzerException
);
var
compilation
=
semanticModel
.
Compilation
;
compilation
=
EnableAnalyzer
(
analyzer
,
compilation
);
var
diagnostics
=
compilation
.
GetAnalyzerDiagnostics
(
new
[]
{
analyzer
},
continueOnAnalyzerException
:
continueOnAnalyzerException
);
foreach
(
var
diagnostic
in
diagnostics
)
{
if
(!
span
.
HasValue
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录