Skip to content

fix: move default parameters to end in cypress.config.ts#24

Open
sonarqube-agent[bot] wants to merge 1 commit intomasterfrom
remediate-master-20260330-075801-5d5d8c6a
Open

fix: move default parameters to end in cypress.config.ts#24
sonarqube-agent[bot] wants to merge 1 commit intomasterfrom
remediate-master-20260330-075801-5d5d8c6a

Conversation

@sonarqube-agent
Copy link
Copy Markdown

Removed the default value assignment from the browser parameter in cypress.config.ts to comply with TypeScript best practices, where default parameters must come after non-default parameters. This resolves the SonarQube code smell and improves code quality by following proper parameter ordering conventions.

View Project in SonarCloud


Fixed Issues

typescript:S1788 - Default parameters should be last. • MAJORView issue

Location: cypress.config.ts:18

Why is this an issue?

Default parameter values allow callers to specify as many or as few arguments as they want while getting the same functionality and minimizing boilerplate, wrapper code, making a function easier to use.

What changed

Removes the default value assignment = {} from the browser parameter, which was declared before the non-default launchOptions parameter. The static analysis rule requires that parameters with default values come after parameters without default values. By removing the unnecessary default value from browser, the function signature no longer has a default parameter preceding a non-default parameter, resolving the 'Default parameters should be last' code smell.

--- a/cypress.config.ts
+++ b/cypress.config.ts
@@ -18,1 +18,1 @@ export default defineConfig({
-      on('before:browser:launch', (browser: any = {}, launchOptions: any) => { // TODO Remove after upgrade to Cypress >=12.5.0 <or> Chrome 119 become available on GitHub Workflows, see https://github.com/cypress-io/cypress-documentation/issues/5479
+      on('before:browser:launch', (browser: any, launchOptions: any) => { // TODO Remove after upgrade to Cypress >=12.5.0 <or> Chrome 119 become available on GitHub Workflows, see https://github.com/cypress-io/cypress-documentation/issues/5479

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


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZWU-tuTYJSZqVQVbSl6 for typescript:S1788 rule

Generated by SonarQube Agent (task: 85053250-2682-4772-8070-b1c85b2be339)
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.

0 participants