Skip to content
alastairs edited this page Dec 4, 2011 · 2 revisions

StyleCop settings

To help code maintainability and readability StyleCop will be used to enforce a few rules. Currently all projects are using the one setting file found in the src directory. A ReSharper settings file provides development-time assistance in conforming to the GiveCRM coding standards.

Layout rules

Always include curly braces (this means you can't miss out curly braces on single line if blocks)

Maintainability rules

Unnecessary code must be removed.

Access Modifiers

  1. Access modifiers must be declared
  2. Fields must be private

Debug text

  1. Code analysis suppression must have justification
  2. Debug.Asserts must provide a text message
  3. Debug.Fail must provide a text message

Naming rules

  1. Interface names must begin with an I
  2. Const field names must begin with an upper case letter
  3. Field names must not use Hungarian notation
  4. Field names must begin with a lower case letter
  5. Variable names must not be prefixed (no putting _ or m_ infront of them)
  6. Field names must not begin with an underscore

​Ordering rules

consts must appear before fields.

Readability rules

  1. Comments must contain text
  2. Don't use regions
  3. Code must not contain empty statements
  4. Use string.Empty not ""
Clone this wiki locally