Skip to content

Fix SonarCloud code smells - #1822

Merged
firecow merged 1 commit into
masterfrom
fix/sonarcloud-code-smells
Apr 3, 2026
Merged

Fix SonarCloud code smells#1822
firecow merged 1 commit into
masterfrom
fix/sonarcloud-code-smells

Conversation

@firecow

@firecow firecow commented Apr 3, 2026

Copy link
Copy Markdown
Owner
  • Replace String#replace with String#replaceAll where appropriate
  • Use node: prefixed imports (node:crypto, node:path)
  • Use globalThis instead of global
  • Use Number.parseInt/Number.isFinite instead of globals
  • Extract nested ternary into if/else
  • Fix Promise.allSettled receiving non-Promise values
  • Use .find() instead of .filter()[0]
  • Use for-of instead of indexed for loop
  • Throw Error object instead of string literal
  • Various minor cleanups (readonly, new Array(), String.raw, etc.)

Summary by cubic

Cleaned up SonarCloud code smells and fixed a few small bugs across the CLI. Safer APIs and better quoting make jobs more reliable.

  • Bug Fixes

    • Avoid passing non-Promise values to Promise.allSettled during wait-for-it cleanup.
    • Safer numeric parsing in argv using Number.isFinite.
    • Fix single-quote escaping in docker env variables and services (correct shell quoting).
    • Throw proper Error objects (with cause) for registry port timeouts.
  • Refactors

    • Prefer node: core imports (node:crypto, node:path) and globalThis.
    • Use replaceAll where appropriate; simplify loops and lookups (for-of, .find, new Array()).
    • Minor cleanups: readonly static, remove unnecessary spreads, clearer conditionals.

Written for commit 62df9af. Summary will update on new commits.

- Replace String#replace with String#replaceAll where appropriate
- Use node: prefixed imports (node:crypto, node:path)
- Use globalThis instead of global
- Use Number.parseInt, Number.isFinite instead of globals
- Extract nested ternary into if/else in job.ts
- Remove unnecessary spread in object literal
- Fix Promise.allSettled receiving non-Promise values
- Use .find() instead of .filter()[0]
- Use for-of instead of indexed for loop
- Use new Array() instead of Array()
- Make static property readonly
- Throw Error object instead of string literal
- Combine multiple Array#push calls
- Compare with undefined directly instead of typeof
- Use String.raw for backslash escaping
- Flip negated ternary conditions
@firecow firecow self-assigned this Apr 3, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 10 files

@sonarqubecloud

sonarqubecloud Bot commented Apr 3, 2026

Copy link
Copy Markdown

@firecow
firecow merged commit 67976a9 into master Apr 3, 2026
16 checks passed
@firecow
firecow deleted the fix/sonarcloud-code-smells branch April 3, 2026 09:22
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Apr 7, 2026
This MR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [npm:gitlab-ci-local](https://github.com/firecow/gitlab-ci-local) | `4.70.0` → `4.70.1` | ![age](https://developer.mend.io/api/mc/badges/age/npm/gitlab-ci-local/4.70.1?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/gitlab-ci-local/4.70.1?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/gitlab-ci-local/4.70.0/4.70.1?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/gitlab-ci-local/4.70.0/4.70.1?slim=true) |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>firecow/gitlab-ci-local (npm:gitlab-ci-local)</summary>

### [`v4.70.1`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.70.1)

[Compare Source](firecow/gitlab-ci-local@4.70.0...4.70.1)

#### What's Changed

- fix: GCL\_ array env vars not splitting semicolon-separated values by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1778](firecow/gitlab-ci-local#1778)
- fix: strip ports and digests from service aliases by [@&#8203;bidord](https://github.com/bidord) in [#&#8203;1820](firecow/gitlab-ci-local#1820)
- fix: SonarCloud code smells by [@&#8203;firecow](https://github.com/firecow) in [#&#8203;1822](firecow/gitlab-ci-local#1822)
- chore(deps): update github/codeql-action action to v4.34.0 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1807](firecow/gitlab-ci-local#1807)
- chore(deps): update github/codeql-action action to v4.35.1 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1808](firecow/gitlab-ci-local#1808)
- chore(deps): lock file maintenance by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1811](firecow/gitlab-ci-local#1811)
- build(deps): bump path-to-regexp from 0.1.12 to 0.1.13 in /examples/docker-compose-nodejs by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;1816](firecow/gitlab-ci-local#1816)
- chore(deps): update sonarsource/sonarqube-scan-action action to v7.1.0 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1818](firecow/gitlab-ci-local#1818)
- chore(deps): update dependency typescript to v6 by [@&#8203;renovate](https://github.com/renovate)\[bot] in [#&#8203;1812](firecow/gitlab-ci-local#1812)

#### New Contributors

- [@&#8203;bidord](https://github.com/bidord) made their first contribution in [#&#8203;1820](firecow/gitlab-ci-local#1820)

**Full Changelog**: <firecow/gitlab-ci-local@4.70.0...4.70.1>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDQuOCIsInVwZGF0ZWRJblZlciI6IjQzLjEwNC44IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
kevingerman pushed a commit to kevingerman/gitlab-ci-local that referenced this pull request Apr 10, 2026
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