rollmint
rollmint copied to clipboard
[Code Improvement]: Add stylecheck to golangci-lint
Implementation ideas
stylecheck is the replacement for golint.
This is a good linter for maintaining a consistent coding style across the repo. I don't think it is catching any bugs at present but could lead to bugs due to varying code standards.
here are some errors that it catches in the rollkit repo at present
rollkit % make lint
--> Running golangci-lint
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [runner/nolint] Found unknown linters in //nolint directives:
log/logger.go:1:1: ST1000: at least one file in a package should have a package comment (stylecheck)
package log
^
da/da.go:1:1: ST1000: at least one file in a package should have a package comment (stylecheck)
package da
^
conv/abci/block.go:1:1: ST1000: at least one file in a package should have a package comment (stylecheck)
package abci
^
node/full_client.go:68:22: ST1016: methods on the same type should have the same receiver name (seen 1x "rpc", 35x "c") (stylecheck)
func (c *FullClient) ABCIInfo(ctx context.Context) (*ctypes.ResultABCIInfo, error) {
^
types/serialization.go:80:24: ST1016: methods on the same type should have the same receiver name (seen 3x "sH", 5x "h") (stylecheck)
func (h *SignedHeader) FromProto(other *pb.SignedHeader) error {
^
node/block_exchange.go:27:1: ST1021: comment on exported type BlockExchangeService should be of the form "BlockExchangeService ..." (with optional leading article) (stylecheck)
// P2P Exchange Service for block that implements the go-header interface.
^
node/exchange.go:7:1: ST1021: comment on exported type SyncerStatus should be of the form "SyncerStatus ..." (with optional leading article) (stylecheck)
// Used by header and block exchange service for keeping track of
^
node/header_exchange.go:27:1: ST1021: comment on exported type HeaderExchangeService should be of the form "HeaderExchangeService ..." (with optional leading article) (stylecheck)
// P2P Exchange Service for header that implements the go-header interface.
^
block/manager.go:641:10: ST1005: error strings should not be capitalized (stylecheck)
return fmt.Errorf("Failed to submit block to DA layer after %d attempts", maxSubmitAttempts)
^
libs/shares/share_builder.go:25:1: ST1020: comment on exported function NewBuilder should be of the form "NewBuilder ..." (stylecheck)
// Init() needs to be called right after this method
^
libs/shares/share_builder.go:156:1: ST1020: comment on exported method WriteSequenceLen should be of the form "WriteSequenceLen ..." (stylecheck)
// writeSequenceLen writes the sequence length to the first share.
^
node/block_exchange.go:113:1: ST1020: comment on exported method Start should be of the form "Start ..." (stylecheck)
// OnStart is a part of Service interface.
^
node/block_exchange.go:189:1: ST1020: comment on exported method Stop should be of the form "Stop ..." (stylecheck)
// OnStop is a part of Service interface.
^
node/header_exchange.go:113:1: ST1020: comment on exported method Start should be of the form "Start ..." (stylecheck)
// OnStart is a part of Service interface.
^
node/header_exchange.go:187:1: ST1020: comment on exported method Stop should be of the form "Stop ..." (stylecheck)
// OnStop is a part of Service interface.
^
types/test_utils.go:11:1: ST1020: comment on exported function GetRandomValidatorSet should be of the form "GetRandomValidatorSet ..." (stylecheck)
// TODO: accept argument for number of validators / proposer index
^
make: *** [lint] Error 1