开发者

How to get rid of StyleCop

开发者 https://www.devze.com 2023-01-29 11:10 出处:网络
Someone on our team installed StyleCop and since then all of the projects he loaded up and committed to source control refuse to load unless stylecop is installed.

Someone on our team installed StyleCop and since then all of the projects he loaded up and committed to source control refuse to load unless stylecop is installed.

I know I can manually edit the .csproj 开发者_高级运维files to get rid of it, but is there an easy way to automatically remove these stylecop parts from the project files so they can be loaded and built on a non-stylecop-infected Visual Studio machine?


Why remove it?
In my opinion using StyleCop is a good thing.
Your only problem seems to be that your team member didn't set up StyleCop properly.

From your description, I guess that he wanted to set up StyleCop with MSBuild integration: http://blogs.msdn.com/b/sourceanalysis/archive/2008/05/24/source-analysis-msbuild-integration.aspx

He apparently just left out the last paragraph "Team Development": copy the StyleCop files into your project and check them into source control, so you don't need to install StyleCop on every single developer machine. (see my link for a more detailed description)

If you do this, StyleCop should work on every machine, no matter if it's installed or not.

We are using StyleCop in this way as well, and I think it's the easiest way to use it.
I just had to insert two lines into each .csproj file and check a few files into source control once...and StyleCop just works, on every compile, on every machine (no matter if it's on a developer machine or the build server).


Stylecop hides real warnings. Its a vanity exercise and its evil.

Do not use it.

I find that stylecop generates many many trivial warnings that drown out the real warnings. By all means use these tools but don't force them to be on. Having no stylecop warnings is a meaningless metric.


I disabled StyleCop by adding the following GlobalSettings configuration to the file settings.stylecop in the solution root.

<StyleCopSettings Version="4.3">
  <GlobalSettings>
    <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
  </GlobalSettings>
  ...
</StyleCopSettings>


TEST DRIVEN DEVELOPMENT

Red -> Green -> Refactor

TEST DRIVEN DEVELOPMENT (WITH STYLECOP)

Red -> Red -> WTF? -> Red -> Red -> ...

Also, from here:

Bob: Using pattern matching, the software identifies ugly code
Charlie: —and fixes it!
Bob: No. It prints a message about each transgression.
Charlie: And then the user right-clicks to fix them all?
Bob: No. The message scolds them 'invalid spacing around the comma'.
Charlie: And then explains how the user can fix it?
Bob: No, that information is in a separate document.
Charlie: On Google?
Bob: No.


This is why don't use Stylecop.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号