Skip to content

Remove redundant await calls on synchronous globArray() results#5

Open
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260615-010120-855ba184
Open

Remove redundant await calls on synchronous globArray() results#5
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260615-010120-855ba184

Conversation

@sonarqube-agent

Copy link
Copy Markdown

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

Why these issues? Selected for their CRITICAL severity and well-defined rule (S4123: unexpected await of non-Promise) with a clear mechanical fix pattern. These five issues in docsFinder.ts share the same rule and root cause, enabling a focused, coherent remediation with high automation success likelihood.

This change fixes 5 critical SonarQube issues (S4123) in docsFinder.ts where await was incorrectly applied to synchronous globArray() calls. Removing these redundant awaits improves code correctness by ensuring non-Promise values are not treated as Thenable objects.

View Project in SonarCloud


Fixed Issues

typescript:S4123 - Unexpected `await` of a non-Promise (non-"Thenable") value. • CRITICALView issue

Location: packages/ansible-language-server/src/utils/docsFinder.ts:26

Why is this an issue?

Promises are objects that represent the eventual completion or failure of an asynchronous operation. They provide a way to handle asynchronous operations in a more organized and manageable manner. To use await, you need to ensure that you are calling a function or an expression that returns a promise.

What changed

Removes the redundant await on the globArray() call at line 26, which returns a non-Promise (synchronous) value. The static analyzer flagged this as awaiting a non-Thenable value, so removing await fixes the warning.

--- a/packages/ansible-language-server/src/utils/docsFinder.ts
+++ b/packages/ansible-language-server/src/utils/docsFinder.ts
@@ -26,1 +26,1 @@ export async function findDocumentation(
-      files = await globArray([`${dir}/**/*.py`, "!/**/_*.py"]);
+      files = globArray([`${dir}/**/*.py`, "!/**/_*.py"]);
typescript:S4123 - Unexpected `await` of a non-Promise (non-"Thenable") value. • CRITICALView issue

Location: packages/ansible-language-server/src/utils/docsFinder.ts:29

Why is this an issue?

Promises are objects that represent the eventual completion or failure of an asynchronous operation. They provide a way to handle asynchronous operations in a more organized and manageable manner. To use await, you need to ensure that you are calling a function or an expression that returns a promise.

What changed

Removes the redundant await on the globArray() call at line 29, which returns a non-Promise (synchronous) value. The static analyzer flagged this as awaiting a non-Thenable value, so removing await fixes the warning.

--- a/packages/ansible-language-server/src/utils/docsFinder.ts
+++ b/packages/ansible-language-server/src/utils/docsFinder.ts
@@ -29,1 +29,1 @@ export async function findDocumentation(
-      files = await globArray([
+      files = globArray([
typescript:S4123 - Unexpected `await` of a non-Promise (non-"Thenable") value. • CRITICALView issue

Location: packages/ansible-language-server/src/utils/docsFinder.ts:43

Why is this an issue?

Promises are objects that represent the eventual completion or failure of an asynchronous operation. They provide a way to handle asynchronous operations in a more organized and manageable manner. To use await, you need to ensure that you are calling a function or an expression that returns a promise.

What changed

Removes the redundant await on the globArray() call at line 43, which returns a non-Promise (synchronous) value. The static analyzer flagged this as awaiting a non-Thenable value, so removing await fixes the warning.

--- a/packages/ansible-language-server/src/utils/docsFinder.ts
+++ b/packages/ansible-language-server/src/utils/docsFinder.ts
@@ -43,1 +43,1 @@ export async function findDocumentation(
-      files = await globArray([
+      files = globArray([
typescript:S4123 - Unexpected `await` of a non-Promise (non-"Thenable") value. • CRITICALView issue

Location: packages/ansible-language-server/src/utils/docsFinder.ts:97

Why is this an issue?

Promises are objects that represent the eventual completion or failure of an asynchronous operation. They provide a way to handle asynchronous operations in a more organized and manageable manner. To use await, you need to ensure that you are calling a function or an expression that returns a promise.

What changed

Removes the redundant await on the globArray() call at line 97, which returns a non-Promise (synchronous) value. The static analyzer flagged this as awaiting a non-Thenable value, so removing await fixes the warning.

--- a/packages/ansible-language-server/src/utils/docsFinder.ts
+++ b/packages/ansible-language-server/src/utils/docsFinder.ts
@@ -97,1 +97,1 @@ export async function findPluginRouting(
-      files = await globArray([`${dir}/config/ansible_builtin_runtime.yml`]);
+      files = globArray([`${dir}/config/ansible_builtin_runtime.yml`]);
typescript:S4123 - Unexpected `await` of a non-Promise (non-"Thenable") value. • CRITICALView issue

Location: packages/ansible-language-server/src/utils/docsFinder.ts:100

Why is this an issue?

Promises are objects that represent the eventual completion or failure of an asynchronous operation. They provide a way to handle asynchronous operations in a more organized and manageable manner. To use await, you need to ensure that you are calling a function or an expression that returns a promise.

What changed

Removes the redundant await on the globArray() call at line 100, which returns a non-Promise (synchronous) value. The static analyzer flagged this as awaiting a non-Thenable value, so removing await fixes the warning.

--- a/packages/ansible-language-server/src/utils/docsFinder.ts
+++ b/packages/ansible-language-server/src/utils/docsFinder.ts
@@ -100,1 +100,1 @@ export async function findPluginRouting(
-      files = await globArray([
+      files = globArray([

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


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZpDOYbfFgknPiesr7Ge for typescript:S4123 rule
- AZpDOYbfFgknPiesr7Gf for typescript:S4123 rule
- AZpDOYbfFgknPiesr7Ga for typescript:S4123 rule
- AZpDOYbfFgknPiesr7Gb for typescript:S4123 rule
- AZpDOYbfFgknPiesr7Gc for typescript:S4123 rule

Generated by SonarQube Agent (task: 1aeac710-66a8-4eef-8396-952ef61ee0af)
@sonarqubecloud

Copy link
Copy Markdown

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