From 91fcaaaca38f5cf36cc43da6a7f92a9060d2a728 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 23 Oct 2026 13:35:38 -0400 Subject: [PATCH] coverage: keep the body scan linear and build the zero counter with dict.fromkeys (SonarCloud S8786/S7519) (#2713) - ORF_DECODED's Camedia branch drops the redundant \\S+ before .*; with two anchored greedies the scanner can no longer retry the same substring count-for-count at lower and lower split points (same match set, verified on 14 body strings). - {c: 0 for c in classes} is now dict.fromkeys(classes, 0), which the rule wants and which stones the per-class counters. --- docs/raw/coverage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/raw/coverage.py b/docs/raw/coverage.py index a9a5f521f..3db93ce81 100644 --- a/docs/raw/coverage.py +++ b/docs/raw/coverage.py @@ -29,7 +29,7 @@ HERE = os.path.dirname(os.path.abspath(__file__)) # Olympus ORF bodies that write uncompressed / packed data (crates/raw/src/vendor/orf.rs). Everything else # writes compressed ORF, which is preview-only (the E-M5 II / PEN-F high-res mode alone is decoded). -ORF_DECODED = re.compile(r"^(E-1|E-10|E-20|EVOLT E-300|EVOLT E-330|EVOLT E-400|EVOLT E-500|E-300|E-330|E-500|Camedia C-\S+.*|Stylus XZ-2 iHS)$") +ORF_DECODED = re.compile(r"^(E-1|E-10|E-20|EVOLT E-300|EVOLT E-330|EVOLT E-400|EVOLT E-500|E-300|E-330|E-500|Camedia C-\S.*|Stylus XZ-2 iHS)$") # Samsung SRW bodies with compressed raw data (crates/raw/src/vendor/srw.rs refuses 32770 / 32772 / 32773). SRW_COMPRESSED = re.compile(r"(^|\W)(NX1|NX30|NX300|NX300M|NX500|NX2000|NX3000|NX3300|NX mini|EK-GN\d+|EK-KN\d+)(\W|$)") # Fujifilm bodies before the X series whose RAF has no raw IFD (crates/raw/src/vendor/raf.rs). @@ -123,7 +123,7 @@ def main(): classes = ["verified", "unverified", "preview", "unsupported"] by_maker = {} for r in rows: - by_maker.setdefault(r["maker"], {c: 0 for c in classes})[r["class"]] += 1 + by_maker.setdefault(r["maker"], dict.fromkeys(classes, 0))[r["class"]] += 1 print("| Maker | Adobe models | verified | unverified | preview | unsupported |") print("|---|---:|---:|---:|---:|---:|") for m, c in sorted(by_maker.items(), key=lambda kv: -sum(kv[1].values())):