Skip to content

SA1202 does not have customizable ordering #3920

Open
@smaillet

Description

@smaillet

The ordering that is currently fixed/hard coded for SA1202. This ordering doesn't make sense and I'm looking for a way to customize the default but that option is not available as far as I can tell.

The documented ordering is:

  1. public
  2. internal
  3. protected internal
  4. protected
  5. private protected
  6. private
    [Many people may be fine with this, so I'm not suggesting changes to the default - just an option to configure it for our projects]

This is actually VERY confusing as it takes the concept of "public" literally. Here's how we'd want it:

  1. public
  2. protected
  3. protected internal
  4. internal
  5. private protected
  6. private

This keeps the entire public (and documented) surface on top with internal and private below. That is, anything that is needed by a consumer is on top. Or phrased another way, the order is from the widest scope of access to down the narrowest.

At present we have to disable SA1202 and rely on code reviews (We all know how well that works. :() or write an analyzer for all of our products that handles this ourselves (That's a bunch of work when this one is so close...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions