Overlong Source Code Detection With Segmented Thresholds

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing software refactoring tools struggle to accurately identify overlong methods in source code due to the use of single line count thresholds, resulting in numerous false positives and non-actionable results, making it difficult to improve code quality and maintainability.

Innovation Solution

A system utilizing machine learning, natural language processing, and static/dynamic code analysis applies tailored code length thresholds and filters to identify and prioritize overlong code segments for refactoring, considering metrics like autogeneration, method type, and cyclomatic complexity.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a single line count threshold is used to identify overlong methods, then the identification process is simple and fast, but the result contains numerous false positives and is non-actionable

Engineering Contradiction:
Improveidentification speedVSAvoididentification accuracy
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The patent segments the identification process into multiple stages: filtering out autogenerated code segments, separating test methods from normal methods, and applying different evaluation criteria to each segment type. This segmentation allows for more precise identification by treating different code segments according to their specific characteristics rather than using a uniform threshold.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent applies local quality by using tailored code length thresholds specific to each code segment type. Test methods receive different threshold criteria compared to normal methods, and autogenerated segments are excluded entirely. This localized approach improves measurement precision by matching the evaluation criteria to the specific properties of each code segment.

Inventive Principle:
Principle #3Local quality

2Measurement precision

If multiple filters and tailored thresholds are applied to each code segment, then the identification accuracy improves and false positives are reduced, but the complexity of the identification system increases

Engineering Contradiction:
Improveidentification accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent reduces system complexity through segmentation by dividing code segments into distinct categories (autogenerated, test methods, normal methods) that can be processed independently. Each category has its own simplified evaluation rules, which reduces the overall computational complexity compared to applying a single complex evaluation system to all code uniformly.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent manages complexity by dynamically changing evaluation parameters based on the detected type of code segment. The system automatically adjusts which thresholds and criteria are applied based on the segment classification, allowing for high precision without requiring a permanently complex system structure for all cases.

Inventive Principle:
Principle #35Parameter changes

3Reliability

If code segments are filtered based on multiple metrics including autogeneration and method type, then the actionable identification of overlong methods improves, but the time required for analysis increases

Engineering Contradiction:
Improveactionability of resultsVSAvoidanalysis time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent applies preliminary action by performing filtering operations before the main evaluation process. Autogenerated code segments are identified and removed early in the process, and test methods are separated from normal methods before applying the overlong method detection thresholds. This preliminary filtering reduces the amount of code that requires detailed analysis, thereby reducing overall analysis time while maintaining high reliability.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS20250328344A1Methods and Apparatus for Finding Long Methods in Code
Publication Date: 2025.10.23 DEVFACTORY INNOVATIONS FZ LLC
  • US20250328344A1 patent drawing
  • US20250328344A1 patent drawing
  • US20250328344A1 patent drawing

AI summary

A method and apparatus are disclosed for finding overlong source code segments (e.g., methods) by evaluating input source code segments for a plurality of predetermined code metric values in order to identify candidate source code segments (e.g., non-autogenerated methods) which do not meet a first code metric value and to assess each candidate source code segment against a second code metric value to identify different sets of candidate source code segments (e.g., test methods and normal methods) so that each set of candidate source code segments may be assessed against a tailored set of code length thresholds to identify any overlong source code segment having a code length which meets or exceeds at least two of the tailored set of code length thresholds.