Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. StyleCop - Aarrgh

StyleCop - Aarrgh

Scheduled Pinned Locked Moved The Lounge
questioncsharpcssvisual-studiocom
25 Posts 14 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nish Nishant

    Pete O'Hanlon wrote:

    Wow. If I remember rightly, they also have a rule about specifying only one class per file.

    Which is a good rule to follow in my opinion. I even use that for enums, even small ones.

    Regards, Nish


    My technology blog: voidnish.wordpress.com (recently moved from web-host to wordpress)

    P Offline
    P Offline
    Pete OHanlon
    wrote on last edited by
    #21

    I follow that rule - and it clarifies why using statements are per namespace.

    I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

    Forgive your enemies - it messes with their heads

    My blog | My articles | MoXAML PowerToys | Onyx

    1 Reply Last reply
    0
    • T The Man from U N C L E

      Got some interesting responses out of it though. MS does have some good explanations of the reasoning behind each rule, and clearly you have to chose the set for you as some rules don't sit well together. Customising the rules was the second thing I did. It is however a bit depressing that creating a default windows forms app in VS 2010, with the default auto created main form, will give so many warnings with the default settings. Over a hundred. You would have thought that MS supplied templates would match the MS supplied style rules. Oh well.

      If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #22

      The Man from U.N.C.L.E. wrote:

      You would have thought that MS supplied templates would match the MS supplied style rules. Oh well.

      Do what I say, not what I do.

      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      1 Reply Last reply
      0
      • J Jeremy Falcon

        Mr.Prakash wrote:

        I prefer spaces, when the code is developed with different editors on different platforms, spaces makes the code neater.

        But, realistically every IDE you'll use allows you to configure tab width.

        Jeremy Falcon

        P Offline
        P Offline
        Prakash Nadar
        wrote on last edited by
        #23

        Jeremy Falcon wrote:

        But, realistically every IDE you'll use allows you to configure tab width.

        Yes it does. the problem is not all spaces can be replaced with tabs while all tabs can be replaced with spaces. What I mean is, some people write it this way enum something { <sp><sp><sp>Enum1, <tab> enum2 } The above code will look different with different settings of tab. If you only have space then there is never a problem. I know I know you will say, why did enum1 had space in the first place. Some devs do it some intentionally and many times accidentally, instead of going after the dev on why he put sp instead of tab. It is easier to say replace all tabs with space. And consider this horrible pattern enum something { <sp><sp><sp><tab>Enum1, <tab> enum2 } With Tab setting to 4, they will look good, if not they will look bad.

        1 Reply Last reply
        0
        • T The Man from U N C L E

          I know, I can disable rules but that rather defeats the point. I started from the point of how can I be expected to match the rules if the Visual Studio generated code itself does not. As to coding and brackets, I prefer, the following, though I know personal preference and all that.

          switch (foo){
          case Bar:
          RunBar();
          break;
          case Foobar:
          RunFoo();
          RunBar();
          break;
          }

          In this example Style cop would prefer the following:

          switch (foo)
          {
          case Bar:
          RunBar();
          break;
          case Foobar:
          RunFoo();
          RunBar();
          break;
          }

          Who can really say which is more readable, though I would use spaces if pasting on CP because it is easier to type in the editor, that does not allow you to type tabs.

          If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

          P Offline
          P Offline
          peterchen
          wrote on last edited by
          #24

          There are other scenarios where "inner" tabs would break column alignment. Maybe elastic tabstops[^] would solve the debate (at least for me).

          Agh! Reality! My Archnemesis![^]
          | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

          1 Reply Last reply
          0
          • N Nish Nishant

            The Man from U.N.C.L.E. wrote:

            It is however a bit depressing that creating a default windows forms app in VS 2010, with the default auto created main form, will give so many warnings with the default settings. Over a hundred. You would have thought that MS supplied templates would match the MS supplied style rules. Oh well.

            Yeah I hear you there. The VS team seems to have been wholly unaware of the StyleCop guidelines :-) BTW, my real name jab was an attempted joke (since you are not using your real name at all)!

            Regards, Nish


            My technology blog: voidnish.wordpress.com (recently moved from web-host to wordpress)

            T Offline
            T Offline
            The Man from U N C L E
            wrote on last edited by
            #25

            Nishant Sivakumar wrote:

            BTW, my real name jab was an attempted joke (since you are not using your real name at all)!

            I am on my profile. Or am I? The life of a spy is never simple> :)

            If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles]  [My Website]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups