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

Code suggestion #8

Merged
merged 1 commit into from
Jul 18, 2024
Merged

Code suggestion #8

merged 1 commit into from
Jul 18, 2024

Conversation

notJoon
Copy link
Contributor

@notJoon notJoon commented Jul 18, 2024

Description

Added a feature that suggests code modifications when it's possible to analyze the AST.

This feature demonstrates how the code could be improved. Additionally, I've included separate notes to explain how the code has changed and the resoning behind these decisions.

Example

error: unnecessary-else
 --> main.gno
   |
 6 |         if x {
 7 |                return 1
 8 |         } else {
 9 |                return 2
10 |         }
   | ~~~~~~~~~~
   | unnecessary else block

Suggestion:
 6 | if x {
 7 |    return 1
 8 | }
 9 | return 2

Note: Unnecessary 'else' block removed.
The code inside the 'else' block has been moved outside, as it will only be executed when the 'if' condition is false.

@notJoon notJoon added enhancement New feature or request T-format Type: related with formatter labels Jul 18, 2024
@notJoon notJoon merged commit 96b6b5d into main Jul 18, 2024
1 check passed
@notJoon notJoon deleted the suggestion branch July 18, 2024 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request T-format Type: related with formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant