Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-3259

Namespaces should correspond to file locations

    XMLWordPrintable

    Details

    • Type: Finding Detection
    • Status: Closed
    • Resolution: Won't Fix
    • Labels:
    • Message:
      Change this namespace to "xxx".
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      C#
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min
    • ReSharper:
      CheckNamespace

      Description

      By convention, namespaces within a project should start with the project default namespace, and end with the file's position within the project. Anything else may confuse maintainers and callers.

      Noncompliant Code Example

      // file path: Gui/Screen.cs
      namespace Green  // Noncompliant
      {
        class Screen
        {
        }
      }
      

      Compliant Solution

      // file path: Gui/Screen.cs
      namespace Gui
      {
        class Screen
        {
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ann.campbell.2 Ann Campbell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: