Skip to content

Stylistic consistency#49

Merged
Tyrrrz merged 3 commits intoprimefrom
copilot/style-consistency-updates
Apr 17, 2026
Merged

Stylistic consistency#49
Tyrrrz merged 3 commits intoprimefrom
copilot/style-consistency-updates

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

Enforces five style rules uniformly across the library and test project.

TFM guard placement

Guards belong at the top of the file when the entire file's content depends on the TFM (i.e. the type being extended is itself TFM-specific); otherwise at method level.

  • StreamExtensions.cs, TextReaderExtensions.cs: guard is inside the extension block at method level — Stream and TextReader exist on all TFMs; only the individual async methods rely on TFM-specific APIs.
  • Observable.cs, SynchronizedObserver.cs: guard at file top — IObservable<T> itself requires NET40+, so the whole type is TFM-specific.
  • Files with a mix of guarded/unguarded methods (AssemblyExtensions.cs, FileExtensions.cs) keep method-level guards.

ExcludeFromCoverage on all PowerKit types

  • Added the conditional [ExcludeFromCodeCoverage] block to DelegateDisposable and AsyncDisposableAdapter, which were missing it.

Helper types: file access + declared before first use

  • ArrayPoolMemoryOwner<T> reordered to appear before ArrayPoolExtensions in ArrayPoolExtensions.cs.
  • DelegateDisposable and AsyncDisposableAdapter already had file accessibility; coverage attribute was the only gap.

No unnecessary named parameters

Removed named args wherever the parameter is not skipping an earlier default:

// Before
reader.SkipPadding(boundaryBytes: 4);
reader.SkipZeroes(maxSkipLength: 2);
Path.GetInvalidFileNameChars(crossPlatform: true);
new UTF8Encoding(encoderShouldEmitUTF8Identifier: true);

// After
reader.SkipPadding(4);
reader.SkipZeroes(2);
Path.GetInvalidFileNameChars(true);
new UTF8Encoding(true);

Named args are retained only where they skip an earlier optional parameter (e.g. onError: and onCompleted: in ObservableTests.cs).

var for all local declarations

Already consistent throughout; no changes needed.

Copilot AI and others added 2 commits April 17, 2026 14:06
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/7baa5f21-3d1a-4590-9457-f25749bfe36a

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
- Move TFM guards to file top in StreamExtensions.cs and TextReaderExtensions.cs (all methods in those files inherently rely on those TFMs)
- Add ExcludeFromCoverage to DelegateDisposable and AsyncDisposableAdapter
- Reorder ArrayPoolMemoryOwner before ArrayPoolExtensions (helper type declared before use)
- Remove unnecessary named parameters from test calls throughout the test suite

Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/615887ed-51d3-4f7c-89df-80f1fe80c993

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
@Tyrrrz Tyrrrz added the enhancement New feature or request label Apr 17, 2026
@Tyrrrz Tyrrrz marked this pull request as ready for review April 17, 2026 15:07
Copilot AI review requested due to automatic review settings April 17, 2026 15:07
@Tyrrrz Tyrrrz changed the title chore: stylistic consistency pass Stylistic consistency Apr 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.55%. Comparing base (764bd27) to head (8ed288d).
⚠️ Report is 1 commits behind head on prime.

Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #49      +/-   ##
==========================================
- Coverage   94.56%   94.55%   -0.02%     
==========================================
  Files          92       92              
  Lines        1951     1947       -4     
  Branches      152      152              
==========================================
- Hits         1845     1841       -4     
  Misses         77       77              
  Partials       29       29              

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread PowerKit/Extensions/StreamExtensions.cs Outdated
Comment thread PowerKit/Extensions/TextReaderExtensions.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies a uniform stylistic consistency pass across PowerKit and its test suite, primarily standardizing TFM guard placement, coverage-exclusion attributes for types, helper type ordering, and removal of unnecessary named arguments.

Changes:

  • Moved TFM guards to the top of files where the entire file is TFM-dependent (e.g., Observable/Stream/TextReader helpers).
  • Added conditional [ExcludeFromCodeCoverage] to previously uncovered helper types (DelegateDisposable, AsyncDisposableAdapter) and reordered helper types to appear before first use (ArrayPoolMemoryOwner<T>).
  • Removed named arguments where they don’t skip earlier optional parameters across tests.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
PowerKit/SynchronizedObserver.cs Moves the file-wide TFM guard to the top of the file.
PowerKit/Observable.cs Moves the file-wide TFM guard to the top of the file.
PowerKit/Extensions/TextReaderExtensions.cs Moves the file-wide TFM guard to the top and closes it at end-of-file.
PowerKit/Extensions/StreamExtensions.cs Moves the file-wide TFM guard to the top and closes it at end-of-file.
PowerKit/Extensions/AsyncDisposableExtensions.cs Adds conditional [ExcludeFromCodeCoverage] to AsyncDisposableAdapter.
PowerKit/Extensions/ArrayPoolExtensions.cs Reorders helper type before first use; keeps conditional coverage attributes per type.
PowerKit/Disposable.cs Adds conditional [ExcludeFromCodeCoverage] to DelegateDisposable.
PowerKit.Tests/ZipArchiveEntryExtensionsTests.cs Removes unnecessary named argument in ZipArchive constructor call.
PowerKit.Tests/TempFileTests.cs Removes unnecessary named argument in TempFile.Create(...).
PowerKit.Tests/TempDirectoryTests.cs Removes unnecessary named argument in TempDirectory.Create(...).
PowerKit.Tests/StreamExtensionsTests.cs Removes unnecessary named arguments in CopyToAsync(...) and assertion precision.
PowerKit.Tests/ProgressMuxerTests.cs Removes unnecessary named arguments in CreateInput(...).
PowerKit.Tests/PathExtensionsTests.cs Removes unnecessary named arguments in GetInvalid*Chars(...).
PowerKit.Tests/ObservableTests.cs Removes unnecessary named argument where it doesn’t skip earlier optionals.
PowerKit.Tests/FileExtensionsTests.cs Removes unnecessary named arguments in ReadAllBytes*(...) calls.
PowerKit.Tests/EncodingExtensionsTests.cs Removes unnecessary named arguments in UTF8Encoding(...) constructor calls.
PowerKit.Tests/DirectoryExtensionsTests.cs Removes unnecessary named arguments in TryDelete(...) calls.
PowerKit.Tests/BinaryWriterExtensionsTests.cs Removes unnecessary named arguments in SkipPadding(...).
PowerKit.Tests/BinaryReaderExtensionsTests.cs Removes unnecessary named arguments in SkipPadding(...) / SkipZeroes(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…erExtensions

Per review feedback: Stream and TextReader exist on all TFMs, so the guard
belongs inside the extension block on the individual methods, not at file top.

Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/3448c479-13bc-45bc-93a0-5ee8b3fc4617

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants