Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] Make naming conventions rule skip unnamed variables #5004

Merged
merged 10 commits into from May 23, 2024

Conversation

oowekyala
Copy link
Member

@oowekyala oowekyala commented May 11, 2024

Describe the PR

I think the best solution here is not to allow _ through the regexes as suggested in #4954 but rather to always ignore these variables. That's because I don't think the rule should ever be used to disallow unnamed variables. We would otherwise be restricting a useful language feature, and anyone changing the convention would need to explicitly takes care of special casing this identifier.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@oowekyala oowekyala added this to the 7.2.0 milestone May 11, 2024
@pmd-test
Copy link

pmd-test commented May 11, 2024

1 Message
📖 No regression tested rules have been changed.
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 7 violations, 0 errors and 0 configuration errors.
Download full report as build artifact
Compared to master:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 7 violations, 0 errors and 0 configuration errors.
Download full report as build artifact

Generated by 🚫 Danger

@jsotuyod
Copy link
Member

We should probably add a parsing test for pre-Java9 to ensure that @Name = "_" but @Unnamed = false.

Apart from that this looks great to merge, thanks!

@adangel
Copy link
Member

adangel commented May 23, 2024

We should probably add a parsing test for pre-Java9 to ensure that @Name = "_" but @Unnamed = false.

I'll add a test for that and merge it afterwards.

@adangel adangel self-assigned this May 23, 2024
@adangel adangel merged commit a4edb67 into pmd:master May 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants