Add code duplication analysis workflow#7874
Open
Evangelink wants to merge 4 commits intomainfrom
Open
Conversation
STA (Single Threaded Apartment) is a Windows-only COM threading concept. On non-Windows platforms, STATestMethodAttribute now: - Runs the test without STA context (unchanged behaviour) - Appends a warning to the test output explaining STA was not applied - Documents the design decision with a clear code comment Removes the ambiguous '// TODO: Throw?' comment.
STATestMethodAttribute now throws PlatformNotSupportedException on non-Windows platforms since STA is a Windows-only COM concept. The error message guides users to use [OSCondition(OperatingSystems.Windows)] to skip the test on non-Windows platforms.
Add NETFRAMEWORK-compatible OS check using Environment.OSVersion.Platform so that STATestMethodAttribute throws PlatformNotSupportedException on Mono running on non-Windows, not just on .NET Core/5+.
Adds an agentic GitHub Actions workflow that: - Scans C# source code for duplicated blocks using jscpd (Rabin-Karp) - Feeds top findings (with source context) to GitHub Models API for analysis - Classifies each duplicate: Extract Method, Template Method, Intentional, etc. - Creates/updates a GitHub issue with prioritized refactoring recommendations - Runs weekly on schedule or on-demand via workflow_dispatch Files: - .github/workflows/dedup-analysis.yml: Main workflow definition - .github/scripts/analyze-duplicates.py: LLM-powered analysis script - .github/scripts/scan-duplicates.ps1: Local scan helper (PowerShell) - .jscpd.json: jscpd configuration tuned for the repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an agentic GitHub Actions workflow that automatically detects and analyzes code duplication in the \src/\ directory.
How it works
Each finding is classified as:
Trigger
Files
Initial local scan results
A local scan found 304 clones at 5.58% duplication across 1013 source files. Top findings include: