[tools] Convert tools/diff-to-html to a C# script in scripts/diff-to-html#24756
[tools] Convert tools/diff-to-html to a C# script in scripts/diff-to-html#24756rolfbjarne merged 2 commits intomainfrom
Conversation
…html Replace the old Mono csharp script with a proper .NET project following the scripts/ directory pattern. Update compare-commits.sh to use the new script via dotnet run. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the tools/diff-to-html Mono csharp script to a modern .NET project in scripts/diff-to-html, following the established pattern for C# scripts in the repository. The script converts unified diff files into styled HTML pages for easier viewing.
Changes:
- Converted Mono csharp script to a proper .NET project with top-level statements
- Changed from
System.Web.HttpUtility.HtmlEncodetoSystem.Net.WebUtility.HtmlEncodefor modern .NET compatibility - Updated
compare-commits.shto invoke the script viadotnet runinstead of direct execution - Added build system integration files (fragment.mk, csproj) following the scripts/ directory pattern
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/compare-commits.sh | Updated invocation to use dotnet run --project instead of direct script execution |
| scripts/diff-to-html/fragment.mk | Added makefile fragment for build system integration following template pattern |
| scripts/diff-to-html/diff-to-html.csproj | Created project file targeting .NET runtime version from BundledNETCoreAppTargetFrameworkVersion |
| scripts/diff-to-html/diff-to-html.cs | Migrated script from Mono csharp to modern C# with top-level statements and nullable reference types |
| scripts/diff-to-html/README.md | Added documentation explaining the script's purpose and usage |
Comments suppressed due to low confidence (5)
scripts/diff-to-html/diff-to-html.cs:154
- The filename 'fn' is inserted into HTML without encoding. If the filename contains special HTML characters like '<', '>', or '&', they could break the HTML structure or create XSS vulnerabilities. Use WebUtility.HtmlEncode(fn) before inserting into the HTML output.
scripts/diff-to-html/diff-to-html.cs:157 - The 'line' variable is inserted into HTML without encoding. This should use WebUtility.HtmlEncode(line) to prevent HTML special characters from breaking the structure, consistent with line 184 where line content is properly encoded.
scripts/diff-to-html/diff-to-html.cs:167 - The 'line' variable is inserted into HTML without encoding. This should use WebUtility.HtmlEncode(line) to prevent HTML special characters from breaking the structure, consistent with line 184 where line content is properly encoded.
scripts/diff-to-html/diff-to-html.cs:166 - The code assumes the array 'nl' has at least 2 elements after splitting. If the line format is unexpected, accessing nl[0] or nl[1] could throw an IndexOutOfRangeException. Consider adding bounds checking to ensure the array has the expected number of elements before accessing them.
scripts/diff-to-html/diff-to-html.cs:152 - The code assumes the filename path has at least 2 path components (e.g., "a/b/file"). If the path is shorter, calling
RemoveAt(0)twice will throw an IndexOutOfRangeException. Consider adding bounds checking before removing elements, or using Skip to safely remove the first two elements.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #5bc5c79] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [CI Build #5bc5c79] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #5bc5c79] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #5bc5c79] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 156 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Replace the old Mono csharp script with a proper .NET project following
the scripts/ directory pattern. Update compare-commits.sh to use the
new script via dotnet run.
This fixes a problem with api-diff not working