Why is "Design Files Analysis" the default for StyleCop?

StyleCop (4.7.14.0) is set to Parse Designer Files by default, and I would like to know if there are any arguments that would justify style checks in a developer generated file.

I understand that I can (and how) disable it from checking these files (I am considering this), but the question is, why would that be the default for parsing them?

Aren't these files left alone? Why should we try to make them compatible with StyleCop?

+3


source to share


2 answers


It may be desirable that the generated code conforms to the same standards as manual code. Of course, this tends to be less important for pure "code styles" such as those covered by StyleCop than for the "correctness" of problems covered by tools such as FxCop, but there might still be good reasons to validate code generated with tool, even for style issues. eg:.



  • If the tool that generates the target code is a tool that is authored by the author, then it is completely unusual to stick to the same standard as hand-written code. This is, after all, the case where one has complete control over the content and style of the generated code.

  • In practical terms, the tool can be removed or disabled at any time after the code is generated, in which case each of them will manually maintain the code. If style rules are applied to improve readability and maintainability, which allows the generated code to deviate too much from coding standards, it may not be desirable.

+1


source


The main reason I can think of is that there is no absolute guarantee that a file with "designer" in the name will only be generated automatically.

In these days of strong separation and the ability to use verbose and clear names, perhaps this is simply omitted in the meaning of a default caveat.



But I agree, if you are sure that they are always automatically generated, you shouldn't try to clean them up.

OTOH, my Dynamics CRM server is generating a 12mm XRM reference file, so I'm trying to trim it!

0


source







All Articles