Skip to content

Remove unused pushedManifest local variable in CopyUtils#1

Open
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260610-071923-f0aeba70
Open

Remove unused pushedManifest local variable in CopyUtils#1
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260610-071923-f0aeba70

Conversation

@sonarqube-agent

Copy link
Copy Markdown

This PR was created because a team member assigned these issues to the Remediation Agent.

Removes an unused local variable declaration in CopyUtils.java that was capturing the return value from pushManifest() without ever being referenced. The method call is still executed for its side effects, eliminating the code smell while maintaining the same functionality.

View Project in SonarCloud


Fixed Issues

java:S1481 - Remove this unused "pushedManifest" local variable. • MINORView issue

Location: src/main/java/land/oras/CopyUtils.java:244

Why is this an issue?

An unused local variable is a variable that has been declared but is not used anywhere in the block of code where it is defined. It is dead code, contributing to unnecessary complexity and leading to confusion when reading the code. Therefore, it should be removed from your code to maintain clarity and efficiency.

What changed

This hunk removes the unused local variable 'pushedManifest' by changing the assignment statement 'Manifest pushedManifest = target.pushManifest(' to just 'target.pushManifest('. The method call is still executed for its side effects, but the return value is no longer captured in a variable that was never used, eliminating the unused local variable code smell.

--- a/src/main/java/land/oras/CopyUtils.java
+++ b/src/main/java/land/oras/CopyUtils.java
@@ -244,1 +244,1 @@ public final class CopyUtils {
-                    Manifest pushedManifest = target.pushManifest(
+                    target.pushManifest(

Have a suggestion or found an issue? Share your feedback here.


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZ6wRBfVQw83x_y7ZeMC for java:S1481 rule

Generated by SonarQube Agent (task: 57d776ba-dfc2-4383-a395-f7fb0c9d6f79)
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant