-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add lll linter #354
Conversation
Co-authored-by: Ian Suvak <ian.suvak@avalabs.org> Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
There was a problem hiding this 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.
There was a problem hiding this 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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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 :)