Skip to content

Comments

Resolve MA0070 warnings by adding messages to Obsolete attributes#618

Open
berezovskyi wants to merge 1 commit intomainfrom
fix-obsolete-warnings-12228312863931765693
Open

Resolve MA0070 warnings by adding messages to Obsolete attributes#618
berezovskyi wants to merge 1 commit intomainfrom
fix-obsolete-warnings-12228312863931765693

Conversation

@berezovskyi
Copy link
Member

@berezovskyi berezovskyi commented Feb 21, 2026

Resolve MA0070 warnings by adding messages to Obsolete attributes in OslcClient, ChangeRequest, and OslcQuery.
Fixed internal usage of GetQueryUrl in OslcQuery and suppressed CS0618 in OslcClient constructor.
Verified with dotnet build and dotnet run --project ... for tests.


PR created automatically by Jules for task 12228312863931765693 started by @berezovskyi

Summary by CodeRabbit

  • Chores
    • Updated deprecation guidance for legacy API methods across multiple SDK components.
    • Enhanced obsolete attribute messages in ChangeRequest, OslcClient, and OslcQuery classes to provide developers with explicit recommendations for modern alternatives, including resource type operations, asynchronous methods, and certificate validation practices.

This commit adds descriptive messages to `[Obsolete]` attributes in `OslcClient.cs`, `ChangeRequest.cs`, and `OslcQuery.cs`, addressing the `MA0070` analyzer warning.
Internal usages of the now-explicitly-obsolete members were updated or suppressed to prevent `CS0618` warnings:
- `OslcQuery.cs`: Replaced internal call to `GetQueryUrl()` with direct usage of `uriBuilder.ToString()`.
- `OslcClient.cs`: Suppressed `CS0618` for the private constructor calling the obsolete protected constructor, as it is a necessary internal implementation detail.

Co-authored-by: berezovskyi <64734+berezovskyi@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Walkthrough

The PR adds explicit deprecation guidance messages to obsolete public API members across four files, directing callers to recommended alternatives such as async variants and newer constructors. Additionally, the OslcQuery constructor is adjusted to initialize queryUrl using uriBuilder.ToString() directly. No functional logic changes occur.

Changes

Cohort / File(s) Summary
ChangeRequest Deprecation Messages
OSLC4Net_SDK/OSLC4Net.ChangeManagement/ChangeRequest.cs, OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ChangeRequest.cs
Updated Obsolete attributes with guidance messages: GetRdfTypes() and SetRdfTypes() direct to GetTypes() or .Types property; AddRdfType() directs to AddType().
OslcClient Deprecation Enhancements
OSLC4Net_SDK/OSLC4Net.Client/Oslc/OslcClient.cs
Replaced bare Obsolete attributes with explicit messages on constructors and methods, advising HttpClient-based constructors for certificate validation, async variants (DeleteResourceAsync, UpdateResourceRawAsync), and marking AcceptAllServerCertificates() as insecure.
OslcQuery Updates
OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/OslcQuery.cs
Constructor now initializes queryUrl with uriBuilder.ToString() instead of GetQueryUrl(); GetQueryUrl() Obsolete attribute updated to direct callers to QueryUri.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Improve resilience #464: Introduces HttpClient-taking constructor and async helpers to OslcClient; this PR updates Obsolete messages to guide callers toward those new HttpClient-based alternatives.

Poem

🐰 A rabbit hops through deprecated halls,
Leaving signs where old code calls,
"Try this path, much better, see?"
Guidance bright for API!
Evolution, gentle and clear.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.82% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the primary change: adding messages to Obsolete attributes to resolve MA0070 warnings across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-obsolete-warnings-12228312863931765693

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.85%. Comparing base (7962779) to head (444b71e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #618      +/-   ##
==========================================
- Coverage   50.86%   50.85%   -0.01%     
==========================================
  Files         174      174              
  Lines       10202    10202              
  Branches     1010     1010              
==========================================
- Hits         5189     5188       -1     
- Misses       4756     4757       +1     
  Partials      257      257              

☔ 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
OSLC4Net_SDK/OSLC4Net.ChangeManagement/ChangeRequest.cs (1)

716-720: ⚠️ Potential issue | 🟡 Minor

AddRdfType in this class is missing [Obsolete] — inconsistent with Client/Oslc/Resources/ChangeRequest.cs

This PR deprecates AddRdfType(Uri rdfType) in OSLC4Net.Client/Oslc/Resources/ChangeRequest.cs (line 123), but the identical method at line 126 of this file is left without [Obsolete]. Callers using OSLC4Net.ChangeManagement.ChangeRequest get no deprecation signal.

✏️ Suggested addition
+    [Obsolete("Use AddType instead")]
     public void AddRdfType(Uri rdfType)
     {
         AddType(rdfType);
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@OSLC4Net_SDK/OSLC4Net.ChangeManagement/ChangeRequest.cs` around lines 716 -
720, Mark the ChangeRequest.AddRdfType(Uri rdfType) method as obsolete to match
the client variant: add the [Obsolete("Use AddType() or .Types instead")]
attribute directly above the AddRdfType(Uri rdfType) declaration in the
OSLC4Net.ChangeManagement.ChangeRequest class so callers get a deprecation
warning consistent with OSLC4Net.Client/Oslc/Resources/ChangeRequest.cs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ChangeRequest.cs`:
- Line 123: There are two pre-existing typos in the Obsolete attribute messages
on the ChangeRequest class: the messages referencing GetTypes and SetTypes read
"User ..." instead of "Use ..."; update the Obsolete string for the members
associated with GetTypes() and SetTypes() (the Obsolete attributes applied to
the GetTypes and SetTypes members in ChangeRequest) to say "Use GetTypes()
instead" and "Use SetTypes() instead" respectively so they match the
already-correct "Use AddType instead" message.

---

Outside diff comments:
In `@OSLC4Net_SDK/OSLC4Net.ChangeManagement/ChangeRequest.cs`:
- Around line 716-720: Mark the ChangeRequest.AddRdfType(Uri rdfType) method as
obsolete to match the client variant: add the [Obsolete("Use AddType() or .Types
instead")] attribute directly above the AddRdfType(Uri rdfType) declaration in
the OSLC4Net.ChangeManagement.ChangeRequest class so callers get a deprecation
warning consistent with OSLC4Net.Client/Oslc/Resources/ChangeRequest.cs.

}

[Obsolete]
[Obsolete("Use AddType instead")]
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

LGTM — opportunity to fix two pre-existing typos in the same file while you're here

Line 123 correctly uses "Use AddType instead". However, the two adjacent pre-existing messages at lines 341 and 696 say "User GetTypes()..." / "User SetTypes()..." (typo: UserUse), creating an inconsistency with OSLC4Net.ChangeManagement/ChangeRequest.cs (changed in this PR) which correctly spells them as "Use GetTypes()..." / "Use SetTypes()...".

✏️ Suggested fixes for pre-existing typos
-    [Obsolete("User GetTypes() or .Types instead")]
+    [Obsolete("Use GetTypes() or .Types instead")]
     public Uri[] GetRdfTypes()
-    [Obsolete("User SetTypes() or .Types instead")]
+    [Obsolete("Use SetTypes() or .Types instead")]
     public void SetRdfTypes(Uri[] rdfTypes)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@OSLC4Net_SDK/OSLC4Net.Client/Oslc/Resources/ChangeRequest.cs` at line 123,
There are two pre-existing typos in the Obsolete attribute messages on the
ChangeRequest class: the messages referencing GetTypes and SetTypes read "User
..." instead of "Use ..."; update the Obsolete string for the members associated
with GetTypes() and SetTypes() (the Obsolete attributes applied to the GetTypes
and SetTypes members in ChangeRequest) to say "Use GetTypes() instead" and "Use
SetTypes() instead" respectively so they match the already-correct "Use AddType
instead" message.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant