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

[apex] New rule for empty statements #3778

Open
oowekyala opened this issue Feb 12, 2022 · 0 comments
Open

[apex] New rule for empty statements #3778

oowekyala opened this issue Feb 12, 2022 · 0 comments
Labels
a:new-rule Proposal to add a new built-in rule

Comments

@oowekyala
Copy link
Member

Proposed Rule Name: EmptyStatement, probably

Proposed Category: Best Practices

Description: Would flag empty blocks and statements like if or else that have an empty body.

See #3164 (comment)

Thanks for the report. There's an identical ticket for the java rules (#3096). Like in the java module, I think we should just make a single rule that flags empty blocks and statements, and remove EmptyIfStmt and the others, which would be covered by this single rule. Relevant rules: EmptyCatchBlock, EmptyIfStmt, EmptyStatementBlock, EmptyTryOrFinallyBlock, EmptyWhileStmt

See #3641 (review):

What we should do instead is the following (as outlined in the comment on #3164):

  1. Create a new rule combines all the Empty* rules that are already existing.
  2. Deprecate all the Empty* rules in favor of the new rule
  3. Use the new rule in quickstart.xml instead of the now deprecated rules
  4. In PMD7 delete all the deprecated Empty* rules

Related issues:

Code Sample: See tests of existing rules

Possible Properties: None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:new-rule Proposal to add a new built-in rule
Projects
None yet
Development

No branches or pull requests

1 participant