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

Finer-grained control of StyleCop-specific code cleanup #15

Closed
remerle opened this issue Sep 17, 2015 · 5 comments
Closed

Finer-grained control of StyleCop-specific code cleanup #15

remerle opened this issue Sep 17, 2015 · 5 comments

Comments

@remerle
Copy link

remerle commented Sep 17, 2015

I know @citizenmatt mentioned that the StyleCop cleanup actions are now managed using the StyleCop configuration. However, there are cases where I want to enforce a StyleCop rule, but do not want to have ReSharper apply any "cleanup".

For instance, I want to require methods to be documented, but I do not want ReSharper to automatically document them.

Is there any way to achieve this currently?

@DoCode
Copy link

DoCode commented Sep 18, 2015

+1

@citizenmatt
Copy link
Contributor

Not as it stands. The issue is that the code cleanup dialog isn't really intended to have all of the switches for all of the rules - there are over 150 rules, and while there aren't as many fixes in code cleanup, it still gets unwieldy to set them there.

My thinking in getting rid of these options in the dialog is why run code cleanup and not automatically fix everything we can? Does it make sense to clean up the code and still leave it failing?

What's your reasoning/use case here? Is it that the automatically created docs are not useful enough and you'd prefer to fix them yourself, or is something more generic?

For example, if the ReSharper plugin had an option just for docs (Add Default Comments, Add TODO Placeholders, Do Not Touch) would that solve the problem? Or is it something that needs to be applied to more rules (in which case some other UI needs to be thought about)?

@daviddunson
Copy link

The purpose for documentation is for another developer to understand what the type member does. Automatic documentation defeats this purpose. Adding default documentation for parameter-less constructors is OK; however, everything else must be addressed by the developer. Adding TODO might seem like an acceptable solution; but unless the developer goes looking for these entries, the work will never get done. I need SA1600 warnings to show up during the build to force the developers to address documentation before checking in their code.

@dmitriyse
Copy link

+5! This is must have feature (take it back into cleanup dialog). Some StyleCop cleanups works awfull and should be disabled, but corresponding rules should be enforced at build (command line check). I cannot migrate to R# 9.2 until this feature will be "re-implemented". P.S Thank you for giving new live to the StyleCop.

@citizenmatt
Copy link
Contributor

I've separated out the code cleanup options into two - "Fix violations" and "create XML doc stubs". I still think the idea that if code cleanup can fix violations (spacing, ordering, missing this, missing brackets, etc.) then it should. There shouldn't really be any need for configuration - as long as the rule is enabled, the code should be reformatted to match.

But, I do think the argument for not creating XML doc stubs is a good one. Ordering and layout is one thing, but generating content is a bit much. So, XML doc stub creation is a separate option, disabled by default. (To be honest, I'm not a fan of the XML comment rules, especially when it comes to the default text it should start with - the text for the constructor summary is always the same, it doesn't tell us anything useful, why clutter up your code with it?)

Anyway, that's what I've done for now. Let me know what you think.

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

No branches or pull requests

5 participants