Selective Static Code Analysis for Faster Large-Codebase Scans
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Code analysis systems face inefficiencies in scanning large codebases due to the time-consuming process of checking all files, especially those requiring compilation, which prolongs development and maintenance processes.
Innovation Solution
A code analysis system that selectively identifies files requiring static code analysis based on characteristics such as file type and location, skips unnecessary scans, and compiles only necessary files before performing analysis, thereby optimizing the scanning process.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the code analysis system checks all files received continuously, then the code compliance and bug detection coverage is improved, but the scanning time and processing duration increase significantly
Solution Approach 1:
The patent segments the codebase into different file types and directories, applying selective analysis rules to each segment. Source code files are analyzed for bugs and compliance, while configuration files, documentation, and binary files are excluded or analyzed with different rules. This segmentation allows the system to maintain high detection coverage for critical files while reducing overall scanning time by excluding non-critical files.
Solution Approach 2:
The patent implements partial action by analyzing only the subset of files that are most relevant to code quality and security. Instead of exhaustively analyzing every file in the codebase, the system focuses on source code files and critical configuration files, applying analysis rules selectively. This partial approach maintains effective bug detection while significantly reducing the time cost of scanning entire codebases.
2Measurement precision
If the code analysis system compiles all files requiring compilation, then the analysis accuracy for compiled languages is improved, but the processing time and computational resources increase
Solution Approach 1:
The patent applies local quality by determining compilation requirements on a per-file basis rather than compiling all files uniformly. The system analyzes file characteristics such as file extension, directory location, and content type to identify which files require compilation. Only files with source code requiring compilation are processed through the compilation step, while other files are analyzed directly. This localized approach maintains analysis accuracy for compiled languages while reducing overall compilation time and resource consumption.
3Reliability
If the code analysis system performs static code analysis on all source code files, then the bug detection capability is improved, but the processing speed and productivity decrease
Solution Approach 1:
The patent segments the file set into categories requiring static code analysis and categories that can be skipped or analyzed with lighter rules. Source code files in programming language directories are selected for detailed static analysis, while configuration files, documentation, test files, and binary files are excluded or processed with simplified rules. This segmentation maintains strong bug detection capability for actual source code while improving processing speed by reducing the total number of files requiring intensive analysis.
Solution Approach 2:
The patent implements dynamic file selection based on file characteristics, directory structure, and analysis rules. The system dynamically determines which files require static code analysis by evaluating file extensions, location in the codebase, and content type. This dynamic approach allows the system to adapt the analysis scope to the specific codebase structure, maintaining comprehensive bug detection where needed while improving processing speed by excluding files that don't require detailed static analysis.
Data Source
AI summary
Embodiments are described for a system comprising a memory and at least one processor coupled to the memory. The at least one processor is configured to receive a plurality of files or metadata of the plurality of files and identify a subset of the plurality of files that requires static code analysis based on one or more characteristics of the subset of the plurality of files. The at least one processor is further configured to determine that one or more files of the subset of the plurality of files require compilation and compile the one or more files of the subset of the plurality of files. The at least one processor is further configured to perform the static code analysis on the complied the one or more files and other files of the subset of the plurality of files and return results of the static code analysis.


