Skip to content

supplemental: Add violation message in unusedLocalVariable input files#15189

Merged
romani merged 1 commit into
checkstyle:masterfrom
checkstyle-GSoC25:message
Jul 2, 2024
Merged

supplemental: Add violation message in unusedLocalVariable input files#15189
romani merged 1 commit into
checkstyle:masterfrom
checkstyle-GSoC25:message

Conversation

@mahfouz72

@mahfouz72 mahfouz72 commented Jul 2, 2024

Copy link
Copy Markdown
Member

We will introduce a new message in #15187. So we need to update all existing files to specify the message. Specifying the message is obligatory when we have more than one.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Item

int ab = 12;
ab += a;
int var1 = 1; // violation
int var1 = 1; // violation, 'Unused local variable*.'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

// violation, 'Unused local variable'
Or put name of variable name to message, but if case is simple, no need

@mahfouz72 mahfouz72 Jul 2, 2024

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done. I didn't add the variable name because each file will require manual updates. I did it using the "replace All" option in Intelliji.
I just realized that we can close "remove unnecessary ok" issue with one click. I don't know what prevents us from doing this in a single PR :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, it is easy, but somebody needs to do this.
And there nuances.

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

.

String foo = "", hoo = "";
String hoo2 = ""; // violation, 'Unused local variable'
String hoo3 = ""; // violation, 'Unused local variable'
// violation below, 'Unused local variable*.'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In all places

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@romani romani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok to merge

@romani romani merged commit d2e1bea into checkstyle:master Jul 2, 2024
@mahfouz72 mahfouz72 deleted the message branch July 2, 2024 22:27
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.

2 participants