Skip to content

Conversation

@Kartikayy007
Copy link

This PR resolves multiple SonarCloud code quality issues reported in #1881.

Fixes

src/apps/cli/commands/config/auth/add.ts

  • Make description property readonly
  • Make args property readonly
  • Make flags property readonly

src/domains/services/config.service.ts

  • Use node:path instead of path
  • Use node:os instead of os
  • Use node:fs instead of fs
  • Use nullish coalescing operator ??=
  • Replace String.replace() with String.replaceAll()
  • Use String.raw for escape sequences

src/domains/services/validation.service.ts

  • Add error logging to catch block
  • Use RegExp.exec() instead of String.match()
  • Reduce cognitive complexity from 16 to 5
    • Extracted fetchWithErrorHandling helper
    • Extracted handleGitHubApiUrl helper
    • Extracted handleRawGitHubUrl helper
    • Extracted handleRegularUrl helper

Testing

  • Build passes: npm run build
  • Lint passes: npm run lint (3 warnings, under limit of 5)
  • Validation service tests passing

Fixes #1881

@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2025

🦋 Changeset detected

Latest commit: 6acadf5

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

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

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: resolve SonarCloud issues in config and validation services

- 656f398: fix: resolve SonarCloud issues in config and validation services

Fixes #1881

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:.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 3, 2025

@Kartikayy007
Copy link
Author

hey, @Shurtu-gal ill love to contribute more are there some more issues you could provide me to work upon?

@Shurtu-gal
Copy link
Collaborator

You can take a look at #1839

@Kartikayy007
Copy link
Author

@Shurtu-gal please take a look here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

Fix Sonar Cloud issues in the CLI Project

2 participants