Resolve MA0070 warnings by adding messages to Obsolete attributes#618
Resolve MA0070 warnings by adding messages to Obsolete attributes#618berezovskyi wants to merge 1 commit intomainfrom
Conversation
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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
WalkthroughThe 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 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
AddRdfTypein this class is missing[Obsolete]— inconsistent withClient/Oslc/Resources/ChangeRequest.csThis PR deprecates
AddRdfType(Uri rdfType)inOSLC4Net.Client/Oslc/Resources/ChangeRequest.cs(line 123), but the identical method at line 126 of this file is left without[Obsolete]. Callers usingOSLC4Net.ChangeManagement.ChangeRequestget 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")] |
There was a problem hiding this comment.
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: User → Use), 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.
Resolve MA0070 warnings by adding messages to Obsolete attributes in OslcClient, ChangeRequest, and OslcQuery.
Fixed internal usage of
GetQueryUrlinOslcQueryand suppressedCS0618inOslcClientconstructor.Verified with
dotnet buildanddotnet run --project ...for tests.PR created automatically by Jules for task 12228312863931765693 started by @berezovskyi
Summary by CodeRabbit