cli icon indicating copy to clipboard operation
cli copied to clipboard

fix: fixed all sonar cloud issue

Open lightning-sagar opened this issue 1 month ago • 6 comments

Description

This PR addresses all SonarCloud-reported issues. Changes include:

  • [x] updates: Made public static fields readonly in src/apps/cli/commands/config/auth/add.ts #1883

  • [x] Node built-in module imports: Use 'node:' prefix for built-in modules

  • [x] Nullish coalescing operator: Replace if-assignment with ??=

  • [x] wildcardToRegex improvements: Use String#replaceAll() and String.raw

  • [x] GitHub URL handling and HTTP resolver:

    • Use RegExp.exec() instead of String.match() in convertGitHubWebUrl
    • Remove unnecessary try/catch from isValidGitHubBlobUrl
    • Refactor read function in HTTP resolver to reduce cognitive complexity from 16 to 15

Related issue(s) This Issue is related to #1881

lightning-sagar avatar Oct 27 '25 17:10 lightning-sagar

🦋 Changeset detected

Latest commit: 0713671cecd4d828dd0d7b7aea4f180e6dc91c83

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Oct 27 '25 17:10 changeset-bot[bot]

Changeset has been generated for this PR as part of auto-changeset workflow.

Please review the changeset before merging the PR.
---
'@asyncapi/cli': patch
---

fix: fixed all sonar cloud issue

- aa5ccef: fix(config):
- use 'node:' prefix for built-in modules
- replace if-assignment with nullish coalescing (??=)
- use String#replaceAll and String.raw in wildcardToRegex
- eb7394e: refactor: improve GitHub URL handling and simplify HTTP resolver

Use RegExp.exec() instead of String.match() in convertGitHubWebUrl

Remove unnecessary try/catch from isValidGitHubBlobUrl

Refactor read function in HTTP resolver to reduce cognitive complexity from 16 to 15
- 35b917d: Refactor URL conversion to use RegExp.exec() instead of match()
- 05be198: chore: updated the validation.service.ts
- 2bd1f07: fix: address Sonar S7780 by replacing manual escaping with String.raw
- b9cf80a: chore: pull the changes
- ba5f736: replaceAll rule in wildcardToRegex function
- c3b7224: fix(config): replace unsafe regex literal with safe escapePattern to satisfy Sonar rule S7780
- 538dea1: replaceAll rule in wildcardToRegex function

chore: add changeset for PR #1884

fix(config): replace unsafe regex literal with safe escapePattern to satisfy Sonar rule S7780
- 0fe8c37: fix(config): replace unsafe regex literal with safe escapePattern to satisfy Sonar rule S7780
- b5ee095: chore: pulling from master

If you are a maintainer or the author of the PR, you can change the changeset by clicking here

[!TIP] If you don't want auto-changeset to run on this PR, you can add the label skip-changeset to the PR or remove the changeset and change PR title to something other than fix: or feat:.

github-actions[bot] avatar Oct 27 '25 17:10 github-actions[bot]

Hey, @AayushSaini101 when you have some time, please check the PR. Thanks!

lightning-sagar avatar Nov 02 '25 00:11 lightning-sagar

Hey @Shurtu-gal , @AayushSaini101 just wanted to follow up on this PR.... I opened it earlier for fixing all the SonarCloud reported issues, and it looks like a newer PR (#1887) overlaps with the same fixes.... could you guys please take a quick look at this one when you get a chance? thanks!

lightning-sagar avatar Nov 09 '25 07:11 lightning-sagar

Ready for review now... Apologies for the multiple commits, had to resolve a few Sonar issues along the way.. Thanks!

lightning-sagar avatar Nov 13 '25 14:11 lightning-sagar