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

Add lll linter #354

Merged
merged 2 commits into from
Jul 4, 2024
Merged

Add lll linter #354

merged 2 commits into from
Jul 4, 2024

Conversation

geoff-vball
Copy link
Contributor

Why this should be merged

Closes #352

How this works

Enables the lll linter and conforms (almost) all line lengths to 120 characters.

There are some lines where I couldn't come up with a good was to get the line under 120 characters, so used nolint:lll. If you have suggestions for any of these lines, please give them :)

database/utils.go Outdated Show resolved Hide resolved
Co-authored-by: Ian Suvak <[email protected]>
Signed-off-by: Geoff Stuart <[email protected]>
@geoff-vball geoff-vball requested a review from iansuvak July 3, 2024 17:53
Copy link
Contributor

@iansuvak iansuvak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but my approval doesn't count for anything until I am added to CODEOWNERS.
FWIW I do think that //nolint:lll where you included them make sense and are the cleanest way to move forward.

Copy link
Collaborator

@cam-schultz cam-schultz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Left some food for thought on how we might tackle the lines that require the nolint tag.

@@ -76,6 +77,7 @@ func (mc *MessageCoordinator) getAppRelayerMessageHandler(
}

// Fetch the message delivery data
//nolint:lll
sourceBlockchainID, originSenderAddress, destinationBlockchainID, destinationAddress, err := messageHandler.GetMessageRoutingInfo()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but these are the exact fields that compose a RelayerID. It might make sense to directly return that struct instead of the individual fields.

@@ -16,15 +16,15 @@ import (
// Specifies the height from which to start processing historical blocks.
type SourceBlockchain struct {
SubnetID string `mapstructure:"subnet-id" json:"subnet-id"`
BlockchainID string `mapstructure:"blockchain-id" json:"blockchain-id"`
BlockchainID string `mapstructure:"blockchain-id" json:"blockchain-id"` //nolint:lll
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but we should look into if we still need both mpastructure and json tags. IIRC, the json tag is only used in tests.

@@ -104,18 +104,25 @@ func (s *SourceBlockchain) Validate(destinationBlockchainIDs *set.Set[string]) e
return fmt.Errorf("invalid blockchainID in configuration. error: %w", err)
}
if !destinationBlockchainIDs.Contains(dest.BlockchainID) {
return fmt.Errorf("configured source subnet %s has a supported destination blockchain ID %s that is not configured as a destination blockchain",
return fmt.Errorf(
"configured source subnet %s has a supported destination blockchain ID %s that is not configured as a destination blockchain", //nolint:lll
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, the only other way to preserve these long strings is through concatenation, where we'd put each section on its own line. Not the cleanest, so I think the nolint tag is appropriate in these instances.

@geoff-vball geoff-vball merged commit 67f83b8 into main Jul 4, 2024
7 checks passed
@geoff-vball geoff-vball deleted the gstuart/lll branch July 4, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Enable line length linter
3 participants