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

FileHeaderCodeFixProvider should provide same file header fix as in Stylecop classic with R# #2086

Closed
ThomasZitzler opened this issue Feb 18, 2016 · 6 comments

Comments

@ThomasZitzler
Copy link

The current fix result looks like this:

// <copyright file="Xxx.cs" company="...">
// Copyright ....
// </copyright>

StyleCop classic fix also added some "decoration" lines like this:

// -----------------------------------------------------------------------
// <copyright file="Xxx.cs" company="...">
// Copyright ....
// </copyright>
// -----------------------------------------------------------------------

I'd like to have that decoration lines back as our whole code base has this header style.

One proposal would be to have there an additional setting in stylecop.json, e.g. like this:

  "settings": {
    "documentationRules": {
      "companyName": "...",
      "headerDecoration": "-----------------------------------------------------------------------",
    }
  }

I have already tested it, I'll attach the pull request (no test written yet).

@vweijsters
Copy link
Contributor

👍

Might be good to also add a new diagnostic (FileHeaderMustHaveDecoration).

@sharwell
Copy link
Member

It is my current understanding StyleCop Classic didn't contain any code which checked for the presence or absence of these lines, but they are simply ignored during analysis. In addition, StyleCop Classic did not implement code fixes, so the discrepancy here is that we match StyleCop Classic behavior without deviation, but are not currently matching ReSharper's behavior. Is this a correct representation?

@ThomasZitzler
Copy link
Author

Yes, that's true. Those lines where only in the Resharper fix.
And for me it would be totally sufficient to have it in the fix (so that I don't have to add them all the time).

Btw, also the classic stylecop's code has those decorations, and also the code on http://referencesource.microsoft.com/.

So I think there might be more people interested in the fix.

About the diagnostic: It might be a nice-to-have feature. But probably makes the code there even more complex.

@lukas-ais
Copy link
Contributor

For me, this "decoration" is just a decoration, so useless. What is the reason to have such decoration?
It would be OK to have an option (e.g. FileHeaderMustHaveDecoration diagnostic or headerDecoration option). But this should be disabled by default.

@OliverKurowski
Copy link

The idea is that the header looks the same as it did with stylecop.
I don't expect that there is a check for the correct decoration, but it would be nice that the code fix could be configured to insert the same header as stylecop did.

@ThomasZitzler
Copy link
Author

@lukas-ais If you look at the pull request for this issue you will see that it will be only added if explicitly turned on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants