Erstellt: 2025-12-25 | Aktualisiert: 2025-12-27

Prinzip

Jeder Faktor wird auf 0-100 normalisiert:

Lineare Interpolation dazwischen. Keine Sprünge, keine Magie.

Normalisierungsformel

Für Metriken wo weniger = sauberer:

normalized = max(0, 100 - ((wert - optimal) / (grenze - optimal)) × 100)

Beispiel LOC:
- optimal = 100, grenze = 600
- Bei 350 LOC: 100 - ((350-100) / 500) × 100 = 50

Normalisierung pro Faktor

Lines of Code

normalize_loc(loc):
    if loc ≤ 100: return 100   # sauber
    if loc ≥ 600: return 0     # Grenze
    return 100 - ((loc - 100) / 500) × 100
LOCScoreStatus
80100Sauber
20080Gepflegt
35050Vernachlässigt
50020Verschmutzt
600+0Kritisch

Methoden-Anzahl

normalize_methods(count):
    if count ≤ 5: return 100
    if count ≥ 20: return 0
    return 100 - ((count - 5) / 15) × 100
MethodenScore
5100
1067
1533
20+0

Klassen pro Datei

normalize_classes(count):
    if count == 1: return 100
    if count == 2: return 50
    if count == 3: return 25
    return 0

Dependencies

normalize_deps(count):
    if count ≤ 3: return 100
    if count ≥ 20: return 0
    return 100 - ((count - 3) / 17) × 100

Hardcoded Secrets

normalize_secrets(count):
    if count == 0: return 100
    if count ≥ 1: return 20   # Hard Fail

Sonderregel: Secrets sind ein Hygiene-Killer. Ein Fund → Score maximal 20.

Magic Numbers

normalize_magic(count):
    if count == 0: return 100
    if count ≤ 5: return 100 - (count × 10)
    return 50  # Floor

Weniger kritisch. Floor bei 50, nicht 0.

Dateityp-Anpassungen

Pragmatische Hygiene berücksichtigt Kontext:

DateitypAnpassungBegründung
ControllerMethoden-Grenze: 25Mehr Actions normal
EntityLOC-Grenze: 400Sollten schlank sein
RepositoryMethoden-Grenze: 25Viele CRUD-Methoden
ConfigMagic Numbers: ignoriertDort gehören sie hin
TestLOC-Grenze: 800Test-Setup braucht Platz