Skip to content

Issue #16421: Local variables should not be declared and then immediately returned or thrown S1488#16488

Closed
Pankraz76 wants to merge 2 commits intocheckstyle:masterfrom
Pankraz76:InlineVariableCheck-pr
Closed

Issue #16421: Local variables should not be declared and then immediately returned or thrown S1488#16488
Pankraz76 wants to merge 2 commits intocheckstyle:masterfrom
Pankraz76:InlineVariableCheck-pr

Conversation

@Pankraz76
Copy link
Copy Markdown

@Pankraz76 Pankraz76 commented Mar 6, 2025

issue: #16421

PoC:
image

@Pankraz76
Copy link
Copy Markdown
Author

first draw to check if this is any good

@Pankraz76 Pankraz76 closed this Mar 6, 2025
@Pankraz76 Pankraz76 reopened this Mar 6, 2025
@Pankraz76 Pankraz76 force-pushed the InlineVariableCheck-pr branch 3 times, most recently from c5915d5 to 7418cfa Compare March 9, 2025 15:02
@Pankraz76 Pankraz76 marked this pull request as ready for review March 9, 2025 15:02
@Pankraz76
Copy link
Copy Markdown
Author

kindly request some feedback @romani

this is kind of the same like the other one: #16435

Copy link
Copy Markdown
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

items:

Comment thread .ci/validation.sh Outdated
echo "Checkout target sources ..."
checkout_from "https://github.com/pmd/build-tools.git"
# checkout_from "https://github.com/pmd/build-tools.git"
checkout_from "https://github.com/kkoutsilis/build-tools.git"
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.

remove all unrelated changes from your PR, too much files are changed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i only see this right now im wondering why. Thanks

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.

you did something weird on your local , and you pulled somebody else changes to your commit.
just redo commit.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

lets complete as least this checker then, if not unused method check is possible. Check return and throw is possible. @romani

@Pankraz76 Pankraz76 marked this pull request as draft March 16, 2025 12:40
@Pankraz76 Pankraz76 changed the title Issue #16421: (RSPEC-S1488): Local variables should not be declared and then immediately returned or thrown Issue #16421: Local variables should not be declared and then immediately returned or thrown - (RSPEC-S1488) Apr 1, 2025
@Pankraz76 Pankraz76 changed the title Issue #16421: Local variables should not be declared and then immediately returned or thrown - (RSPEC-S1488) Issue #16421: introduce InlineVariableCheck - Local variables should not be declared and then immediately returned or thrown - (RSPEC-S1488) Apr 4, 2025
@Pankraz76 Pankraz76 changed the title Issue #16421: introduce InlineVariableCheck - Local variables should not be declared and then immediately returned or thrown - (RSPEC-S1488) Issue #16421: S1488: Local variables should not be declared and then immediately returned or thrown Apr 13, 2025
@Pankraz76 Pankraz76 closed this Apr 14, 2025
@Pankraz76
Copy link
Copy Markdown
Author

WIP

@Pankraz76 Pankraz76 reopened this May 19, 2025
@Pankraz76 Pankraz76 changed the title Issue #16421: S1488: Local variables should not be declared and then immediately returned or thrown Issue #16421: Local variables should not be declared and then immediately returned or thrown S1488 May 19, 2025
@Pankraz76 Pankraz76 force-pushed the InlineVariableCheck-pr branch 3 times, most recently from c26d836 to c969698 Compare May 20, 2025 11:01
@Pankraz76 Pankraz76 force-pushed the InlineVariableCheck-pr branch 2 times, most recently from 870df94 to e096e2a Compare May 20, 2025 11:13
@Pankraz76 Pankraz76 force-pushed the InlineVariableCheck-pr branch from e096e2a to 48c26f1 Compare May 20, 2025 11:28
@romani
Copy link
Copy Markdown
Member

romani commented May 20, 2025

you operating in danger zone.
Issue is not approved, so has a chance to never be merged.
I highly recommend you to create your own project and write as much has Checks as you need in such project, no limitation, you drive design, users will just use extra jar to use your Checks.

examples on such projects: https://checkstyle.sourceforge.io/#Additional_Checks

@Pankraz76
Copy link
Copy Markdown
Author

consider you dont want contribution and clean code, as its working therefore found several violations.

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