본문으로 건너뛰기
cccskills
무료GitHub에 공개

semantic-szz-analyzer

Identify bug-introducing commits using semantic analysis that extends traditional SZZ algorithm. Distinguishes semantic changes from refactorings or code movements using control-flow and data-flow similarity analysis. Use when analyzing bug-fix commits to trace back to bug-introducing changes, investigating software evolution, conducting empirical studies on defect prediction, or reducing false positives in bug localization. Supports git repositories and provides explanations for why commits are identified as bug-introducing.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(9)

  • SKILL.md5.5 KB
  • bug_fixes.txt.example202 B
  • README.md3.4 KB
  • references/language_support.md8.5 KB
  • references/semantic_analysis.md7.5 KB
  • references/szz_algorithm.md4.3 KB
  • scripts/batch_analyze.py5.5 KB
  • scripts/semantic_analyzer.py9.4 KB
  • scripts/semantic_szz.py6.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Semantic SZZ Analyzer

Overview

Semantic SZZ Analyzer extends the traditional SZZ (Sliwerski-Zimmermann-Zeller) algorithm by incorporating semantic analysis to identify bug-introducing commits more accurately. It distinguishes actual semantic changes from refactorings or code movements by analyzing control-flow and data-flow similarity across versions.

Core Capabilities

1. Semantic Change Detection

Analyze commits to distinguish between:

  • Semantic changes: Modifications that alter program behavior
  • Refactorings: Code restructuring without behavior changes
  • Code movements: Relocations of code blocks without semantic impact

Use control-flow graphs (CFG) and data-flow analysis to compute similarity between code versions.

2. Bug-Introducing Commit Identification

Given a bug-fix commit, trace back through git history to identify the commit that introduced the bug:

  1. Extract changed lines from the bug-fix commit
  2. Use git blame to find commits that last modified those lines
  3. Apply semantic analysis to filter out false positives
  4. Rank candidates by semantic similarity and temporal proximity

3. False Positive Reduction

Traditional SZZ produces many false positives due to:

  • Whitespace changes
  • Comment modifications
  • Import reorganization
  • Variable renaming
  • Code formatting

Semantic SZZ filters these by analyzing AST (Abstract Syntax Tree) structure and semantic equivalence.

Workflow

Step 1: Analyze Bug-Fix Commit

Start by identifying the bug-fix commit. Look for:

  • Commits with keywords: "fix", "bug", "issue", "patch", "resolve"
  • Commits linked to issue trackers
  • Commits explicitly marked as fixes

Extract the changed lines and affected files.

Step 2: Identify Candidate Commits

Use git blame or git log -L to trace the history of changed lines:

git blame -L <start>,<end> <file> <bug-fix-commit>^

This identifies commits that last modified the buggy lines before the fix.

Step 3: Apply Semantic Analysis

For each candidate commit, run semantic analysis using the provided script:

python scripts/semantic_analyzer.py --repo <repo-path> --candidate <commit-hash> --fix <fix-commit-hash>

The script computes:

  • CFG similarity: Control-flow graph matching between versions
  • Data-flow similarity: Variable usage and dependency analysis
  • AST diff: Structural code changes vs. superficial changes

Step 4: Filter and Rank Results

Filter candidates based on semantic similarity threshold (default: 0.7). Rank remaining candidates by:

  1. Semantic change magnitude
  2. Temporal proximity to bug-fix
  3. Code churn in the commit

Step 5: Generate Explanation

For each identified bug-introducing commit, generate an explanation including:

  • What semantic changes were made
  • Why the change is considered bug-introducing
  • Confidence score based on similarity metrics
  • Diff highlighting the problematic changes

Usage Examples

Example 1: Analyze a specific bug-fix

python scripts/semantic_szz.py --repo /path/to/repo --fix-commit abc123

Example 2: Batch analysis of multiple fixes

python scripts/batch_analyze.py --repo /path/to/repo --fixes-file bug_fixes.txt

Example 3: Generate detailed report

python scripts/semantic_szz.py --repo /path/to/repo --fix-commit abc123 --output report.json --explain

Advanced Features

Custom Similarity Thresholds

Adjust sensitivity by modifying similarity thresholds:

# In scripts/semantic_analyzer.py
CFG_THRESHOLD = 0.7  # Control-flow similarity
DFG_THRESHOLD = 0.6  # Data-flow similarity
AST_THRESHOLD = 0.8  # AST structural similarity

Language-Specific Analysis

The analyzer supports multiple languages with language-specific parsers:

  • Python: Uses ast module
  • Java: Uses javalang or tree-sitter
  • C/C++: Uses pycparser or tree-sitter
  • JavaScript: Uses esprima or tree-sitter

See references/language_support.md for details.

Integration with Issue Trackers

Link bug-fixes to issue IDs for automated analysis:

python scripts/semantic_szz.py --repo /path/to/repo --issue JIRA-123

References

Output Format

Results are provided in JSON format:

{
  "fix_commit": "abc123",
  "bug_introducing_commits": [
    {
      "commit": "def456",
      "confidence": 0.85,
      "semantic_change_type": "logic_modification",
      "explanation": "Modified conditional logic in function foo()",
      "changed_lines": [45, 46, 47],
      "similarity_scores": {
        "cfg": 0.72,
        "dfg": 0.68,
        "ast": 0.81
      }
    }
  ]
}

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Applies abstract interpretation using different abstract domains (intervals, octagons, polyhedra, sign, congruence) to statically analyze program variables and infer invariants, value ranges, and relationships. Use when analyzing program properties, inferring loop invariants, detecting potential errors, or understanding variable relationships through static analysis.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2582026년 8월 21일 업데이트

Uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions for formal verification. Generates invariants that capture program behavior and support correctness proofs in Dafny, Isabelle, Coq, and other verification systems. Use when adding formal specifications to code, generating verification conditions, inferring contracts for functions, or discovering loop invariants for proofs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2582026년 8월 21일 업데이트

Performs abstract interpretation over source code to infer possible program states, variable ranges, and data properties without executing the program. Reports potential runtime errors including out-of-bounds accesses, null dereferences, type inconsistencies, division by zero, and integer overflows. Use when analyzing code for potential runtime errors, performing static analysis, checking safety properties, or verifying program behavior without execution.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2582026년 8월 21일 업데이트

Performs abstract interpretation to produce summarized execution traces and high-level program behavior representations. Highlights key control flow paths, variable relationships, loop invariants, function summaries, and potential runtime states using abstract domains (intervals, signs, nullness, etc.). Use when analyzing program behavior, understanding execution paths, computing loop invariants, tracking variable ranges, detecting potential runtime errors, or generating program summaries without concrete execution.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2582026년 8월 21일 업데이트

Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2582026년 8월 21일 업데이트

CLI-based browser automation with persistent page state using ref-based element interaction. Use when users ask to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2582026년 8월 21일 업데이트

ArabelaTso의 스킬 모두 보기

이 스킬의 문제 신고