Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
14f447e8
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,发现更多精彩内容 >>
未验证
提交
14f447e8
编写于
3月 30, 2020
作者:
M
msftbot[bot]
提交者:
GitHub
3月 30, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #42882 from mavasani/PortValidateFormatString
Port ValidateFormatString analyzer and tests to shared layer
上级
4996759d
0e746c47
变更
40
隐藏空白更改
内联
并排
Showing
40 changed file
with
260 addition
and
251 deletion
+260
-251
src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
+1
-0
src/Analyzers/CSharp/Analyzers/ValidateFormatString/CSharpValidateFormatStringDiagnosticAnalyzer.cs
...matString/CSharpValidateFormatStringDiagnosticAnalyzer.cs
+0
-0
src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems
...nalyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems
+1
-0
src/Analyzers/CSharp/Tests/ValidateFormatString/ValidateFormatStringTests.cs
...p/Tests/ValidateFormatString/ValidateFormatStringTests.cs
+53
-58
src/Analyzers/Core/Analyzers/Analyzers.projitems
src/Analyzers/Core/Analyzers/Analyzers.projitems
+2
-0
src/Analyzers/Core/Analyzers/AnalyzersResources.resx
src/Analyzers/Core/Analyzers/AnalyzersResources.resx
+6
-0
src/Analyzers/Core/Analyzers/ValidateFormatString/AbstractValidateFormatStringDiagnosticAnalyzer.cs
...tString/AbstractValidateFormatStringDiagnosticAnalyzer.cs
+9
-9
src/Analyzers/Core/Analyzers/ValidateFormatString/ValidateFormatStringOption.cs
...lyzers/ValidateFormatString/ValidateFormatStringOption.cs
+20
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.cs.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.cs.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.de.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.de.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.es.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.es.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.fr.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.fr.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.it.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.it.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ja.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ja.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ko.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ko.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.pl.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.pl.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.pt-BR.xlf
...Analyzers/Core/Analyzers/xlf/AnalyzersResources.pt-BR.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ru.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ru.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.tr.xlf
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.tr.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.zh-Hans.xlf
...alyzers/Core/Analyzers/xlf/AnalyzersResources.zh-Hans.xlf
+10
-0
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.zh-Hant.xlf
...alyzers/Core/Analyzers/xlf/AnalyzersResources.zh-Hant.xlf
+10
-0
src/Analyzers/VisualBasic/Analyzers/ValidateFormatString/VisualBasicValidateFormatStringDiagnosticAnalyzer.vb
...ring/VisualBasicValidateFormatStringDiagnosticAnalyzer.vb
+0
-0
src/Analyzers/VisualBasic/Analyzers/VisualBasicAnalyzers.projitems
...zers/VisualBasic/Analyzers/VisualBasicAnalyzers.projitems
+1
-0
src/Analyzers/VisualBasic/Tests/ValidateFormatString/ValidateFormatStringTests.vb
...c/Tests/ValidateFormatString/ValidateFormatStringTests.vb
+36
-38
src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems
...isualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems
+1
-0
src/Features/Core/Portable/FeaturesResources.resx
src/Features/Core/Portable/FeaturesResources.resx
+0
-6
src/Features/Core/Portable/ValidateFormatString/ValidateFormatStringOptionProvider.cs
...alidateFormatString/ValidateFormatStringOptionProvider.cs
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf
src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.de.xlf
src/Features/Core/Portable/xlf/FeaturesResources.de.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.es.xlf
src/Features/Core/Portable/xlf/FeaturesResources.es.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf
src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.it.xlf
src/Features/Core/Portable/xlf/FeaturesResources.it.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf
src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf
src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf
src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf
src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf
src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf
src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf
+0
-10
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf
+0
-10
未找到文件。
src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
浏览文件 @
14f447e8
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\CSharpUseThrowExpressionDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\CSharpUseThrowExpressionDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
...
...
src/
Features/CSharp/Portable
/ValidateFormatString/CSharpValidateFormatStringDiagnosticAnalyzer.cs
→
src/
Analyzers/CSharp/Analyzers
/ValidateFormatString/CSharpValidateFormatStringDiagnosticAnalyzer.cs
浏览文件 @
14f447e8
文件已移动
src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems
浏览文件 @
14f447e8
...
@@ -65,6 +65,7 @@
...
@@ -65,6 +65,7 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzerTests_FixAllTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzerTests_FixAllTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\UseThrowExpressionTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\UseThrowExpressionTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\UseThrowExpressionTests_FixAllTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\UseThrowExpressionTests_FixAllTests.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ValidateFormatString\ValidateFormatStringTests.cs"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
...
...
src/
EditorFeatures/CSharpTest
/ValidateFormatString/ValidateFormatStringTests.cs
→
src/
Analyzers/CSharp/Tests
/ValidateFormatString/ValidateFormatStringTests.cs
浏览文件 @
14f447e8
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
using
Microsoft.CodeAnalysis.CSharp.ValidateFormatString
;
using
Microsoft.CodeAnalysis.CSharp.ValidateFormatString
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Microsoft.CodeAnalysis.ValidateFormatString
;
using
Microsoft.CodeAnalysis.ValidateFormatString
;
...
@@ -21,21 +22,13 @@ public class ValidateFormatStringTests : AbstractCSharpDiagnosticProviderBasedUs
...
@@ -21,21 +22,13 @@ public class ValidateFormatStringTests : AbstractCSharpDiagnosticProviderBasedUs
internal
override
(
DiagnosticAnalyzer
,
CodeFixProvider
)
CreateDiagnosticProviderAndFixer
(
Workspace
workspace
)
internal
override
(
DiagnosticAnalyzer
,
CodeFixProvider
)
CreateDiagnosticProviderAndFixer
(
Workspace
workspace
)
=>
(
new
CSharpValidateFormatStringDiagnosticAnalyzer
(),
null
);
=>
(
new
CSharpValidateFormatStringDiagnosticAnalyzer
(),
null
);
private
IDictionary
<
OptionKey2
,
object
>
CSharpOptionOffVBOptionOn
()
private
IOptionsCollection
CSharpOptionOffVBOptionOn
()
=>
OptionsSet
(
{
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
false
),
var
optionsSet
=
new
Dictionary
<
OptionKey2
,
object
>();
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
true
));
optionsSet
.
Add
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
false
);
optionsSet
.
Add
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
true
);
return
optionsSet
;
}
private
IDictionary
<
OptionKey2
,
object
>
CSharpOptionOnVBOptionOff
()
private
IOptionsCollection
CSharpOptionOnVBOptionOff
()
=>
OptionsSet
(
{
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
true
),
var
optionsSet
=
new
Dictionary
<
OptionKey2
,
object
>();
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
false
));
optionsSet
.
Add
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
true
);
optionsSet
.
Add
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
false
);
return
optionsSet
;
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
public
async
Task
OnePlaceholder
()
public
async
Task
OnePlaceholder
()
...
@@ -544,33 +537,35 @@ static void Main(string[] args)
...
@@ -544,33 +537,35 @@ static void Main(string[] args)
"
);
"
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
#if CODE_STYLE
public
async
Task
WarningTurnedOff
()
[
InlineData
(
false
,
true
)]
// Option has no effect on CodeStyle layer CI execution as it is not an editorconfig option.
{
#else
await
TestDiagnosticMissingAsync
(
@" class Program
[
InlineData
(
false
,
false
)]
{
#endif
static void Main(string[] args)
[
InlineData
(
true
,
true
)]
{
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
string.Format(""This {1[||]} works"", ""test"");
public
async
Task
TestOption
(
bool
optionOn
,
bool
expectDiagnostic
)
}
}
"
,
new
TestParameters
(
options
:
CSharpOptionOffVBOptionOn
()));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
public
async
Task
WarningTurnedOn
()
{
{
await
TestDiagnosticInfoAsync
(
@" class Program
var
source
=
@" class Program
{
{
static void Main(string[] args)
static void Main(string[] args)
{
{
string.Format(""This [|{1}|] is my test"", ""teststring1"");
string.Format(""This [|{1}|] is my test"", ""teststring1"");
}
}
}"
,
}"
;
options
:
CSharpOptionOnVBOptionOff
(),
var
options
=
optionOn
?
CSharpOptionOnVBOptionOff
()
:
CSharpOptionOffVBOptionOn
();
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
if
(!
expectDiagnostic
)
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
{
diagnosticMessage
:
FeaturesResources
.
Format_string_contains_invalid_placeholder
);
await
TestDiagnosticMissingAsync
(
source
,
new
TestParameters
(
options
:
options
));
}
else
{
await
TestDiagnosticInfoAsync
(
source
,
options
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
AnalyzersResources
.
Format_string_contains_invalid_placeholder
);
}
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -586,7 +581,7 @@ static void Main(string[] args)
...
@@ -586,7 +581,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -602,7 +597,7 @@ static void Main(string[] args)
...
@@ -602,7 +597,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -618,7 +613,7 @@ static void Main(string[] args)
...
@@ -618,7 +613,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -635,7 +630,7 @@ static void Main(string[] args)
...
@@ -635,7 +630,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -652,7 +647,7 @@ static void Main(string[] args)
...
@@ -652,7 +647,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -669,7 +664,7 @@ static void Main(string[] args)
...
@@ -669,7 +664,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -687,7 +682,7 @@ static void Main(string[] args)
...
@@ -687,7 +682,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -705,7 +700,7 @@ static void Main(string[] args)
...
@@ -705,7 +700,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -721,7 +716,7 @@ static void Main(string[] args)
...
@@ -721,7 +716,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -737,7 +732,7 @@ static void Main(string[] args)
...
@@ -737,7 +732,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -753,7 +748,7 @@ static void Main(string[] args)
...
@@ -753,7 +748,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -769,7 +764,7 @@ static void Main(string[] args)
...
@@ -769,7 +764,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -786,7 +781,7 @@ static void Main(string[] args)
...
@@ -786,7 +781,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -803,7 +798,7 @@ static void Main(string[] args)
...
@@ -803,7 +798,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -820,7 +815,7 @@ static void Main(string[] args)
...
@@ -820,7 +815,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -846,7 +841,7 @@ static void Main(string[] args)
...
@@ -846,7 +841,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -863,7 +858,7 @@ static void Main(string[] args)
...
@@ -863,7 +858,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -880,7 +875,7 @@ static void Main(string[] args)
...
@@ -880,7 +875,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -897,7 +892,7 @@ static void Main(string[] args)
...
@@ -897,7 +892,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -914,7 +909,7 @@ static void Main(string[] args)
...
@@ -914,7 +909,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -931,7 +926,7 @@ static void Main(string[] args)
...
@@ -931,7 +926,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -948,7 +943,7 @@ static void Main(string[] args)
...
@@ -948,7 +943,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
...
@@ -965,7 +960,7 @@ static void Main(string[] args)
...
@@ -965,7 +960,7 @@ static void Main(string[] args)
options
:
null
,
options
:
null
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
Feature
sResources
.
Format_string_contains_invalid_placeholder
);
diagnosticMessage
:
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
);
}
}
[
WorkItem
(
29398
,
"https://github.com/dotnet/roslyn/issues/29398"
)]
[
WorkItem
(
29398
,
"https://github.com/dotnet/roslyn/issues/29398"
)]
...
...
src/Analyzers/Core/Analyzers/Analyzers.projitems
浏览文件 @
14f447e8
...
@@ -61,6 +61,8 @@
...
@@ -61,6 +61,8 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\ObjectCreationExpressionAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\ObjectCreationExpressionAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ValidateFormatString\ValidateFormatStringOption.cs"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
...
...
src/Analyzers/Core/Analyzers/AnalyzersResources.resx
浏览文件 @
14f447e8
...
@@ -256,4 +256,10 @@
...
@@ -256,4 +256,10 @@
<data
name=
"Use_null_propagation"
xml:space=
"preserve"
>
<data
name=
"Use_null_propagation"
xml:space=
"preserve"
>
<value>
Use null propagation
</value>
<value>
Use null propagation
</value>
</data>
</data>
<data
name=
"Format_string_contains_invalid_placeholder"
xml:space=
"preserve"
>
<value>
Format string contains invalid placeholder
</value>
</data>
<data
name=
"Invalid_format_string"
xml:space=
"preserve"
>
<value>
Invalid format string
</value>
</data>
</root>
</root>
\ No newline at end of file
src/
Features/Core/Portable
/ValidateFormatString/AbstractValidateFormatStringDiagnosticAnalyzer.cs
→
src/
Analyzers/Core/Analyzers
/ValidateFormatString/AbstractValidateFormatStringDiagnosticAnalyzer.cs
浏览文件 @
14f447e8
...
@@ -19,19 +19,19 @@ internal abstract class AbstractValidateFormatStringDiagnosticAnalyzer<TSyntaxKi
...
@@ -19,19 +19,19 @@ internal abstract class AbstractValidateFormatStringDiagnosticAnalyzer<TSyntaxKi
private
const
string
DiagnosticID
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
;
private
const
string
DiagnosticID
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
;
private
static
readonly
LocalizableString
Title
=
new
LocalizableResourceString
(
private
static
readonly
LocalizableString
Title
=
new
LocalizableResourceString
(
nameof
(
Feature
sResources
.
Invalid_format_string
),
nameof
(
Analyzer
sResources
.
Invalid_format_string
),
Feature
sResources
.
ResourceManager
,
Analyzer
sResources
.
ResourceManager
,
typeof
(
Feature
sResources
));
typeof
(
Analyzer
sResources
));
private
static
readonly
LocalizableString
MessageFormat
=
new
LocalizableResourceString
(
private
static
readonly
LocalizableString
MessageFormat
=
new
LocalizableResourceString
(
nameof
(
Feature
sResources
.
Format_string_contains_invalid_placeholder
),
nameof
(
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
),
Feature
sResources
.
ResourceManager
,
Analyzer
sResources
.
ResourceManager
,
typeof
(
Feature
sResources
));
typeof
(
Analyzer
sResources
));
private
static
readonly
LocalizableString
Description
=
new
LocalizableResourceString
(
private
static
readonly
LocalizableString
Description
=
new
LocalizableResourceString
(
nameof
(
Feature
sResources
.
Invalid_format_string
),
nameof
(
Analyzer
sResources
.
Invalid_format_string
),
Feature
sResources
.
ResourceManager
,
Analyzer
sResources
.
ResourceManager
,
typeof
(
Feature
sResources
));
typeof
(
Analyzer
sResources
));
private
static
readonly
DiagnosticDescriptor
Rule
=
new
DiagnosticDescriptor
(
private
static
readonly
DiagnosticDescriptor
Rule
=
new
DiagnosticDescriptor
(
DiagnosticID
,
DiagnosticID
,
...
...
src/Analyzers/Core/Analyzers/ValidateFormatString/ValidateFormatStringOption.cs
0 → 100644
浏览文件 @
14f447e8
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
using
Microsoft.CodeAnalysis.Options
;
namespace
Microsoft.CodeAnalysis.ValidateFormatString
{
internal
class
ValidateFormatStringOption
{
public
static
PerLanguageOption2
<
bool
>
ReportInvalidPlaceholdersInStringDotFormatCalls
=
new
PerLanguageOption2
<
bool
>(
nameof
(
ValidateFormatStringOption
),
nameof
(
ReportInvalidPlaceholdersInStringDotFormatCalls
),
defaultValue
:
true
,
storageLocations
:
new
RoamingProfileStorageLocation
(
"TextEditor.%LANGUAGE%.Specific.WarnOnInvalidStringDotFormatCalls"
));
}
}
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.cs.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.de.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.es.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.fr.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.it.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ja.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ko.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.pl.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.pt-BR.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ru.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.tr.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.zh-Hans.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.zh-Hant.xlf
浏览文件 @
14f447e8
...
@@ -62,6 +62,16 @@
...
@@ -62,6 +62,16 @@
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<target
state=
"new"
>
Collection initialization can be simplified
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"new"
>
Format string contains invalid placeholder
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"new"
>
Invalid format string
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Make_field_readonly"
>
<trans-unit
id=
"Make_field_readonly"
>
<source>
Make field readonly
</source>
<source>
Make field readonly
</source>
<target
state=
"new"
>
Make field readonly
</target>
<target
state=
"new"
>
Make field readonly
</target>
...
...
src/
Features/VisualBasic/Portable
/ValidateFormatString/VisualBasicValidateFormatStringDiagnosticAnalyzer.vb
→
src/
Analyzers/VisualBasic/Analyzers
/ValidateFormatString/VisualBasicValidateFormatStringDiagnosticAnalyzer.vb
浏览文件 @
14f447e8
文件已移动
src/Analyzers/VisualBasic/Analyzers/VisualBasicAnalyzers.projitems
浏览文件 @
14f447e8
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)UseIsNullCheck\VisualBasicUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseIsNullCheck\VisualBasicUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseNullPropagation\VisualBasicUseNullPropagationDiagnosticAnalyzer.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseNullPropagation\VisualBasicUseNullPropagationDiagnosticAnalyzer.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\VisualBasicUseObjectInitializerDiagnosticAnalyzer.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\VisualBasicUseObjectInitializerDiagnosticAnalyzer.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ValidateFormatString\VisualBasicValidateFormatStringDiagnosticAnalyzer.vb"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
...
...
src/
EditorFeatures/VisualBasicTest
/ValidateFormatString/ValidateFormatStringTests.vb
→
src/
Analyzers/VisualBasic/Tests
/ValidateFormatString/ValidateFormatStringTests.vb
浏览文件 @
14f447e8
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
Imports
Microsoft.CodeAnalysis.CodeFixes
Imports
Microsoft.CodeAnalysis.CodeFixes
Imports
Microsoft.CodeAnalysis.Diagnostics
Imports
Microsoft.CodeAnalysis.Diagnostics
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics
Imports
Microsoft.CodeAnalysis.Options
Imports
Microsoft.CodeAnalysis.Options
Imports
Microsoft.CodeAnalysis.ValidateFormatString
Imports
Microsoft.CodeAnalysis.ValidateFormatString
...
@@ -18,24 +19,16 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ValidateFormatStri
...
@@ -18,24 +19,16 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ValidateFormatStri
Return
(
New
VisualBasicValidateFormatStringDiagnosticAnalyzer
,
Nothing
)
Return
(
New
VisualBasicValidateFormatStringDiagnosticAnalyzer
,
Nothing
)
End
Function
End
Function
Private
Function
VBOptionOnCSharpOptionOff
()
As
IDictionary
(
Of
OptionKey2
,
Object
)
Private
Function
VBOptionOnCSharpOptionOff
()
As
IOptionsCollection
Dim
optionsSet
=
New
Dictionary
(
Of
OptionKey2
,
Object
)
From
Return
OptionsSet
(
{
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
False
),
{
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
False
},
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
True
))
{
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
True
}
}
Return
optionsSet
End
Function
End
Function
Private
Function
VBOptionOffCSharpOptionOn
()
As
IDictionary
(
Of
OptionKey2
,
Object
)
Private
Function
VBOptionOffCSharpOptionOn
()
As
IOptionsCollection
Dim
optionsSet
=
New
Dictionary
(
Of
OptionKey2
,
Object
)
From
Return
OptionsSet
(
{
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
True
),
{
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
True
},
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
False
))
{
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
False
}
}
Return
optionsSet
End
Function
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
...
@@ -81,7 +74,7 @@ End Class",
...
@@ -81,7 +74,7 @@ End Class",
options
:
=
Nothing
,
options
:
=
Nothing
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
=
Feature
sResources
.
Format_string_contains_invalid_placeholder
)
diagnosticMessage
:
=
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
)
End
Function
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
...
@@ -95,7 +88,7 @@ End Class",
...
@@ -95,7 +88,7 @@ End Class",
options
:
=
Nothing
,
options
:
=
Nothing
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
=
Feature
sResources
.
Format_string_contains_invalid_placeholder
)
diagnosticMessage
:
=
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
)
End
Function
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
...
@@ -111,7 +104,7 @@ End Class",
...
@@ -111,7 +104,7 @@ End Class",
options
:
=
Nothing
,
options
:
=
Nothing
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
=
Feature
sResources
.
Format_string_contains_invalid_placeholder
)
diagnosticMessage
:
=
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
)
End
Function
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
...
@@ -135,7 +128,7 @@ End Class",
...
@@ -135,7 +128,7 @@ End Class",
options
:
=
Nothing
,
options
:
=
Nothing
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
=
Feature
sResources
.
Format_string_contains_invalid_placeholder
)
diagnosticMessage
:
=
Analyzer
sResources
.
Format_string_contains_invalid_placeholder
)
End
Function
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
...
@@ -291,28 +284,33 @@ End Class")
...
@@ -291,28 +284,33 @@ End Class")
End Module"
)
End Module"
)
End
Function
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
#If CODE_STYLE Then
Public
Async
Function
WarningTurnedOff
()
As
Task
<
InlineData
(
False
,
True
)
>
' Option has no effect on CodeStyle layer CI execution as it is not an editorconfig option.
Await
TestDiagnosticMissingAsync
(
"
<
InlineData
(
True
,
True
)
>
Class C
<
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
Sub Main
Public
Async
Function
TestOption
(
optionOn
As
Boolean
,
expectDiagnostic
As
Boolean
)
As
Task
string.Format(
""
This {0} {1} {[||]2} works
""
, New Object {
""
test
""
,
""
test2
""
,
""
test3
""
})
#
Else
End Sub
<
InlineData
(
False
,
False
)
>
End Class"
,
New
TestParameters
(
options
:
=
VBOptionOffCSharpOptionOn
))
<
InlineData
(
True
,
True
)
>
End
Function
<
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
Public
Async
Function
TestOption
(
optionOn
As
Boolean
,
expectDiagnostic
As
Boolean
)
As
Task
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
#End If
Public
Async
Function
WarningTurnedOn
()
As
Task
Dim
source
=
"
Await
TestDiagnosticInfoAsync
(
"
Class C
Class C
Sub Main
Sub Main
string.Format(
""
This {0} [|{2}|] works
""
,
""
test
""
,
""
also
""
)
string.Format(
""
This {0} [|{2}|] works
""
,
""
test
""
,
""
also
""
)
End Sub
End Sub
End Class"
,
End Class"
options
:
=
VBOptionOnCSharpOptionOff
,
Dim
options
=
If
(
optionOn
,
VBOptionOnCSharpOptionOff
(),
VBOptionOffCSharpOptionOn
())
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
If
Not
expectDiagnostic
Then
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
Await
TestDiagnosticMissingAsync
(
source
,
New
TestParameters
(
options
:
=
options
))
diagnosticMessage
:
=
FeaturesResources
.
Format_string_contains_invalid_placeholder
)
Else
Await
TestDiagnosticInfoAsync
(
source
,
options
,
diagnosticId
:
=
IDEDiagnosticIds
.
ValidateFormatStringDiagnosticID
,
diagnosticSeverity
:
=
DiagnosticSeverity
.
Warning
,
diagnosticMessage
:
=
AnalyzersResources
.
Format_string_contains_invalid_placeholder
)
End
If
End
Function
End
Function
End
Class
End
Class
End
Namespace
End
Namespace
src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems
浏览文件 @
14f447e8
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
<Compile
Include=
"$(MSBuildThisFileDirectory)UseExplicitTupleName\UseExplicitTupleNameTests.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseExplicitTupleName\UseExplicitTupleNameTests.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseNullPropagation\UseNullPropagationTests.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseNullPropagation\UseNullPropagationTests.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\UseObjectInitializerTests.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)UseObjectInitializer\UseObjectInitializerTests.vb"
/>
<Compile
Include=
"$(MSBuildThisFileDirectory)ValidateFormatString\ValidateFormatStringTests.vb"
/>
</ItemGroup>
</ItemGroup>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ItemGroup
Condition=
"'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'"
>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
<ExpectedCompile
Include=
"$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)"
/>
...
...
src/Features/Core/Portable/FeaturesResources.resx
浏览文件 @
14f447e8
...
@@ -1126,12 +1126,6 @@ This version used in: {2}</value>
...
@@ -1126,12 +1126,6 @@ This version used in: {2}</value>
<data
name=
"Implement_0"
xml:space=
"preserve"
>
<data
name=
"Implement_0"
xml:space=
"preserve"
>
<value>
Implement {0}
</value>
<value>
Implement {0}
</value>
</data>
</data>
<data
name=
"Format_string_contains_invalid_placeholder"
xml:space=
"preserve"
>
<value>
Format string contains invalid placeholder
</value>
</data>
<data
name=
"Invalid_format_string"
xml:space=
"preserve"
>
<value>
Invalid format string
</value>
</data>
<data
name=
"Use_inferred_member_name"
xml:space=
"preserve"
>
<data
name=
"Use_inferred_member_name"
xml:space=
"preserve"
>
<value>
Use inferred member name
</value>
<value>
Use inferred member name
</value>
</data>
</data>
...
...
src/Features/Core/Portable/ValidateFormatString/ValidateFormatStringOption.cs
→
src/Features/Core/Portable/ValidateFormatString/ValidateFormatStringOption
Provider
.cs
浏览文件 @
14f447e8
...
@@ -13,16 +13,6 @@
...
@@ -13,16 +13,6 @@
namespace
Microsoft.CodeAnalysis.ValidateFormatString
namespace
Microsoft.CodeAnalysis.ValidateFormatString
{
{
internal
class
ValidateFormatStringOption
{
public
static
PerLanguageOption2
<
bool
>
ReportInvalidPlaceholdersInStringDotFormatCalls
=
new
PerLanguageOption2
<
bool
>(
nameof
(
ValidateFormatStringOption
),
nameof
(
ReportInvalidPlaceholdersInStringDotFormatCalls
),
defaultValue
:
true
,
storageLocations
:
new
RoamingProfileStorageLocation
(
"TextEditor.%LANGUAGE%.Specific.WarnOnInvalidStringDotFormatCalls"
));
}
[
ExportOptionProvider
,
Shared
]
[
ExportOptionProvider
,
Shared
]
internal
class
ValidateFormatStringOptionProvider
:
IOptionProvider
internal
class
ValidateFormatStringOptionProvider
:
IOptionProvider
{
{
...
...
src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Tato verze se používá zde: {2}.</target>
...
@@ -2230,16 +2230,6 @@ Tato verze se používá zde: {2}.</target>
<target
state=
"translated"
>
Implementovat {0}
</target>
<target
state=
"translated"
>
Implementovat {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
Formátovací řetězec obsahuje neplatný zástupný symbol.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Neplatný formátovací řetězec
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Použít odvozený název člena
</target>
<target
state=
"translated"
>
Použít odvozený název člena
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.de.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Diese Version wird verwendet in: {2}</target>
...
@@ -2230,16 +2230,6 @@ Diese Version wird verwendet in: {2}</target>
<target
state=
"translated"
>
{0} implementieren
</target>
<target
state=
"translated"
>
{0} implementieren
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
Die Formatzeichenfolge enthält einen ungültigen Platzhalter.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Ungültige Formatzeichenfolge
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Abgeleiteten Membernamen verwenden
</target>
<target
state=
"translated"
>
Abgeleiteten Membernamen verwenden
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.es.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Esta versión se utiliza en: {2}</target>
...
@@ -2230,16 +2230,6 @@ Esta versión se utiliza en: {2}</target>
<target
state=
"translated"
>
Implementar {0}
</target>
<target
state=
"translated"
>
Implementar {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
La cadena de formato contiene un marcador de posición no válido.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Cadena de formato no válida
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Usar nombre de miembro inferido
</target>
<target
state=
"translated"
>
Usar nombre de miembro inferido
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Version utilisée dans : {2}</target>
...
@@ -2230,16 +2230,6 @@ Version utilisée dans : {2}</target>
<target
state=
"translated"
>
Implémenter {0}
</target>
<target
state=
"translated"
>
Implémenter {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
La chaîne de format contient un espace réservé non valide
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Chaîne de format non valide
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Utiliser un nom de membre déduit
</target>
<target
state=
"translated"
>
Utiliser un nom de membre déduit
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.it.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Questa versione è usata {2}</target>
...
@@ -2230,16 +2230,6 @@ Questa versione è usata {2}</target>
<target
state=
"translated"
>
Implementa {0}
</target>
<target
state=
"translated"
>
Implementa {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
La stringa di formato contiene un segnaposto non valido
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Stringa di formato non valida
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Usa il nome di membro dedotto
</target>
<target
state=
"translated"
>
Usa il nome di membro dedotto
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
<target
state=
"translated"
>
{0} を実装する
</target>
<target
state=
"translated"
>
{0} を実装する
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
書式設定文字列に無効なプレース ホルダーが含まれています
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
無効な書式設定文字列
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
推定メンバーの名前を使用します
</target>
<target
state=
"translated"
>
推定メンバーの名前を使用します
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
<target
state=
"translated"
>
{0} 구현
</target>
<target
state=
"translated"
>
{0} 구현
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
형식 문자열에 잘못된 자리 표시자가 포함되어 있습니다.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
잘못된 형식 문자열
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
유추 멤버 이름 사용
</target>
<target
state=
"translated"
>
유추 멤버 이름 사용
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Ta wersja jest używana wersja: {2}</target>
...
@@ -2230,16 +2230,6 @@ Ta wersja jest używana wersja: {2}</target>
<target
state=
"translated"
>
Implementuj {0}
</target>
<target
state=
"translated"
>
Implementuj {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
Ciąg formatu zawiera nieprawidłowy symbol zastępczy
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Nieprawidłowy ciąg formatu
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Użyj nazwy wywnioskowanego elementu członkowskiego
</target>
<target
state=
"translated"
>
Użyj nazwy wywnioskowanego elementu członkowskiego
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Essa versão é usada no: {2}</target>
...
@@ -2230,16 +2230,6 @@ Essa versão é usada no: {2}</target>
<target
state=
"translated"
>
Implementar {0}
</target>
<target
state=
"translated"
>
Implementar {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
A cadeia de formato contém espaço reservado inválido
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Cadeia de formato inválida
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Usar o nome do membro inferido
</target>
<target
state=
"translated"
>
Usar o nome do membro inferido
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
<target
state=
"translated"
>
Реализация {0}
</target>
<target
state=
"translated"
>
Реализация {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
Строка формата содержит недопустимый заполнитель
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Недопустимая строка формата
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Использовать имя выводимого элемента
</target>
<target
state=
"translated"
>
Использовать имя выводимого элемента
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ Bu sürüm şurada kullanılır: {2}</target>
...
@@ -2230,16 +2230,6 @@ Bu sürüm şurada kullanılır: {2}</target>
<target
state=
"translated"
>
{0} uygula
</target>
<target
state=
"translated"
>
{0} uygula
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
Biçim dizesi, geçersiz yer tutucu içeriyor
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
Geçersiz biçim dizesi
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
Gösterilen üye adı kullan
</target>
<target
state=
"translated"
>
Gösterilen üye adı kullan
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
<target
state=
"translated"
>
实现 {0}
</target>
<target
state=
"translated"
>
实现 {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
格式字符串包含无效的占位符
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
无效的格式字符串
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
使用推断的成员名称
</target>
<target
state=
"translated"
>
使用推断的成员名称
</target>
...
...
src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf
浏览文件 @
14f447e8
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
...
@@ -2230,16 +2230,6 @@ This version used in: {2}</source>
<target
state=
"translated"
>
實作 {0}
</target>
<target
state=
"translated"
>
實作 {0}
</target>
<note
/>
<note
/>
</trans-unit>
</trans-unit>
<trans-unit
id=
"Format_string_contains_invalid_placeholder"
>
<source>
Format string contains invalid placeholder
</source>
<target
state=
"translated"
>
格式字串包含無效的預留位置
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Invalid_format_string"
>
<source>
Invalid format string
</source>
<target
state=
"translated"
>
格式字串無效
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"Use_inferred_member_name"
>
<trans-unit
id=
"Use_inferred_member_name"
>
<source>
Use inferred member name
</source>
<source>
Use inferred member name
</source>
<target
state=
"translated"
>
使用推斷的成員名稱
</target>
<target
state=
"translated"
>
使用推斷的成員名稱
</target>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录