Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(JS-0302) Default parameters should be placed after non-default ones #53

Closed
dev-737 opened this issue Mar 12, 2024 · 0 comments · Fixed by #55
Closed

(JS-0302) Default parameters should be placed after non-default ones #53

dev-737 opened this issue Mar 12, 2024 · 0 comments · Fixed by #55

Comments

@dev-737
Copy link
Member

dev-737 commented Mar 12, 2024

Description

Placing default parameters before non-default ones waste its benefits since they must be provided to get to the non-default parameters.

Occurrences

There is 1 occurrence of this issue in the repository.

See all occurrences on DeepSource → app.deepsource.com/gh/Discord-InterChat/InterChat/issue/JS-0302/occurrences/

dev-737 added a commit that referenced this issue Mar 17, 2024
#55)

Fixes #53 

---

<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>

> ## TL;DR
> This pull request swaps the order of the `guildId` and `roleId` parameters in the `modifyUserRole` function in `Utils.ts`.
> 
> ## What changed
> In the `modifyUserRole` function, the `guildId` parameter was previously set to default to `SUPPORT_SERVER_ID` if no value was provided. This parameter was placed before the `roleId` parameter. This order has been swapped in this pull request, so now `roleId` comes before `guildId`.
> 
> ```diff
> -  guildId: Snowflake = SUPPORT_SERVER_ID,
>    roleId: Snowflake,
> +  guildId: Snowflake = SUPPORT_SERVER_ID,
> ```
> 
> ## How to test
> To test this change, call the `modifyUserRole` function with various combinations of parameters. Ensure that the function behaves as expected when `guildId` is not provided, and that it correctly uses the provided `roleId`.
> 
> ## Why make this change
> This change improves the readability and usability of the `modifyUserRole` function. By placing the `roleId` parameter before the `guildId` parameter, it is clearer that `roleId` is a required parameter, while `guildId` is optional and will default to `SUPPORT_SERVER_ID` if not provided. This makes the function easier to use and understand.
</details>
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 a pull request may close this issue.

1 participant