FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

refactor: migrate to StyleSharp analyzers, reach clean -warnaserror across the full solution, and add SonarCloud/CodeQL CI by glennawatson · Pull Request #1593 · reactiveui/splat · GitHub

refactor: migrate to StyleSharp analyzers, reach clean -warnaserror across the full solution, and add SonarCloud/CodeQL CI - #1593

Merged
glennawatson merged 10 commits into
mainfrom
refactor/publicapi-approval-disposables
Jun 12, 2026
Merged

refactor: migrate to StyleSharp analyzers, reach clean -warnaserror across the full solution, and add SonarCloud/CodeQL CI#1593
glennawatson merged 10 commits into
mainfrom
refactor/publicapi-approval-disposables

Conversation

glennawatson commented Jun 11, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Summary

The headline change is migrating the analyzer stack from StyleCop (stylecop.analyzers 1.2.0-beta.556) to StyleSharp (StyleSharp.Analyzers 3.3.2) and bringing the entire solution — production and test projects — into compliance with the new rule set under -warnaserror. That compliance work is the bulk of this PR.

A few infrastructure cleanups and the CI additions ride along because the rule churn made them convenient to land together.

StyleCop → StyleSharp (the main change)

  • Replaces stylecop.analyzers with StyleSharp.Analyzers 3.3.2 across all projects.
  • Brings the production code into compliance with the SST* rules:
    • Documentation coverage — SST1600/1601/1602/1654 (exposed, internal, and private element docs) with the matching stylesharp.* settings.
    • Whitespace / blank-line rules — SST1505/1507/1518.
    • Summary single-line length (stylesharp.summary_single_line_max_length) and the wrapping/placement rules.
  • Updates .editorconfig accordingly and disables the Roslynator rules StyleSharp now owns (RCS0058/0059/0063).

Test-project compliance (now part of this PR)

  • Documents every private field/constant flagged by SST1600 across the production libraries and the test projects (SST1600 now enforces docs on private members).
  • Refactors the SonarAnalyzer findings in the tests rather than suppressing them:
    • S109 / S1192 — names the repeated magic numbers and string literals (e.g. a shared NamedContract/count constants, the Drawing colour constants).
    • S2365 — the Log4Net mock's Logs property no longer copies a collection in the getter (extracted to a BuildLogs() method, keeping the interface property).
    • S100 — renames ARGB* test methods to Argb*.
  • Extracts the duplicated logging-test literals into a shared LoggerTestConstants and links it into the logging-adapter test projects (fixes the resulting CS0234).
  • Modernizes the test data sources to strongly-typed TUnit sources — removes the xUnit-era XUnitHelpers (object[] boxing) in favour of IEnumerable<KnownColor> and tuple sequences that TUnit unpacks directly.

CI: SonarCloud + CodeQL

  • Adds SonarCloud and CodeQL Advanced workflows using the shared reactiveui/actions-common reusable workflows.
  • SonarCloud excludes the tests/ and Benchmarks/ folders from analysis, coverage, copy-paste detection, and test detection; analysis is skipped automatically when SONAR_TOKEN is absent (e.g. forks).

Smaller cleanups landed alongside

  • Compile-included polyfills/helpers — moved to src/Polyfills, compile-included into each assembly with per-TFM Using aliases (BCL types on net8+, polyfills on net4x). Drops production InternalsVisibleTo (kept only for test projects that white-box internals); adds AppLocator.RegisterResolverInitializer so Splat no longer reaches into Splat.Core internals.
  • Disposables — references ReactiveUI.Disposables 3.0.0 and deletes the internal ActionDisposable/BooleanDisposable/CompositeDisposable copies, rewiring to the package types (ActionDisposable.Empty → EmptyDisposable.Instance, CompositeDisposable → MultipleDisposable).
  • Public API tracking — switches from Verify/PublicApiGenerator to the Roslyn PublicApiAnalyzers with per-TFM baselines wired via Directory.Build.props.

Verification

  • Linux: the full solution — including every test project — builds clean (0 errors / 0 warnings) with -warnaserror. TargetFrameworkExtensionsTests (27) and SplatColorTests (350) pass, confirming the new strongly-typed data sources bind correctly at runtime.
  • Apple (.NET 11 preview 5 VM with real workloads): all 16 Splat.Drawing and Splat.AppCenter builds — net10/net11 × ios, maccatalyst, macos, tvos — pass with 0 compile errors and 0 analyzer diagnostics.
  • CI: build (Linux/macOS/Windows), SonarCloud, and CodeQL run on this PR.

…th all rules

Swap the analyzer stack from stylecop.analyzers (1.2.0-beta.556) to
StyleSharp.Analyzers 3.3.2 and bring the entire codebase into compliance
with the new rule set. This is the bulk of the change: ~300 source files
updated for the SST* diagnostics — documentation coverage
(SST1600/1601/1602/1654, with summary/element doc settings), whitespace
and blank-line rules (SST1505/1507/1518), summary single-line length, and
the various wrapping/placement rules — plus the corresponding
.editorconfig configuration and the Roslynator overlaps that StyleSharp
now owns (RCS0058/0059/0063 disabled).

Alongside the analyzer migration, this also folds in a few smaller
infrastructure cleanups that the rule churn made convenient to land
together:

- Compile-included polyfills/helpers: move the shared polyfills and
  guard helpers to src/Polyfills, compile-included into each assembly
  with per-TFM Using aliases (BCL types on net8+, polyfills on net4x),
  and drop InternalsVisibleTo from the production libraries (kept only
  for test projects that white-box internals). Adds
  AppLocator.RegisterResolverInitializer so Splat no longer reaches into
  Splat.Core internals.

- Disposables: reference ReactiveUI.Disposables 3.0.0 and delete the
  internal ActionDisposable/BooleanDisposable/CompositeDisposable copies,
  rewiring usages to the package types (ActionDisposable.Empty ->
  EmptyDisposable.Instance, CompositeDisposable -> MultipleDisposable).

- Public API tracking: switch from Verify/PublicApiGenerator to the
  Roslyn PublicApiAnalyzers with per-TFM baselines wired via
  Directory.Build.props.

Verified: full Linux solution builds clean (0 errors/0 warnings) with
tests passing, and all Apple TFM builds for Splat.Drawing and
Splat.AppCenter (net10/net11 ios, maccatalyst, macos, tvos) pass.
glennawatson force-pushed the refactor/publicapi-approval-disposables branch from f17e4dc to 9764952 Compare June 11, 2026 07:01
glennawatson changed the title refactor: Roslyn PublicAPI approval, compile-included polyfills, and ReactiveUI.Disposables refactor: migrate from StyleCop to StyleSharp analyzers and comply with all rules Jun 11, 2026
Bring the full solution to a clean `dotnet build -warnaserror` now that
SST1600 enforces documentation on private fields and constants.

- Add XML doc comments to all private fields/consts flagged by SST1600
  across Splat.Core, Splat.Drawing, Splat.Logging and the DI/logging/APM
  adapters, plus the test projects.
- Link the shared LoggerTestConstants into the logging adapter test
  projects that consume the base test fixtures (fixes CS0234).
- Log4Net test: extract the Logs projection into a BuildLogs() method so
  the interface property no longer copies a collection (S2365).
- Serilog test: use the shared LoggerTestConstants.TestMessage (S1192).
- BaseDependencyResolverTests: name the repeated contract/count literals
  as constants (S109/S1192).
- Drawing color tests: name magic numbers, rename ARGB* methods to Argb*
  (S100), and document the Eps tolerance.
- Replace the xUnit-era XUnitHelpers with strongly-typed TUnit data
  sources: SplatColorTests enumerates KnownColor directly and
  TargetFrameworkExtensionsTests uses a tuple sequence.
Add SonarCloud and CodeQL Advanced analysis workflows using the shared
reactiveui/actions-common reusable workflows, matching the Primitives
repo setup.

SonarCloud excludes the tests and Benchmarks folders from analysis,
coverage, copy-paste detection, and test detection. The analysis is
skipped automatically when SONAR_TOKEN is not configured (e.g. on forks).

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

glennawatson changed the title refactor: migrate from StyleCop to StyleSharp analyzers and comply with all rules refactor: migrate to StyleSharp analyzers, reach clean -warnaserror across the full solution, and add SonarCloud/CodeQL CI Jun 11, 2026
…ryIoc tests

Updated `DryIocDependencyResolver` test cases and assertions to throw `NotSupportedException` instead of `NotImplementedException` where applicable. Adjusted related comments and added `IsDefaultKey` helper method for improved clarity. Incremented relevant package versions in `Directory.Packages.props`.
…ove color conversion logic

- Split `FromNative(bool copy)` into separate overloads for better readability.
- Introduced `ByteComponentMax` constant for consistent color component normalization.
- Adjusted XML doc comments and updated API baselines for all platforms.
- Change `LogLevel.Error` to `LogLevel.Fatal` in test cases to ensure correct log level behavior validation.
- Clarify usage of the `:l` (literal) specifier to avoid added quotes in emitted text.

codecov Bot commented Jun 12, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.26892% with 166 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.95%. Comparing base (28c00e6) to head (9943de4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/Splat.Drawing/DefaultPlatformModeDetector.cs 0.00% 39 Missing ⚠️
...nericFirst/GlobalGenericFirstDependencyResolver.cs 46.66% 21 Missing and 3 partials ⚠️
...ricFirst/InstanceGenericFirstDependencyResolver.cs 71.01% 18 Missing and 2 partials ⚠️
src/Splat.Autofac/AutofacDependencyResolver.cs 77.38% 11 Missing and 8 partials ⚠️
...t.Core/ServiceLocation/ModernDependencyResolver.cs 82.75% 7 Missing and 3 partials ⚠️
src/Splat.Drawing/Colors/SplatColor.cs 79.06% 7 Missing and 2 partials ⚠️
.../ServiceLocationDrawingInitializationExtensions.cs 0.00% 5 Missing ⚠️
...lat.Drawing/Platforms/net6/Bitmaps/BitmapMixins.cs 0.00% 5 Missing ⚠️
...t.Drawing/Platforms/net6/Colors/ColorExtensions.cs 0.00% 5 Missing ⚠️
...wing/Platforms/net6/Colors/SplatColorExtensions.cs 0.00% 5 Missing ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1593      +/-   ##
==========================================
- Coverage   79.40%   78.95%   -0.46%     
==========================================
  Files         116      124       +8     
  Lines        7168     7036     -132     
  Branches     1143     1080      -63     
==========================================
- Hits         5692     5555     -137     
- Misses       1165     1169       +4     
- Partials      311      312       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Quality Gate failed

Failed conditions
76.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

glennawatson merged commit f0550c6 into main Jun 12, 2026
10 of 11 checks passed
glennawatson deleted the refactor/publicapi-approval-disposables branch June 12, 2026 00:35

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions Bot locked as resolved and limited conversation to collaborators Jun 26, 2026
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL