Violation Matching Engine for Code Base Snapshots

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current static analysis systems struggle to accurately attribute coding violations across different snapshots of a source code base, especially when additional code is added or when violations are moved between files, and they fail to effectively handle merge commits and unanalyzable snapshots.

Innovation Solution

A static analysis system that uses a violation matching engine to identify and attribute matching violations between snapshots, employing canonical representations to reduce storage requirements and improve scalability, and can attribute violations even in the presence of unanalyzable snapshots by using a combination of location-based, snippet-based, and hash-based matching processes.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional violation matching methods are used, then violations can be identified in simple cases, but the system fails to accurately attribute violations when additional code is added or when violations are moved between files

Engineering Contradiction:
Improveviolation attribution accuracyVSAvoidhandling code additions and relocations
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The violation matching process is divided into multiple independent matching stages: location-based matching, snippet-based matching, and hash-based matching. Each stage operates independently and can handle different scenarios of code changes, allowing the system to accurately attribute violations even when code is added or relocated between files.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system transitions from single-dimension matching (comparing only violation locations) to multi-dimension matching by introducing snippet-based and hash-based matching dimensions. This allows the system to recognize violations across different files and locations, improving attribution accuracy when code structure changes.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Measurement precision

If comprehensive violation matching is performed across all snapshots, then accurate attribution is achieved, but the system becomes computationally intensive and cannot scale to large code bases

Engineering Contradiction:
Improveviolation attribution accuracyVSAvoidscalability to large code bases
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The violation matching algorithm is segmented into three independent phases: location-based matching, snippet-based matching, and hash-based matching. Each phase processes violations independently and can be optimized separately, enabling the system to scale to large code bases while maintaining high attribution accuracy through progressive filtering and matching.

Inventive Principle:
Principle #1Segmentation

3Loss of information

If the system stores detailed violation information for all snapshots, then complete violation history is maintained, but storage requirements become excessive

Engineering Contradiction:
Improveviolation history completenessVSAvoidstorage requirements
Core Design Contradiction:
Loss of informationVSQuantity of substance

Solution Approach 1:

The system extracts and stores only the essential violation information needed for attribution (canonical representations, matching metadata) rather than storing complete violation details for all snapshots. This selective extraction maintains necessary violation history while dramatically reducing storage requirements.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The system uses canonical representations that serve as compressed copies of violation information. These canonical forms capture the essential characteristics of violations across snapshots without storing redundant detailed information, enabling efficient storage and retrieval of violation history.

Inventive Principle:
Principle #26Copying

4Adaptability or versatility

If the system handles all types of commits including merge commits, then comprehensive violation attribution is achieved, but the complexity of the matching algorithm increases

Engineering Contradiction:
Improvehandling merge commitsVSAvoidmatching algorithm complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The matching algorithm is segmented into distinct phases that handle different commit types systematically. Location-based matching handles simple cases, while snippet-based and hash-based matching handle complex cases like merge commits. This segmentation allows the system to manage complexity through structured processing rather than a single complex algorithm.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS9959116B2Scalable transitive violation matching
Publication Date: 2018.05.01 MICROSOFT TECHNOLOGY LICENSING LLC
  • US9959116B2 patent drawing
  • US9959116B2 patent drawing
  • US9959116B2 patent drawing

AI summary

Methods for reducing storage and performing static analysis on violations across code base revisions are disclosed. An example method begins with receiving a child snapshot representing a code base at a specific revision. A parent snapshot is identified. Then, canonical representations for violations representing coding defects in the parent and child snapshots are computed. An example method determines matching violations between the snapshots, unmatched parent violations, and unmatched child violations. For matching violations that have different canonical representations, a mapping between the parent snapshot violation and the child snapshot violation is stored using their respective canonical representations. For unmatched parent violations, each violation's canonical representation is stored with an indication that the violation has been eliminated from the child snapshot. For unmatched child violations, each violation's canonical representation is stored with an indication that the violation has been introduced in the child snapshot.