Repository navigation
Remove unnecessary async keywords from synchronous functions - #105
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AaFjqWz1BLlkJm3CXfBi for typescript:S7503 rule - AaFjqWzOBLlkJm3CXfBd for typescript:S7503 rule - AaFjqWzqBLlkJm3CXfBf for typescript:S7503 rule - AaFjqWz5BLlkJm3CXfBk for typescript:S7503 rule Generated by SonarQube Agent (task: eb351f49-af2c-409f-832f-fa0f6257facf)
|
|
Code Review 👍 Approved with suggestions 0 closed / 1 findings🟡 Medium risk · Removing async changes exported run functions from Promise-returning to synchronous, so callers may observe thrown errors immediately instead of rejected promises. Removes unnecessary 💡 Quality: Only symlink-keeper rebuilt; 3 other ncc dist bundles are stale📄 symlink-keeper/dist/main/index.js:2 📄 src/cache-metrics-main.ts:11 📄 src/cache-metrics-post.ts:9 📄 src/credential-guard-main.ts:3 CLAUDE.md says the tracked The symlink-keeper bundle diff also looks hand-edited rather than produced by ncc: it swaps the webpack bootstrap's tab indentation for spaces (+44/-44 lines). The next real build will churn that file again. There is no runtime impact today, because each Regenerate every affected bundle with ncc and commit the output instead of editing dist files by hand.🤖 Prompt for agentsVerification Rules 2/2 metFunctional validation No results Rules 2 passed 1 not applicable
Auto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
| @@ -1,5 +1,5 @@ | |||
| /******/ (() => { // webpackBootstrap | |||
| /******/ var __webpack_modules__ = ({ | |||
| /******/ var __webpack_modules__ = ({ | |||
There was a problem hiding this comment.
💡 Quality: Only symlink-keeper rebuilt; 3 other ncc dist bundles are stale
CLAUDE.md says the tracked <sub-action>/dist/**/index.js bundles must be rebuilt whenever anything under src/ changes, because a skipped rebuild ships stale code to users. This PR edits four sources but updates only symlink-keeper/dist/main/index.js. cache-metrics/dist/main/index.js:31070, cache-metrics/dist/post/index.js:31070 and credential-guard/dist/main/index.js:31069 still contain async function run(), so the actions that actually run are unchanged and no longer match src/.
The symlink-keeper bundle diff also looks hand-edited rather than produced by ncc: it swaps the webpack bootstrap's tab indentation for spaces (+44/-44 lines). The next real build will churn that file again.
There is no runtime impact today, because each run() catches its own errors. Fix: run npm run build (or build:metrics-main, build:metrics-post, build:guard-main and build:keeper-main) and commit the regenerated bundles.
Regenerate every affected bundle with ncc and commit the output instead of editing dist files by hand.:
npm run build:metrics-main && npm run build:metrics-post && npm run build:guard-main && npm run build:keeper-main
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎



Fixed four instances of SonarQube rule S7503 by removing the
asynckeyword from functions that never await anything and changing their return type fromPromise<void>tovoid. This eliminates misleading async markers and unnecessary microtask overhead while making the code's synchronous nature explicit.View Project in SonarCloud
Fixed Issues
typescript:S7503 - Async function 'run' has no 'await' expression. • MINOR • View issue
Location:
src/symlink-keeper-main.ts:3Why is this an issue?
Declaring a function
asyncsignals that it suspends onawaitorfor await, so other work can proceed while an operation such as I/O completes.What changed
The scanner flagged 'run' because it is declared async but never awaits anything. This hunk drops the 'async' keyword from 'run' in the compiled bundle, matching the same fix in src/symlink-keeper-main.ts. The function now runs synchronously instead of wrapping its result in a Promise for no reason.
typescript:S7503 - Async function 'run' has no 'await' expression. • MINOR • View issue
Location:
src/cache-metrics-main.ts:11Why is this an issue?
Declaring a function
asyncsignals that it suspends onawaitorfor await, so other work can proceed while an operation such as I/O completes.What changed
The scanner flagged
runbecause it was declaredasyncbut its body never awaits anything. That means the keyword only wrapped a synchronous result in a Promise. This hunk removes theasynckeyword and changes the return type fromPromise<void>tovoid. The signature now matches what the function actually does: it runs synchronously, without the misleading async marker or the extra microtask overhead.typescript:S7503 - Async function 'run' has no 'await' expression. • MINOR • View issue
Location:
src/cache-metrics-post.ts:9Why is this an issue?
Declaring a function
asyncsignals that it suspends onawaitorfor await, so other work can proceed while an operation such as I/O completes.What changed
The scanner flagged
runas an async function whose body never awaits anything, so theasynckeyword only wrapped a synchronous result in a Promise. This hunk removesasyncand changes the return type fromPromise<void>tovoid. The function now honestly reflects its synchronous behavior and avoids the extra microtask. Callers no longer need to await it, though awaiting a void value would still work.typescript:S7503 - Async function 'run' has no 'await' expression. • MINOR • View issue
Location:
src/credential-guard-main.ts:3Why is this an issue?
Declaring a function
asyncsignals that it suspends onawaitorfor await, so other work can proceed while an operation such as I/O completes.What changed
The
runfunction was declaredasyncbut never awaited anything, so the keyword only wrapped a synchronous result in a Promise and misled readers. The hunk removesasyncand changes the return type fromPromise<void>tovoid. The signature now matches the function's purely synchronous behavior, which resolves the 'async function has no await expression' warning.SonarQube Remediation Agent uses AI. Check for mistakes.