Skip to content

Implement file header analyzer#41982

Merged
sharwell merged 32 commits intodotnet:masterfrom
sharwell:file-headers
Mar 6, 2020
Merged

Implement file header analyzer#41982
sharwell merged 32 commits intodotnet:masterfrom
sharwell:file-headers

Conversation

@sharwell
Copy link
Copy Markdown
Contributor

@sharwell sharwell commented Feb 27, 2020

Closes #33012

@vweijsters and myself are submitting this change under the .NET Foundation CLA for dotnet/roslyn. We have licensed this work separately in the past, on non-exclusive basis, to another project, but as the sole original authors of the functionality we have agreed to submit it here independently of that work.

Items remaining to be resolved:

  1. The code fix does not behave correctly when replacing a header that does not start on the first line, and the first line contains a positive amount of whitespace (fixed)
  2. Some additional types can be consolidated to avoid code duplication in the C# and Visual Basic implementations (refactored to share)
  3. The code fix needs to cooperate with the previous Add file banner refactoring to ensure only one is offered at a time (fixed)
  4. A code fix needs to be offered to configure the file_header_template setting in .editorconfig using the content of the header used in the current file
  5. The diagnostic cannot be suppressing using #pragma warning disable (fixed)

@sharwell sharwell added Blocked PR For Personal Review Only The PR doesn’t require anyone other than the developer to review it. labels Feb 27, 2020
@CyrusNajmabadi

This comment has been minimized.

@vweijsters
Copy link
Copy Markdown
Contributor

I agree to submit this feature with @sharwell to dotnet/roslyn under the terms of the .NET Foundation CLA used for this repository, even though we originally developed the feature in another context and it remains separately licensed for that purpose.

@sharwell sharwell added Area-IDE and removed Blocked labels Feb 28, 2020
@sharwell sharwell marked this pull request as ready for review February 28, 2020 18:26
@sharwell sharwell requested a review from a team as a code owner February 28, 2020 18:26
@sharwell sharwell removed the PR For Personal Review Only The PR doesn’t require anyone other than the developer to review it. label Feb 28, 2020
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we have a helper for getting a document without the header? Can we reuse that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not certain that helper behaves correctly. We can look into using it in the future though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. can we try using it and running it against your tests to verify?
  2. if it doesn't work, i would much rather fix that up. that way all the features in the IDE that care about banners work consistently.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Only one feature will be active in any given project.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

➡️ #42203

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Def have some strong requests for tweaks around code clarity. Overall design and impl is rock solid and i'm strongly in favor of. But would really like a few things smoothed out first. Thanks!

@sharwell sharwell force-pushed the file-headers branch 2 times, most recently from 82e3577 to 4f262c4 Compare March 6, 2020 00:07
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Thanks for all the tidying up changes. it's very appreciated!

@sharwell sharwell merged commit 4b7beac into dotnet:master Mar 6, 2020
@ghost ghost added this to the Next milestone Mar 6, 2020
@sharwell sharwell deleted the file-headers branch March 6, 2020 06:52
@sharwell sharwell modified the milestones: Next, 16.6.P2 Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: File header validation analyzer and fix

5 participants