Skip to content
Draft
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
111 changes: 111 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,117 @@ dotnet_diagnostic.CA1510.severity = none
# https://github.com/dotnet/roslyn-analyzers/issues/6500
dotnet_diagnostic.CA1825.severity = none

# IDE0016: Use 'throw' expression - project preference
dotnet_diagnostic.IDE0016.severity = none

# IDE0067: Dispose objects before losing scope
dotnet_diagnostic.IDE0067.severity = none

# SA0001: XML comment analysis is disabled
dotnet_diagnostic.SA0001.severity = none

# SA1316: Tuple element names should use correct casing
dotnet_diagnostic.SA1316.severity = none

# CA1014: Mark assemblies with CLSCompliantAttribute
dotnet_diagnostic.CA1014.severity = none

# CA1062: Validate arguments of public methods
dotnet_diagnostic.CA1062.severity = none

# RS1038: Compiler extensions should be implemented in assemblies with compiler-provided references
dotnet_diagnostic.RS1038.severity = none

# RS1041: Compiler extensions conflicting namespaces
dotnet_diagnostic.RS1041.severity = none

# StyleCop Suppressions
dotnet_diagnostic.SA1005.severity = none
dotnet_diagnostic.SA1008.severity = none
dotnet_diagnostic.SA1027.severity = none
dotnet_diagnostic.SA1028.severity = none
dotnet_diagnostic.SA1100.severity = none
dotnet_diagnostic.SA1101.severity = none
dotnet_diagnostic.SA1118.severity = none
dotnet_diagnostic.SA1119.severity = none
dotnet_diagnostic.SA1124.severity = none
dotnet_diagnostic.SA1127.severity = none
dotnet_diagnostic.SA1128.severity = none
dotnet_diagnostic.SA1129.severity = none
dotnet_diagnostic.SA1130.severity = none
dotnet_diagnostic.SA1200.severity = none
dotnet_diagnostic.SA1201.severity = none
dotnet_diagnostic.SA1202.severity = none
dotnet_diagnostic.SA1203.severity = none
dotnet_diagnostic.SA1204.severity = none
dotnet_diagnostic.SA1205.severity = none
dotnet_diagnostic.SA1214.severity = none
dotnet_diagnostic.SA1215.severity = none
dotnet_diagnostic.SA1311.severity = none
dotnet_diagnostic.SA1400.severity = none
dotnet_diagnostic.SA1401.severity = none
dotnet_diagnostic.SA1402.severity = none
dotnet_diagnostic.SA1404.severity = none
dotnet_diagnostic.SA1504.severity = none
dotnet_diagnostic.SA1512.severity = none
dotnet_diagnostic.SA1513.severity = none
dotnet_diagnostic.SA1515.severity = none
dotnet_diagnostic.SA1516.severity = none
dotnet_diagnostic.SA1518.severity = none
dotnet_diagnostic.SA1600.severity = none
dotnet_diagnostic.SA1601.severity = none
dotnet_diagnostic.SA1602.severity = none
dotnet_diagnostic.SA1603.severity = none
dotnet_diagnostic.SA1604.severity = none
dotnet_diagnostic.SA1605.severity = none
dotnet_diagnostic.SA1606.severity = none
dotnet_diagnostic.SA1607.severity = none
dotnet_diagnostic.SA1608.severity = none
dotnet_diagnostic.SA1609.severity = none
dotnet_diagnostic.SA1610.severity = none
dotnet_diagnostic.SA1611.severity = none
dotnet_diagnostic.SA1612.severity = none
dotnet_diagnostic.SA1613.severity = none
dotnet_diagnostic.SA1614.severity = none
dotnet_diagnostic.SA1615.severity = none
dotnet_diagnostic.SA1616.severity = none
dotnet_diagnostic.SA1617.severity = none
dotnet_diagnostic.SA1618.severity = none
dotnet_diagnostic.SA1619.severity = none
dotnet_diagnostic.SA1620.severity = none
dotnet_diagnostic.SA1621.severity = none
dotnet_diagnostic.SA1622.severity = none
dotnet_diagnostic.SA1623.severity = none
dotnet_diagnostic.SA1624.severity = none
dotnet_diagnostic.SA1625.severity = none
dotnet_diagnostic.SA1626.severity = none
dotnet_diagnostic.SA1627.severity = none
dotnet_diagnostic.SA1628.severity = none
dotnet_diagnostic.SA1629.severity = none
dotnet_diagnostic.SA1630.severity = none
dotnet_diagnostic.SA1631.severity = none
dotnet_diagnostic.SA1632.severity = none
dotnet_diagnostic.SA1633.severity = none
dotnet_diagnostic.SA1634.severity = none
dotnet_diagnostic.SA1635.severity = none
dotnet_diagnostic.SA1636.severity = none
dotnet_diagnostic.SA1637.severity = none
dotnet_diagnostic.SA1638.severity = none
dotnet_diagnostic.SA1639.severity = none
dotnet_diagnostic.SA1640.severity = none
dotnet_diagnostic.SA1641.severity = none
dotnet_diagnostic.SA1642.severity = none
dotnet_diagnostic.SA1643.severity = none
dotnet_diagnostic.SA1644.severity = none
dotnet_diagnostic.SA1645.severity = none
dotnet_diagnostic.SA1646.severity = none
dotnet_diagnostic.SA1647.severity = none
dotnet_diagnostic.SA1648.severity = none
dotnet_diagnostic.SA1649.severity = none
dotnet_diagnostic.SA1650.severity = none
dotnet_diagnostic.SA1651.severity = none
dotnet_diagnostic.SA1652.severity = none

# XML-based project files

# RS1025: Configure generated code analysis - suppressed until we can decide how we want to handle it (wrt FileDetailCache).
Expand Down
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@

<WTGIsTestProject Condition="$(MSBuildProjectFile.Contains('.Test.'))">True</WTGIsTestProject>
<WTGIsTestProject Condition="$(MSBuildProjectFile.Contains('.TestFramework.'))">True</WTGIsTestProject>
<LangVersion>8.0</LangVersion>
<LangVersion>14</LangVersion>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<CodeAnalysisRuleSet>$(BuildDirectory)CodeAnalysis.ruleset</CodeAnalysisRuleSet>

<!--
- The major and minor versions should match the Roslyn API version,
- and the major/minor/build versions should match the NuGet package version (NuGet is x.y.z only)
- Revision should be incremented whenever you want to publish a new version.
-->
<ShortVersion Condition=" '$(TagVersion)' == '' ">3.7.2</ShortVersion>
<ShortVersion Condition=" '$(TagVersion)' == '' ">4.14.0</ShortVersion>
<ShortVersion Condition=" '$(TagVersion)' != '' ">$(TagVersion.Split('-', 2)[0])</ShortVersion>
<VersionSuffix Condition=" '$(TagVersion)' != '' ">$(TagVersion.Substring($(ShortVersion.Length)))</VersionSuffix>

Expand All @@ -32,9 +32,9 @@
<FileVersion>$(Version)</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(WTGIsTestProject)' == 'True'">
<CodeAnalysisRuleSet>$(BuildDirectory)CodeAnalysis.Test.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup Condition="'$(WTGIsTestProject)' == 'True'">
<GlobalAnalyzerConfigFiles Include="$(BuildDirectory)CodeAnalysis.Test.globalconfig" />
</ItemGroup>

<PropertyGroup Condition="'$(RunCodeAnalysis)' == 'True'">
<DebugType>full</DebugType>
Expand Down
2 changes: 1 addition & 1 deletion WTG.Analyzers.Utils.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<icon>images\icon.png</icon>
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="3.7.0" />
<dependency id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="4.14.0" />
</group>
</dependencies>
</metadata>
Expand Down
7 changes: 7 additions & 0 deletions build/CodeAnalysis.Test.globalconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
is_global = true

# CA1707: Identifiers should not contain underscores - acceptable in test methods
dotnet_diagnostic.CA1707.severity = none

# RS1036: Specify analyzer banned API enforcement setting
dotnet_diagnostic.RS1036.severity = none
7 changes: 0 additions & 7 deletions build/CodeAnalysis.Test.ruleset

This file was deleted.

17 changes: 0 additions & 17 deletions build/CodeAnalysis.ruleset

This file was deleted.

96 changes: 0 additions & 96 deletions build/StyleCopAnalyzers.ruleset

This file was deleted.

2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.300",
"version": "10.0.100",
"rollForward": "latestMinor"
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<diagnostics id="WTG2004" message="This project does not use Code Contracts." severity="Warning">
<suppressId>CS0305</suppressId>
<suppressId>CS0308</suppressId>
<suppressId>CS0839</suppressId>
<suppressId>CS1002</suppressId>
<suppressId>CS1501</suppressId>
<suppressId>CS1513</suppressId>
<suppressId>CS1525</suppressId>
<suppressId>CS8389</suppressId>
<diagnostic>
<location>Test0.cs: (17,3-34)</location>
</diagnostic>
Expand Down
6 changes: 1 addition & 5 deletions src/WTG.Analyzers.Test/WTG.Analyzers.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
<EmbeddedResource Include="TestData\**\*.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
<OutputPath>..\..\bin</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
4 changes: 3 additions & 1 deletion src/WTG.Analyzers.TestFramework/Helpers/CodeFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ static async Task<SyntaxNode> FormatTree(Document document)
throw new NotSupportedException("Cannot format a document with no syntax tree.");
}

return Formatter.Format(root, Formatter.Annotation, document.Project.Solution.Workspace);
var formattedDoc = await Formatter.FormatAsync(document, Formatter.Annotation).ConfigureAwait(false);
return await formattedDoc.GetSyntaxRootAsync().ConfigureAwait(false)
?? throw new NotSupportedException("GetSyntaxRootAsync should not return null for a C# document.");
}

sealed class DummyFixAllDiagnosticProvider : FixAllContext.DiagnosticProvider
Expand Down
Loading