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

Class names and file names should match

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Message:
      Rename this file to "xxx".
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      C#, C++, Java, Objective-C, Swift
    • Covered Languages:
      JavaScript
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min

      Description

      By convention, the name of a file should match the name of the top-level class it contains. Anything else may confuse maintainers.

      Noncompliant Code Example

      // file path: Gui/Interface.cs  -- Noncompliant
      namespace Gui
      {
        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:
              1 Start watching this issue

                Dates

                Created:
                Updated: