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

feat: Emit function formatter #39

Merged
merged 2 commits into from
Jul 31, 2024
Merged

feat: Emit function formatter #39

merged 2 commits into from
Jul 31, 2024

Conversation

notJoon
Copy link
Contributor

@notJoon notJoon commented Jul 31, 2024

Description

Implemented the formatter for the std.Emit funcrtion.

Ensure that key-value pairs are only on the one line at a time when there are more than 3 parameters.

Example

Problematic code:

package main

import "std"

func main() {
    std.Emit(
		"OwnershipChange",
		"newOwner", newOwner.String(),
		"oldOwner", 
		oldOwner.String(),
		"anotherOwner", anotherOwner.String(),
	)
}

linting result:

error: emit-format
 --> testdata/emit0.gno
 6 |     std.Emit(
 7 |                "OwnershipChange",
 8 |                "newOwner", newOwner.String(),
 9 |                "oldOwner", 
10 |                oldOwner.String(),
11 |                "anotherOwner", anotherOwner.String(),
12 |         )
   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   | Consider formatting std.Emit call for better readability

Suggestion:
 6 | std.Emit(
 7 |     "OwnershipChange",
 8 |     "newOwner", newOwner.String(),
 9 |     "oldOwner", oldOwner.String(),
10 |     "anotherOwner", anotherOwner.String(),
11 | )

@notJoon notJoon added the A-lint Adding or updating lint label Jul 31, 2024
@notJoon notJoon merged commit c344189 into main Jul 31, 2024
3 checks passed
@notJoon notJoon deleted the emit-format branch July 31, 2024 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Adding or updating lint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant