Source Code File with Excessive Number of Lines of Code

Incomplete Base
Structure: Simple
Description

This weakness occurs when a single source code file grows excessively large, containing too many lines of code.

Extended Description

Overly large source files create significant challenges for developers. They become difficult to read, understand, and maintain, which slows down development and increases the likelihood of errors. This complexity indirectly harms security by making it harder to spot and fix vulnerabilities during code reviews or maintenance, often allowing bugs to persist longer in the codebase. While specific thresholds can vary by project and team, a common guideline is to keep files under 1000 lines of code. Enforcing reasonable file size limits promotes modular design, improves team collaboration, and makes the code more manageable. This proactive practice reduces technical debt and creates a clearer code structure where security flaws are easier to identify and address before they become exploitable issues.

Common Consequences 1
Scope: Other

Impact: Reduce Maintainability

References 1
Automated Source Code Maintainability Measure (ASCMM)
Object Management Group (OMG)
01-2016
ID: REF-960
Related Weaknesses
Taxonomy Mapping
  • OMG ASCMM