Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update S1905: False Positive with 'default' #2321

Merged
merged 2 commits into from
Mar 7, 2019
Merged

Update S1905: False Positive with 'default' #2321

merged 2 commits into from
Mar 7, 2019

Conversation

Evangelink
Copy link
Contributor

Fix #2295

@ghost ghost assigned Evangelink Mar 6, 2019
@ghost ghost added the Status: Needs Review label Mar 6, 2019
@@ -83,7 +84,8 @@ protected override void Initialize(SonarAnalysisContext context)
return;
}

if (expressionType.Equals(castType))
if (expressionType.Equals(castType)
&& !expression.IsKind(SyntaxKindEx.DefaultLiteralExpression))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we exclude all default expressions.

}
</pre>
<h2>Exceptions</h2>
<p>Issues are not raised against C# 7.1 `default` literal.</p>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updates the RSPEC to mention the exclusion.

@Evangelink Evangelink merged commit 1e4d3b0 into master Mar 7, 2019
@ghost ghost removed the Status: Needs Review label Mar 7, 2019
@Evangelink Evangelink deleted the ammo/S1905 branch March 7, 2019 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant