Skip to content

Remove unnecessary async keywords from synchronous functions - #105

Open
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20261025-060314-5e949d5c
Open

sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20261025-060314-5e949d5c

Conversation

@sonarqube-agent

Copy link
Copy Markdown

This PR was automatically created by the Remediation Agent's Scheduled backlog remediation feature.

Why these issues? All four issues are instances of the same SonarQube rule (typescript:S7503) flagging async functions without await expressions, forming a coherent and actionable group. This single-rule focus ensures consistency and clarity in the fix across multiple files.

Fixed four instances of SonarQube rule S7503 by removing the async keyword from functions that never await anything and changing their return type from Promise<void> to void. 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:3

Why is this an issue?

Declaring a function async signals that it suspends on await or for 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.

--- a/symlink-keeper/dist/main/index.js
+++ b/symlink-keeper/dist/main/index.js
@@ -31069,1 +31069,1 @@ const core = __importStar(__nccwpck_require__(7484));
-async function run() {
+function run() {
typescript:S7503 - Async function 'run' has no 'await' expression. • MINOR • View issue

Location: src/cache-metrics-main.ts:11

Why is this an issue?

Declaring a function async signals that it suspends on await or for await, so other work can proceed while an operation such as I/O completes.

What changed

The scanner flagged run because it was declared async but its body never awaits anything. That means the keyword only wrapped a synchronous result in a Promise. This hunk removes the async keyword and changes the return type from Promise<void> to void. The signature now matches what the function actually does: it runs synchronously, without the misleading async marker or the extra microtask overhead.

--- a/src/cache-metrics-main.ts
+++ b/src/cache-metrics-main.ts
@@ -11,1 +11,1 @@ import {
-export async function run(): Promise<void> {
+export function run(): void {
typescript:S7503 - Async function 'run' has no 'await' expression. • MINOR • View issue

Location: src/cache-metrics-post.ts:9

Why is this an issue?

Declaring a function async signals that it suspends on await or for await, so other work can proceed while an operation such as I/O completes.

What changed

The scanner flagged run as an async function whose body never awaits anything, so the async keyword only wrapped a synchronous result in a Promise. This hunk removes async and changes the return type from Promise<void> to void. 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.

--- a/src/cache-metrics-post.ts
+++ b/src/cache-metrics-post.ts
@@ -9,1 +9,1 @@ import {
-export async function run(): Promise<void> {
+export function run(): void {
typescript:S7503 - Async function 'run' has no 'await' expression. • MINOR • View issue

Location: src/credential-guard-main.ts:3

Why is this an issue?

Declaring a function async signals that it suspends on await or for await, so other work can proceed while an operation such as I/O completes.

What changed

The run function was declared async but never awaited anything, so the keyword only wrapped a synchronous result in a Promise and misled readers. The hunk removes async and changes the return type from Promise<void> to void. The signature now matches the function's purely synchronous behavior, which resolves the 'async function has no await expression' warning.

--- a/src/credential-guard-main.ts
+++ b/src/credential-guard-main.ts
@@ -3,1 +3,1 @@ import * as core from '@actions/core';
-export async function run(): Promise<void> {
+export function run(): void {

Have a suggestion or found an issue? Share your feedback here.


SonarQube Remediation Agent uses AI. Check for mistakes.

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)
@sonarqubecloud

Copy link
Copy Markdown

@sonarqube-cloud-us

Copy link
Copy Markdown

@gitar-bot

gitar-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
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 async keywords and changes return types to void for run() in four entry points across symlink-keeper, cache-metrics, and credential-guard. Approved with suggestions: only the symlink-keeper dist/main/index.js bundle was regenerated, while the cache-metrics main and post bundles and the credential-guard bundle still contain async function run() and no longer match src/. Rebuilding with npm run build and committing the regenerated bundles is recommended. The symlink-keeper bundle diff also appears hand-edited (indentation changes), which a real build would overwrite.

💡 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 <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
🤖 Prompt for agents
Code Review: Removes unnecessary `async` keywords and changes return types to `void` for `run()` in four entry points across symlink-keeper, cache-metrics, and credential-guard. Approved with suggestions: only the symlink-keeper `dist/main/index.js` bundle was regenerated, while the cache-metrics main and post bundles and the credential-guard bundle still contain `async function run()` and no longer match `src/`. Rebuilding with `npm run build` and committing the regenerated bundles is recommended. The symlink-keeper bundle diff also appears hand-edited (indentation changes), which a real build would overwrite.

1. 💡 Quality: Only symlink-keeper rebuilt; 3 other ncc dist bundles are stale
   Files: 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 `<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.

   Fix (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

Verification Rules 2/2 met

Functional validation No results

Rules 2 passed 1 not applicable

✅ Internal artifact registries
✅ Repository license compliance

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@@ -1,5 +1,5 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/******/ var __webpack_modules__ = ({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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 👍 / 👎

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant