Skip to content

Back to home

Selected projects

PPCH Framework

Predictive and Proactive Code Health

Final-year dissertation · 2026 · Completed

Grew out of refactoring and SonarQube work during my internship.

  • Python
  • scikit-learn
  • XGBoost
  • GitHub REST API
  • SonarQube (SonarScanner)
  • GitHub Actions
  • Java (Apache Commons)

The problem

Code-quality issues are usually found after a pull request merges. Can complexity risk be predicted when a pull request is submitted, and fixed before it merges?

How it works

  1. Sense

    Mines PR history through the GitHub REST API and runs SonarScanner on before/after snapshots to build a leakage-safe dataset of 334 PRs.

  2. Analyze

    Compares four models with 1,000-iteration bootstrap validation; the best, Logistic Regression, reached 0.78 AUC.

  3. Act

    An ILP-based Extract Method engine proposes refactorings behind four safety checks; every applied suggestion was re-verified safe by a real SonarQube scan.

Results

  • Dataset

    1. 1,767PRs scraped
    2. 500sampled
    3. 497scanned
    4. 334usable
  • Model comparison

    Mean AUC, 1,000-iteration bootstrap validation
    ModelMean AUC95% CI
    Logistic Regressionbest0.7800.709–0.847
    XGBoost0.750–
    Random Forest0.746–
    Naive Bayes0.660–
  • Act engine

    ILP-based Extract Method with four safety checks:

    • Return-forwarding
    • Break/continue
    • Independent-variable mutation
    • Non-productive extraction
    • 10 suggestions applied, each re-verified safe by a real SonarQube scan
    • 4 correctly declined
    • 0 unsafe
  • Deployed GitHub Action

    A reactive scanner took a mean 82.4 h (median 12.9 h) to flag complexity-increasing PRs.

    The Action caught 22 of 52 (42.3%) before merge.

Screenshots

Limitations

The deployed Action runs Random Forest + XGBoost; Logistic Regression was found best later, in the four-model comparison.