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

Simplify Code AccountResource #12922

Merged
merged 1 commit into from
Nov 21, 2020
Merged

Simplify Code AccountResource #12922

merged 1 commit into from
Nov 21, 2020

Conversation

MarlonLuan
Copy link
Contributor


Boolean method 'checkPasswordLength' is always inverted
Inspection info: Reports methods with a boolean return type, which are only used in a negated context

Please make sure the below checklist is followed for Pull Requests.

When you are still working on the PR, consider converting it to Draft (bellow reviewers) and adding skip-ci label, you can still see CI build result at your branch.

throw new InvalidPasswordException();
}
<%_ if (!reactive) { _%>
Optional<<%= asEntity('User') %>> user =
userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey());

if (!user.isPresent()) {
if (user.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We're still supporting Java8, so we can't use this newer API

@@ -377,7 +377,7 @@ public class AccountResource {
*/
@PostMapping(path = "/account/change-password")
public <% if (reactive) { %>Mono<Void><% } else { %>void<% } %> changePassword(@RequestBody PasswordChangeDTO passwordChangeDto) {
if (!checkPasswordLength(passwordChangeDto.getNewPassword())) {
if (checkPasswordLength(passwordChangeDto.getNewPassword())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not convinced that inverting the meaning of checkPasswordLength is an improvement.
Or propose a new meaningful name for this method as e.g. isPasswordLengthInvalid

@gmarziou
Copy link
Contributor

Please consider squashing your commits and git force pushing.

Copy link
Member

@DanielFran DanielFran left a comment

Choose a reason for hiding this comment

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

LGTM

@DanielFran DanielFran merged commit 7a87b0b into jhipster:main Nov 21, 2020
@pascalgrimaud pascalgrimaud added this to the 7.0.0-beta.0 milestone Dec 18, 2020
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.

None yet

5 participants