Skip to content

qlty smells refactoring: High complexity count (src/user/profile.js) changePassword#334

Open
zheng05jess wants to merge 1 commit into
mainfrom
jzheng5/task-1-context
Open

qlty smells refactoring: High complexity count (src/user/profile.js) changePassword#334
zheng05jess wants to merge 1 commit into
mainfrom
jzheng5/task-1-context

Conversation

@zheng05jess

Copy link
Copy Markdown

Added changes to src/user/profile.js file in the changePassword function.

Used AI to edit to:
if (isSelf && hasPassword) {
const correct = await User.isPasswordCorrect(data.uid, data.currentPassword, data.ip);
if (!correct || data.currentPassword === data.newPassword) {
throw new Error(!correct
? '[[user:change-password-error-wrong-current]]'
: '[[user:change-password-error-same-password]]');
}
}

Takeaways:

  • Increased complexity count instead of reducing it
  • When putting through Copilot, no changes were made.

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.

1 participant