Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Adjust applyPermissions logic #10919 #10928
Adjust applyPermissions logic #10919 #10928
Changes from 2 commits
bf197fd
47fda55
66b4df9
ef1b8a0
538cde4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 88 in modules/core/core-repo/src/main/java/com/enonic/xp/repo/impl/node/ApplyNodePermissionsCommand.java
modules/core/core-repo/src/main/java/com/enonic/xp/repo/impl/node/ApplyNodePermissionsCommand.java#L88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue identified by the PMD linter is that the nested
if
statements can be combined into a single conditional expression. This improves the readability of the code by reducing the number of nested blocks and making the logic clearer.Here’s the original line:
The suggestion is to combine the conditions into a single line without changing the logic.
Here’s the code suggestion:
This line is already optimal, but if you want to avoid the nested
if
statement altogether, you could simplify it by using a singleif
statement with a method reference or a lambda if appropriate. However, since the request is for a single line change, the original line is already concise and correct.If you want to directly address the suggestion made by PMD, you could refactor the code to avoid nesting entirely. Here’s a more concise way to express the same logic:
This single line change removes the nested structure by directly invoking
doApplyOnChildren
if both conditions are met.This comment was generated by an experimental AI tool.