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

Files should not have too many lines of code

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      File "XXXX" has {0} lines, which is greater than {1} authorized. Split it into smaller files.
    • List of parameters:
      Hide

      Key: Max
      Description: Maximum authorized lines of code in a file.
      Default Value: 1000

      Show
      Key: Max Description: Maximum authorized lines of code in a file. Default Value: 1000
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Legacy Key:
      Web:FileLengthCheck, FileLoc, S00104
    • Targeted languages:
      Flex, PL/I
    • Covered Languages:
      ABAP, APEX, C#, C, C++, Go, HTML, Java, JavaScript, Kotlin, Objective-C, PHP, PL/SQL, Python, RPG, Ruby, Scala, Swift, T-SQL, TypeScript, VB.Net, VB6
    • Irrelevant for Languages:
      Cobol, XML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      1h
    • Analysis Level:
      Syntactic Analysis
    • Analysis Scope:
      Main Sources, Test Sources
    • Common Rule:
      Yes
    • Checkstyle:
      FileLength
    • ESLint:
      max-lines
    • Pylint:
      C0302
    • SwiftLint:
      file_length
    • TSLint:
      max-file-line-count

      Description

      A source file that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor it into smaller pieces of code which focus on well defined tasks. Those smaller files will not only be easier to understand but also probably easier to test.

        Attachments

          Issue Links

          1.
          C-Family RSPEC-2897 Language-Specification Active Unassigned
          2.
          VB.NET RSPEC-3096 Language-Specification Active Unassigned
          3.
          JavaScript RSPEC-3537 Language-Specification Active Unassigned
          4.
          HTML: Files should not have too many lines RSPEC-4537 Language-Specification Active Unassigned
          5.
          RPG: Files should not have too many lines RSPEC-4546 Language-Specification Active Unassigned
          6.
          Go RSPEC-4598 Language-Specification Active Unassigned
          7.
          VB6 RSPEC-6037 Language-Specification Active Unassigned

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                freddy.mallet Freddy Mallet (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: