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. Style Cop

Style Cop

Scheduled Pinned Locked Moved The Lounge
39 Posts 15 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.
  • W wizardzz

    I started to check out StyleCop this morning. I'm not going to rant about every other rule it follows, but has anyone noticed that the file **.Designer.cs violates:

    SA1201: All methods must be placed after all fields.

    Windows creates this file. I think I'm done with StyleCop.

    N Offline
    N Offline
    Nish Nishant
    wrote on last edited by
    #3

    StyleCop is meant to be used on user-written source files. Do not use it on auto-generated files :-)

    Regards, Nish


    My technology blog: voidnish.wordpress.com

    R 1 Reply Last reply
    0
    • W wizardzz

      I started to check out StyleCop this morning. I'm not going to rant about every other rule it follows, but has anyone noticed that the file **.Designer.cs violates:

      SA1201: All methods must be placed after all fields.

      Windows creates this file. I think I'm done with StyleCop.

      R Offline
      R Offline
      Rob Philpott
      wrote on last edited by
      #4

      Is that the latest incarnation of FXCOP? Perfect tool if you want lots of criticism of perfectly valid code if so.

      Regards, Rob Philpott.

      N 1 Reply Last reply
      0
      • S Slacker007

        I never understood the need to for formatting software (I think that is what StyleCop is right?).

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #5

        Not so much formatting as code styles and guidelines, like variable naming, comments, order of fields, methods etc.

        Regards, Nish


        My technology blog: voidnish.wordpress.com

        S 1 Reply Last reply
        0
        • S Slacker007

          I never understood the need to for formatting software (I think that is what StyleCop is right?).

          W Offline
          W Offline
          wizardzz
          wrote on last edited by
          #6

          It was recommended to me in a previous post regarding a coworker's use of under_score instead of underScore in the middle of variables. Someone recommended that I try StyleCop to settle our convention disputes.

          R M 2 Replies Last reply
          0
          • R Rob Philpott

            Is that the latest incarnation of FXCOP? Perfect tool if you want lots of criticism of perfectly valid code if so.

            Regards, Rob Philpott.

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #7

            No, FxCop and StyleCop are different. StyleCop analyzes your source code, whereas FxCop does static analysis on your compiled assembly. Normally you are supposed to use them together, so they complement each other.

            Regards, Nish


            My technology blog: voidnish.wordpress.com

            R P 2 Replies Last reply
            0
            • W wizardzz

              It was recommended to me in a previous post regarding a coworker's use of under_score instead of underScore in the middle of variables. Someone recommended that I try StyleCop to settle our convention disputes.

              R Offline
              R Offline
              Rob Philpott
              wrote on last edited by
              #8

              You really don't need a tool to police that. The accepted convention is camel case for variables, so under_score is simply wrong. Suggest (s)he reads a book or something.

              Regards, Rob Philpott.

              S 1 Reply Last reply
              0
              • N Nish Nishant

                No, FxCop and StyleCop are different. StyleCop analyzes your source code, whereas FxCop does static analysis on your compiled assembly. Normally you are supposed to use them together, so they complement each other.

                Regards, Nish


                My technology blog: voidnish.wordpress.com

                R Offline
                R Offline
                Rob Philpott
                wrote on last edited by
                #9

                Oh, ok. In which case, I hate *both* of them.

                Regards, Rob Philpott.

                N 1 Reply Last reply
                0
                • R Rob Philpott

                  Oh, ok. In which case, I hate *both* of them.

                  Regards, Rob Philpott.

                  N Offline
                  N Offline
                  Nish Nishant
                  wrote on last edited by
                  #10

                  :laugh:

                  Regards, Nish


                  My technology blog: voidnish.wordpress.com

                  1 Reply Last reply
                  0
                  • W wizardzz

                    It was recommended to me in a previous post regarding a coworker's use of under_score instead of underScore in the middle of variables. Someone recommended that I try StyleCop to settle our convention disputes.

                    M Offline
                    M Offline
                    moon_stick
                    wrote on last edited by
                    #11

                    How about the MS Naming Guidelines[^]??

                    Sarchasm : The gulf between the author of sarcastic wit and the person who doesn't get it.

                    1 Reply Last reply
                    0
                    • S Slacker007

                      I never understood the need to for formatting software (I think that is what StyleCop is right?).

                      M Offline
                      M Offline
                      MrSpackle
                      wrote on last edited by
                      #12

                      I sometimes feel alone in this opinion, but I believe that source code readability is a very, very, close second place to code correctness. Anyone else?

                      "Why look within yourself for THE TRUTH, when you're the one who's confused in the first place?" Mr. Spackle

                      C 1 Reply Last reply
                      0
                      • W wizardzz

                        I started to check out StyleCop this morning. I'm not going to rant about every other rule it follows, but has anyone noticed that the file **.Designer.cs violates:

                        SA1201: All methods must be placed after all fields.

                        Windows creates this file. I think I'm done with StyleCop.

                        R Offline
                        R Offline
                        Ravi Sant
                        wrote on last edited by
                        #13

                        i hate the need for styling in first place.

                        W 1 Reply Last reply
                        0
                        • R Rob Philpott

                          You really don't need a tool to police that. The accepted convention is camel case for variables, so under_score is simply wrong. Suggest (s)he reads a book or something.

                          Regards, Rob Philpott.

                          S Offline
                          S Offline
                          Slacker007
                          wrote on last edited by
                          #14

                          Rob Philpott wrote:

                          The accepted convention is camel case for variables, so under_score is simply wrong.

                          That is your opinion. Microsoft begs to differ with their internal coding practices. I thought we killed this bird a few days ago.

                          R 1 Reply Last reply
                          0
                          • M MrSpackle

                            I sometimes feel alone in this opinion, but I believe that source code readability is a very, very, close second place to code correctness. Anyone else?

                            "Why look within yourself for THE TRUTH, when you're the one who's confused in the first place?" Mr. Spackle

                            C Offline
                            C Offline
                            Chris Losinger
                            wrote on last edited by
                            #15

                            me too. which is why i think LINQ is crap.

                            image processing toolkits | batch image processing

                            B 1 Reply Last reply
                            0
                            • S Slacker007

                              Rob Philpott wrote:

                              The accepted convention is camel case for variables, so under_score is simply wrong.

                              That is your opinion. Microsoft begs to differ with their internal coding practices. I thought we killed this bird a few days ago.

                              R Offline
                              R Offline
                              Rob Philpott
                              wrote on last edited by
                              #16

                              Mine and everyone else I know - yes.

                              Regards, Rob Philpott.

                              E 1 Reply Last reply
                              0
                              • R Ravi Sant

                                i hate the need for styling in first place.

                                W Offline
                                W Offline
                                wizardzz
                                wrote on last edited by
                                #17

                                I'll admit that I'm not a fan of all styling conventions, and I think when working on the same project as others, it's nice to just stay consistent. But the underscore in variable names is killing me, I didn't think it would bug me so much.

                                1 Reply Last reply
                                0
                                • N Nish Nishant

                                  Not so much formatting as code styles and guidelines, like variable naming, comments, order of fields, methods etc.

                                  Regards, Nish


                                  My technology blog: voidnish.wordpress.com

                                  S Offline
                                  S Offline
                                  Slacker007
                                  wrote on last edited by
                                  #18

                                  Thanks for the correction. :)

                                  N 1 Reply Last reply
                                  0
                                  • S Slacker007

                                    Thanks for the correction. :)

                                    N Offline
                                    N Offline
                                    Nish Nishant
                                    wrote on last edited by
                                    #19

                                    No problem :)

                                    Regards, Nish


                                    My technology blog: voidnish.wordpress.com

                                    S 1 Reply Last reply
                                    0
                                    • R Rob Philpott

                                      Mine and everyone else I know - yes.

                                      Regards, Rob Philpott.

                                      E Offline
                                      E Offline
                                      Electron Shepherd
                                      wrote on last edited by
                                      #20

                                      Since you like it, what's the rationale for starting just the first word with a lower case letter? Why is customerAccountNumber better than CustomerAccountNumber or strCustomerAccountNumber or lpszCustomerAccountNumber ?

                                      Server and Network Monitoring

                                      R 1 Reply Last reply
                                      0
                                      • N Nish Nishant

                                        StyleCop is meant to be used on user-written source files. Do not use it on auto-generated files :-)

                                        Regards, Nish


                                        My technology blog: voidnish.wordpress.com

                                        R Offline
                                        R Offline
                                        realJSOP
                                        wrote on last edited by
                                        #21

                                        Hmmm, I always thought StyleCop was intended for the garbage can...

                                        .45 ACP - because shooting twice is just silly
                                        -----
                                        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                                        -----
                                        "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

                                        1 Reply Last reply
                                        0
                                        • E Electron Shepherd

                                          Since you like it, what's the rationale for starting just the first word with a lower case letter? Why is customerAccountNumber better than CustomerAccountNumber or strCustomerAccountNumber or lpszCustomerAccountNumber ?

                                          Server and Network Monitoring

                                          R Offline
                                          R Offline
                                          Rob Philpott
                                          wrote on last edited by
                                          #22

                                          Who knows? The point is convention. You can tell at a glance what you're dealing with (local/member/property etc). And if we all do things the same way it makes it easier to understand each other's code. A good thing surely.

                                          Regards, Rob Philpott.

                                          E 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