-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
refactor: use optional chaining for improved readability and maintained functionality #1280
Conversation
|
By Mistake I stage this file I am really sorry for that
I used code formatter inside my local setup that why this confusion was created
Provide a detailed explanation in the file comment and remove unnecessary changes made by my code formatter.
apps/generator/cli.js
Outdated
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.
Get back this file pls.
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.
Remove unwanted comments from this file
get: () => { | ||
// Using ?. to check if parameters and the key exist | ||
// This is shorter and does the same thing as the old if statements | ||
if (this.templateConfig.parameters?.[key] == null) { |
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.
Here there's one condition also exists !self.templateConfig.parameters
pls. add that also in validation.
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.
Please check PR description where I mention the issue that I solved in this PR sonarcloud highlight the issue that Prefer using an optional chain expression instead, as it's more concise and easier to read. that's what I did if i implement one more codition !self.templateConfig.parameters
then this PR makes no sense here I hope you understand
This change makes the code more concise and easier to read while maintaining the same functionality. It checks if either the parameters object doesn't exist or if the specific key is not defined within it.
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.
please remove any changes to cli.js
and any formatting changes you added to your PR
remove any unnecessary changes
Quality Gate passedIssues Measures |
I removed all kind of changes in the |
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.
cli.js
is still showing up in the list of modified files
Pls. have a look on the comment #1283 (comment) to fix this |
Description
In this PR I worked on this issue link
I already added a test file where I captured all the tests that I performed test-results.txt
This change addresses suggestions from SonarCloud to adopt modern JavaScript features.
Related issue(s)