Repository navigation
Address the Codacy findings on #6 (TIFF/EMF/WMF tests, input validation) - #7
Conversation
- ImageHeaderReader TIFF: an unsupported field type on a required field (width/height) is now rejected with InvalidDataException, optional resolution fields fall back to the default DPI, unrelated tags have an explicit default branch, and a TIFF without a width and height is rejected. - ExcelDrawings.AddPicture(FileInfo): throw ArgumentNullException, not Exception. - ExcelHeaderFooter.InsertPicture: validate the image before ValidateImage appends the picture placeholder to the section text, so rejected data leaves no placeholder behind; guard the FileInfo overload against null. - New tests: TIFF (both byte orders, cm units, missing/optional/required fields, truncated and wild offsets), EMF, WMF, and the InsertPicture overloads (bytes, stream, file, duplicate section, invalid data, null arguments). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 31 |
| Duplication | 0 |
🟢 Coverage 100.00% diff coverage · +0.31% coverage variation
Metric Results Coverage variation ✅ +0.31% coverage variation (-1.00%) Diff coverage ✅ 100.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (22a7e64) 47272 30474 64.47% Head commit (1839c9f) 47464 (+192) 30745 (+271) 64.78% (+0.31%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#7) 201 201 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
👀 Worth a closer look
Malformed TIFF offsets may escape the image-reader contract as overflow or range exceptions instead of InvalidDataException; this warrants review before relying on the stated validation behavior. ImageHeaderReader is also relatively complex, though existing coverage is strong and no uncovered complex files were reported.
1 comment outside of the diff
PanoramicData.EPPlus/Compatibility/ImageHeaderReader.cs
line 202🟡 MEDIUM RISK
Suggestion: Consider extracting TIFF entry decoding and/or IFD traversal into focused private helpers while preserving required dimension validation and optional resolution fallback.
Test suggestions
- TIFF parsing in little- and big-endian byte order
- TIFF centimetre resolution conversion
- TIFF missing dimensions and unsupported required/optional field types
- TIFF truncation and invalid offsets
- EMF dimensions and truncation handling
- WMF dimensions, custom units, and truncation handling
- Header/footer picture insertion from bytes, streams, and files
- Duplicate-section, invalid-image, and null-argument validation
- ExcelDrawings.AddPicture null FileInfo validation
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
| return required | ||
| ? throw new InvalidDataException($"Unsupported TIFF field type {type} for a required field") | ||
| : 0; |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Validate the TIFF value offset and required byte range against the input length before reading, and translate invalid offsets or ranges into InvalidDataException.
Codacy's analysis of #6 raised 7 new issues (2 high). This addresses the actionable ones.
Not changed: Codacy also flagged the removed test exclusions in ci.yml ("re-enables documented failures"). That is a false positive: the exclusions were removed because their root causes were fixed in #6, and the Linux CI run passes with none.
Verified locally: full suite 1199 passed, 0 failed, 214 skipped.
🤖 Generated with Claude Code