Skip to content

Commit d457c18

Browse files
authored
Merge pull request #2833 from sharwell/formatting-analyzer
Enable formatting analyzer
2 parents b396e85 + 4477845 commit d457c18

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

StyleCop.Analyzers/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" PrivateAssets="all" />
4646
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.46" PrivateAssets="all" />
4747
<PackageReference Include="StyleCop.Analyzers" Version="1.1.1-beta.61" PrivateAssets="all" />
48+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="2.11.0-beta2-63603-03" PrivateAssets="all" />
4849
</ItemGroup>
4950

5051
<ItemGroup>

StyleCop.Analyzers/StyleCop.Analyzers.ruleset

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Analyzers" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Analyzers">
7171
<Rule Id="RS1022" Action="None" /> <!-- https://github.com/dotnet/roslyn-analyzers/issues/1803 -->
7272
</Rules>
73+
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.CodeStyle" RuleNamespace="Microsoft.CodeAnalysis.CSharp.CodeStyle">
74+
<Rule Id="IDE0055" Action="Warning" />
75+
</Rules>
7376
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
7477
<Rule Id="IDE0003" Action="None" />
7578
</Rules>

StyleCop.Analyzers/StyleCop.Analyzers/LightJson/JsonValue.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,9 @@ public static explicit operator int(JsonValue jsonValue)
604604
/// Throws System.InvalidCastException when the inner value type of the
605605
/// JsonValue is not the desired type of the conversion.
606606
/// </exception>
607+
#pragma warning disable IDE0055 // Fix formatting
607608
public static explicit operator int?(JsonValue jsonValue)
609+
#pragma warning restore IDE0055 // Fix formatting
608610
{
609611
if (jsonValue.IsNull)
610612
{
@@ -640,7 +642,9 @@ public static explicit operator bool(JsonValue jsonValue)
640642
/// Throws System.InvalidCastException when the inner value type of the
641643
/// JsonValue is not the desired type of the conversion.
642644
/// </exception>
645+
#pragma warning disable IDE0055 // Fix formatting
643646
public static explicit operator bool?(JsonValue jsonValue)
647+
#pragma warning restore IDE0055 // Fix formatting
644648
{
645649
if (jsonValue.IsNull)
646650
{
@@ -676,7 +680,9 @@ public static explicit operator double(JsonValue jsonValue)
676680
/// Throws System.InvalidCastException when the inner value type of the
677681
/// JsonValue is not the desired type of the conversion.
678682
/// </exception>
683+
#pragma warning disable IDE0055 // Fix formatting
679684
public static explicit operator double?(JsonValue jsonValue)
685+
#pragma warning restore IDE0055 // Fix formatting
680686
{
681687
if (jsonValue.IsNull)
682688
{
@@ -758,7 +764,9 @@ public static explicit operator DateTime(JsonValue jsonValue)
758764
/// Converts the given JsonValue into a nullable DateTime.
759765
/// </summary>
760766
/// <param name="jsonValue">The JsonValue to be converted.</param>
767+
#pragma warning disable IDE0055 // Fix formatting
761768
public static explicit operator DateTime?(JsonValue jsonValue)
769+
#pragma warning restore IDE0055 // Fix formatting
762770
{
763771
if (jsonValue.IsDateTime || jsonValue.IsNull)
764772
{

0 commit comments

Comments
 (0)