-
Notifications
You must be signed in to change notification settings - Fork 508
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
Fix handling of line endings in FileHeaderCodeFixProvider + SA1635 code fix #1440
Conversation
sharwell
commented
Sep 10, 2015
- Fixes Fix header code fix should normalize line endings #1437
- Enables FileHeaderCodeFixProvider for SA1635 (FileHeaderMustHaveCopyrightText)
|
||
var expectedDiagnostic = this.CSharpDiagnostic(FileHeaderAnalyzers.SA1633DescriptorMissing).WithLocation(1, 1); | ||
await this.VerifyCSharpDiagnosticAsync(testCode, expectedDiagnostic, CancellationToken.None).ConfigureAwait(false); | ||
await this.VerifyCSharpDiagnosticAsync(fixedCode, EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false); | ||
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false); |
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.
Passing a CancellationToken.None
to VerifyCSharpFixAsync
is unnecessary and it does not help readability.
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 pass a cancellation token in all cases where one can be passed. I would greatly prefer to pass one as described in xunit/xunit#345 but that option is not currently available.
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.
Ok.
❓ Given that policy, would it be a good idea to modify syntax of VerifyCSharpFixAsync
to require a cancellation token as its 3rd parameter? That would improve readability and it would also force consistency over the codebase.
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'd rather let this be motivation for DotNetAnalyzers/AsyncUsageAnalyzers#36 and DotNetAnalyzers/AsyncUsageAnalyzers#37, and correct any violations when those are available.
Fix handling of line endings in FileHeaderCodeFixProvider + SA1635 code fix