-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[Dogfooding] Enforce few more code style rules as build warnings in IDE projects #44164
Conversation
…warning for IDE projects (CodeStyle, Features and Workspaces layers)
# IDE0011: Add braces csharp_prefer_braces = when_multiline:warning # IDE0035: Remove unreachable code dotnet_diagnostic.IDE0035.severity = warning # IDE0059: Unnecessary assignment to a value dotnet_diagnostic.IDE0059.severity = warning
… value (we do not offer code fixes to remove such assignments which could have side effects)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler changes LGTM.
…is options collection in master branch, but my prior commit in this PR attempted to use it in the test. This leads the test to fail, so I have restored the original semantics of the test and removed an unused local.
@@ -106,7 +106,6 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) | |||
var declaratorLocation = diagnostic.AdditionalLocations[0]; | |||
var identifierLocation = diagnostic.AdditionalLocations[1]; | |||
var invocationOrCreationLocation = diagnostic.AdditionalLocations[2]; | |||
var outArgumentContainingStatementLocation = diagnostic.AdditionalLocations[3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shoudl probably fix the analzer to not provide this either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyrusNajmabadi addressed in d256ecd
// Invocations definitely have side effects. So we assume this | ||
// is invalid initially; | ||
expressionType = ExpressionType.Invalid; | ||
#pragma warning restore IDE0059 // Unnecessary assignment of a value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am actually not sure if this would cause any side effects, especially given the comment. Just playing safe.
@@ -33,7 +33,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification | |||
Public Sub Initialize(parseOptions As ParseOptions, optionSet As OptionSet, cancellationToken As CancellationToken) Implements IReductionRewriter.Initialize | |||
Me.ParseOptions = DirectCast(parseOptions, VisualBasicParseOptions) | |||
_simplificationOptions = optionSet | |||
cancellationToken = cancellationToken | |||
Me.CancellationToken = cancellationToken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops!
… IDE projects My prior attempt to enable this as a build warning in dotnet#44164 did not work due to dotnet#44201. This PR actually adds the build enforcement and fixes the violations.
Builds on top of #43394