Marko Apfel - Afghanistan/Belgium/Germany

Management, Architecture, Programming, QA, Coach, GIS, EAI

  Home  |   Contact  |   Syndication    |   Login
  187 Posts | 2 Stories | 201 Comments | 4 Trackbacks

News



Twitter | LinkedIn | Xing

Archives

Post Categories

Image Galleries

BizTalk

C#

Enterprise Library

SAP

SQL Server

Technologie

StyleCop issues

inheritedoc-comment

Using <inheritdoc />-comment is not recognized by StyleCop. So this needs a suppression:

// <inheritdoc />
[SuppressMessage(
    "Microsoft.StyleCop.CSharp.DocumentationRules",
    "SA1604:ElementDocumentationMustHaveSummary",
    Justification = "InheritDoc")]

FxCop issues

Too few namespaces

[module: SuppressMessage(
    "Microsoft.Design",
    "CA1020:AvoidNamespacesWithFewTypes",
    Scope = "namespace",
    Target = "EsriDE.Core.Service.Logging",
    Justification = "We want to have this namespace, but do not have enough classes to go in it right now to satisfy the rule.")]

ReSharper only supports non static test methods

[SuppressMessage(
    "Microsoft.Performance",
    "CA1822:MarkMembersAsStatic",
    Justification = "ReSharper could not handle static test methods.")]

No strong name

[assembly: SuppressMessage(
    "Microsoft.Design",
    "CA2210:AssembliesShouldHaveValidStrongNames",
    Justification = "Strong name is not needed for this.")]

Catching general exception

[SuppressMessage(
    "Microsoft.Design",
    "CA1031:DoNotCatchGeneralExceptionTypes",
    Justification = "We do not know which exceptions could be thrown.")]

Justification for samples and fixtures

[SuppressMessage(
    "Microsoft.XYZ",
    "CAxyz:XYZ",
    Justification = "For fixtures this is OK.")]

Setter but no Getter (for example in IoC or NHibernate-context)

[SuppressMessage(
    "Microsoft.Usage",
    "CA2227:CollectionPropertiesShouldBeReadOnly",
    Justification = "Setter is needed for nhibernate, otherwise a NHibernate.PropertyNotFoundException will be thrown.")]

[SuppressMessage(
    "Microsoft.Xyz",
    "CAxyz:XYZ",
    Justification = "We only need a setter for setter injection.")]

Instantiation with IoC

[SuppressMessage(
    "Microsoft.Performance",
    "CA1811:AvoidUncalledPrivateCode",
    Justification = "We need this for unit tests.")]

[SuppressMessage(
    "Microsoft.Performance",
    "CA1812:AvoidUninstantiatedInternalClasses",
    Justification = "Class would be instantiated by IoC framework.")]

Incorrect naming

[SuppressMessage(
    "Microsoft.StyleCop.CSharp.NamingRules",
    "SA1310:FieldNamesMustNotContainUnderscore",
    Justification = "Windows message constants are commonly named as WM_xxxxx")]

Incorrect casing

[module: SuppressMessage(
    "Microsoft.Naming",
    "CA1709:IdentifiersShouldBeCasedCorrectly",
    Scope = "type",
    Target = "EsriDE.Data.Access.IDbFactory",
    MessageId = "<WrongCasedWord>")]

[module: SuppressMessage(
    "Microsoft.Naming",
    "CA1709:IdentifiersShouldBeCasedCorrectly",
    Scope = "type",
    MessageId = "<WrongCasedWord>")]

Parametername should match base declaration

[SuppressMessage(
    "Microsoft.Naming",
    "CA1725:ParameterNamesShouldMatchBaseDeclaration",
    Justification = "Rule CA1725 has a bug when inspecting parameters from methods from interfaces. So suppress it with class.")]

Throwing ApplicationException

[SuppressMessage(
    "Microsoft.Usage",
    "CA2201:DoNotRaiseReservedExceptionTypes",
    Justification = "ApplicationException is OK.")]

FxCop is too strict

[SuppressMessage("
    Microsoft.XYZ"
,
    "CAxyz:XYZ",
    Justification = "We decide that this is OK.")]

[module: SuppressMessage(
    "Microsoft.XYZ",
    "CAxyz:XYZ",
    Scope = "resource",
    Target = "EsriDE.PipelineManagement.Core.Properties.Messages.resources",
    MessageId = "Toolbar",
    Justification = "We decide that this is OK.")]

[SuppressMessage(
    "Microsoft.XYZ",
    "CAxyz:XYZ",
    Justification = "This is by design.")]

Code from untaught colleagues

[SuppressMessage(
    "Microsoft.XYZ",
    "CAxyz:XYZ",
    Justification = "Currently, we do not have enough knowledge or experience to fix this.")]

[SuppressMessage(
    "Microsoft.XYZ",
    "CAxyz:XYZ",
    Justification = "Cowboy-coding colleagues.")]

posted on Monday, July 5, 2010 10:35 AM