Skip to content

Enable CA1836#9423

Merged
glen-84 merged 1 commit intomainfrom
gai/CA1836
Mar 23, 2026
Merged

Enable CA1836#9423
glen-84 merged 1 commit intomainfrom
gai/CA1836

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Mar 23, 2026

Summary of the changes (Less than 80 chars)

  • Enable CA1836.

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

Enables the .NET analyzer rule CA1836 (“Prefer IsEmpty over Count when available”) and updates a few call sites to comply, primarily on concurrent collections in runtime code and polling assertions in tests.

Changes:

  • Enable CA1836 as a warning in .editorconfig.
  • Replace Count > 0 / Count == 0 emptiness checks with IsEmpty on concurrent collections.
  • Update several Mocha integration tests’ polling conditions to use IsEmpty.

Reviewed changes

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

Show a summary per file
File Description
src/StrawberryShake/Client/src/Transport.WebSockets/Session.cs Uses ConcurrentDictionary.IsEmpty instead of Count > 0 during disposal.
src/Mocha/test/Mocha.Transport.RabbitMQ.Tests/Behaviors/InboxTests.cs Uses ConcurrentBag.IsEmpty in polling wait condition.
src/Mocha/test/Mocha.Transport.InMemory.Tests/Behaviors/InboxTests.cs Uses ConcurrentBag.IsEmpty in polling wait condition.
src/Mocha/test/Mocha.Tests/Outbox/OutboxIntegrationTests.cs Uses ConcurrentBag.IsEmpty in polling wait conditions.
src/Mocha/test/Mocha.Tests/Inbox/InboxIntegrationTests.cs Uses ConcurrentBag.IsEmpty in polling wait condition.
src/HotChocolate/Core/src/Types/Utilities/Subscriptions/ObservableSourceStreamAdapter.cs Uses ConcurrentQueue.IsEmpty instead of Count == 0 before awaiting.
.editorconfig Adds CA1836 severity configuration.

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

@glen-84 glen-84 merged commit ff721c0 into main Mar 23, 2026
253 of 255 checks passed
@glen-84 glen-84 deleted the gai/CA1836 branch March 23, 2026 08:27
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (6a3b7a3) to head (2e25865).
⚠️ Report is 1005 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #9423       +/-   ##
==========================================
- Coverage   74.16%       0   -74.17%     
==========================================
  Files        2677       0     -2677     
  Lines      140790       0   -140790     
  Branches    16371       0    -16371     
==========================================
- Hits       104421       0   -104421     
+ Misses      30774       0    -30774     
+ Partials     5595       0     -5595     
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants