Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Analyzers/CSharp/Analyzers/CSharpAnalyzers.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<Compile Include="$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionConstants.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileHeaders\CSharpFileHeaderDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileHeaders\CSharpFileHeaderHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnusedMembers\CSharpRemoveUnusedMembersDiagnosticAnalyzer.cs" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileHeaders\CSharpFileHeaderCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnusedMembers\CSharpRemoveUnusedMembersCodeFixProvider.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ public CSharpFileHeaderCodeFixProvider()
protected override ISyntaxFacts SyntaxFacts => CSharpSyntaxFacts.Instance;

protected override ISyntaxKinds SyntaxKinds => CSharpSyntaxKinds.Instance;

protected override SyntaxTrivia EndOfLine(string text)
=> SyntaxFactory.EndOfLine(text);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionFixAllTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileHeaders\FileHeaderTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnnecessaryCast\RemoveUnnecessaryCastTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnnecessaryCast\RemoveUnnecessaryCastTests_FixAllTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RemoveUnusedMembers\RemoveUnusedMembersTests.cs" />
Expand Down
3 changes: 3 additions & 0 deletions src/Analyzers/Core/Analyzers/Analyzers.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<Compile Include="$(MSBuildThisFileDirectory)DiagnosticAnalyzerCategory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DiagnosticCategory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DiagnosticCustomTags.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileHeaders\AbstractFileHeaderHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)FileHeaders\FileHeader.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\AnalyzerHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\DeserializationConstructorCheck.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\DiagnosticHelper.cs" />
Expand Down
12 changes: 12 additions & 0 deletions src/Analyzers/Core/Analyzers/AnalyzersResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,16 @@
<data name="Private_property_0_can_be_converted_to_a_method_as_its_get_accessor_is_never_invoked" xml:space="preserve">
<value>Private property '{0}' can be converted to a method as its get accessor is never invoked.</value>
</data>
<data name="A_source_file_is_missing_a_required_header" xml:space="preserve">
<value>A source file is missing a required header.</value>
</data>
<data name="The_file_header_is_missing_or_not_located_at_the_top_of_the_file" xml:space="preserve">
<value>The file header is missing or not located at the top of the file</value>
</data>
<data name="A_source_file_contains_a_header_that_does_not_match_the_required_text" xml:space="preserve">
<value>A source file contains a header that does not match the required text</value>
</data>
<data name="The_file_header_does_not_match_the_required_text" xml:space="preserve">
<value>The file header does not match the required text</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
using Microsoft.CodeAnalysis.Diagnostics;
using Roslyn.Utilities;

#if CODE_STYLE
using Microsoft.CodeAnalysis.Internal.Options;
#endif

namespace Microsoft.CodeAnalysis.FileHeaders
{
internal abstract class AbstractFileHeaderDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer
Expand All @@ -18,13 +22,13 @@ protected AbstractFileHeaderDiagnosticAnalyzer(string language)
IDEDiagnosticIds.FileHeaderMismatch,
CodeStyleOptions.FileHeaderTemplate,
language,
new LocalizableResourceString(nameof(FeaturesResources.The_file_header_is_missing_or_not_located_at_the_top_of_the_file), FeaturesResources.ResourceManager, typeof(FeaturesResources)),
new LocalizableResourceString(nameof(FeaturesResources.A_source_file_is_missing_a_required_header), FeaturesResources.ResourceManager, typeof(FeaturesResources)))
new LocalizableResourceString(nameof(AnalyzersResources.The_file_header_is_missing_or_not_located_at_the_top_of_the_file), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)),
new LocalizableResourceString(nameof(AnalyzersResources.A_source_file_is_missing_a_required_header), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)))
{
RoslynDebug.AssertNotNull(DescriptorId);

var invalidHeaderTitle = new LocalizableResourceString(nameof(FeaturesResources.The_file_header_does_not_match_the_required_text), FeaturesResources.ResourceManager, typeof(FeaturesResources));
var invalidHeaderMessage = new LocalizableResourceString(nameof(FeaturesResources.A_source_file_contains_a_header_that_does_not_match_the_required_text), FeaturesResources.ResourceManager, typeof(FeaturesResources));
var invalidHeaderTitle = new LocalizableResourceString(nameof(AnalyzersResources.The_file_header_does_not_match_the_required_text), AnalyzersResources.ResourceManager, typeof(AnalyzersResources));
var invalidHeaderMessage = new LocalizableResourceString(nameof(AnalyzersResources.A_source_file_contains_a_header_that_does_not_match_the_required_text), AnalyzersResources.ResourceManager, typeof(AnalyzersResources));
InvalidHeaderDescriptor = CreateDescriptorWithId(DescriptorId, invalidHeaderTitle, invalidHeaderMessage);
}

Expand Down
20 changes: 20 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="cs" original="../AnalyzersResources.resx">
<body>
<trans-unit id="A_source_file_contains_a_header_that_does_not_match_the_required_text">
<source>A source file contains a header that does not match the required text</source>
<target state="new">A source file contains a header that does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="A_source_file_is_missing_a_required_header">
<source>A source file is missing a required header.</source>
<target state="new">A source file is missing a required header.</target>
<note />
</trans-unit>
<trans-unit id="Private_member_0_can_be_removed_as_the_value_assigned_to_it_is_never_read">
<source>Private member '{0}' can be removed as the value assigned to it is never read.</source>
<target state="new">Private member '{0}' can be removed as the value assigned to it is never read.</target>
Expand Down Expand Up @@ -42,6 +52,16 @@
<target state="new">Remove unused private members</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_does_not_match_the_required_text">
<source>The file header does not match the required text</source>
<target state="new">The file header does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_is_missing_or_not_located_at_the_top_of_the_file">
<source>The file header is missing or not located at the top of the file</source>
<target state="new">The file header is missing or not located at the top of the file</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
20 changes: 20 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="de" original="../AnalyzersResources.resx">
<body>
<trans-unit id="A_source_file_contains_a_header_that_does_not_match_the_required_text">
<source>A source file contains a header that does not match the required text</source>
<target state="new">A source file contains a header that does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="A_source_file_is_missing_a_required_header">
<source>A source file is missing a required header.</source>
<target state="new">A source file is missing a required header.</target>
<note />
</trans-unit>
<trans-unit id="Private_member_0_can_be_removed_as_the_value_assigned_to_it_is_never_read">
<source>Private member '{0}' can be removed as the value assigned to it is never read.</source>
<target state="new">Private member '{0}' can be removed as the value assigned to it is never read.</target>
Expand Down Expand Up @@ -42,6 +52,16 @@
<target state="new">Remove unused private members</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_does_not_match_the_required_text">
<source>The file header does not match the required text</source>
<target state="new">The file header does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_is_missing_or_not_located_at_the_top_of_the_file">
<source>The file header is missing or not located at the top of the file</source>
<target state="new">The file header is missing or not located at the top of the file</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
20 changes: 20 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="es" original="../AnalyzersResources.resx">
<body>
<trans-unit id="A_source_file_contains_a_header_that_does_not_match_the_required_text">
<source>A source file contains a header that does not match the required text</source>
<target state="new">A source file contains a header that does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="A_source_file_is_missing_a_required_header">
<source>A source file is missing a required header.</source>
<target state="new">A source file is missing a required header.</target>
<note />
</trans-unit>
<trans-unit id="Private_member_0_can_be_removed_as_the_value_assigned_to_it_is_never_read">
<source>Private member '{0}' can be removed as the value assigned to it is never read.</source>
<target state="new">Private member '{0}' can be removed as the value assigned to it is never read.</target>
Expand Down Expand Up @@ -42,6 +52,16 @@
<target state="new">Remove unused private members</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_does_not_match_the_required_text">
<source>The file header does not match the required text</source>
<target state="new">The file header does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_is_missing_or_not_located_at_the_top_of_the_file">
<source>The file header is missing or not located at the top of the file</source>
<target state="new">The file header is missing or not located at the top of the file</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
20 changes: 20 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="fr" original="../AnalyzersResources.resx">
<body>
<trans-unit id="A_source_file_contains_a_header_that_does_not_match_the_required_text">
<source>A source file contains a header that does not match the required text</source>
<target state="new">A source file contains a header that does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="A_source_file_is_missing_a_required_header">
<source>A source file is missing a required header.</source>
<target state="new">A source file is missing a required header.</target>
<note />
</trans-unit>
<trans-unit id="Private_member_0_can_be_removed_as_the_value_assigned_to_it_is_never_read">
<source>Private member '{0}' can be removed as the value assigned to it is never read.</source>
<target state="new">Private member '{0}' can be removed as the value assigned to it is never read.</target>
Expand Down Expand Up @@ -42,6 +52,16 @@
<target state="new">Remove unused private members</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_does_not_match_the_required_text">
<source>The file header does not match the required text</source>
<target state="new">The file header does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_is_missing_or_not_located_at_the_top_of_the_file">
<source>The file header is missing or not located at the top of the file</source>
<target state="new">The file header is missing or not located at the top of the file</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
20 changes: 20 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="it" original="../AnalyzersResources.resx">
<body>
<trans-unit id="A_source_file_contains_a_header_that_does_not_match_the_required_text">
<source>A source file contains a header that does not match the required text</source>
<target state="new">A source file contains a header that does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="A_source_file_is_missing_a_required_header">
<source>A source file is missing a required header.</source>
<target state="new">A source file is missing a required header.</target>
<note />
</trans-unit>
<trans-unit id="Private_member_0_can_be_removed_as_the_value_assigned_to_it_is_never_read">
<source>Private member '{0}' can be removed as the value assigned to it is never read.</source>
<target state="new">Private member '{0}' can be removed as the value assigned to it is never read.</target>
Expand Down Expand Up @@ -42,6 +52,16 @@
<target state="new">Remove unused private members</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_does_not_match_the_required_text">
<source>The file header does not match the required text</source>
<target state="new">The file header does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_is_missing_or_not_located_at_the_top_of_the_file">
<source>The file header is missing or not located at the top of the file</source>
<target state="new">The file header is missing or not located at the top of the file</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
20 changes: 20 additions & 0 deletions src/Analyzers/Core/Analyzers/xlf/AnalyzersResources.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ja" original="../AnalyzersResources.resx">
<body>
<trans-unit id="A_source_file_contains_a_header_that_does_not_match_the_required_text">
<source>A source file contains a header that does not match the required text</source>
<target state="new">A source file contains a header that does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="A_source_file_is_missing_a_required_header">
<source>A source file is missing a required header.</source>
<target state="new">A source file is missing a required header.</target>
<note />
</trans-unit>
<trans-unit id="Private_member_0_can_be_removed_as_the_value_assigned_to_it_is_never_read">
<source>Private member '{0}' can be removed as the value assigned to it is never read.</source>
<target state="new">Private member '{0}' can be removed as the value assigned to it is never read.</target>
Expand Down Expand Up @@ -42,6 +52,16 @@
<target state="new">Remove unused private members</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_does_not_match_the_required_text">
<source>The file header does not match the required text</source>
<target state="new">The file header does not match the required text</target>
<note />
</trans-unit>
<trans-unit id="The_file_header_is_missing_or_not_located_at_the_top_of_the_file">
<source>The file header is missing or not located at the top of the file</source>
<target state="new">The file header is missing or not located at the top of the file</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
Loading