From 1c10b128ebbd304f0ed45d5b894dc3f851abac3f Mon Sep 17 00:00:00 2001 From: Pantani Date: Wed, 18 Oct 2023 14:47:45 +0200 Subject: [PATCH] rollback lint version and improve app module comments --- .github/workflows/test-lint.yml | 2 +- .../x/{{moduleName}}/module/genesis.go.plush | 2 +- .../x/{{moduleName}}/module/module.go.plush | 31 ++++++++++++------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml index 0f060b40b2..9da1c01b40 100644 --- a/.github/workflows/test-lint.yml +++ b/.github/workflows/test-lint.yml @@ -35,7 +35,7 @@ jobs: - uses: golangci/golangci-lint-action@v3 if: env.GIT_DIFF with: - version: v1.52.1 + version: v1.54.2 install-mode: goinstall args: --timeout 10m github-token: ${{ secrets.github_token }} diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis.go.plush index 20a021e4e0..ed35249792 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/genesis.go.plush @@ -13,7 +13,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) k.SetParams(ctx, genState.Params) } -// ExportGenesis returns the module's exported genesis +// ExportGenesis returns the module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush index 592d5b03ff..42a97558b8 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush @@ -47,7 +47,8 @@ var ( // AppModuleBasic // ---------------------------------------------------------------------------- -// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module needs to implement. +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. type AppModuleBasic struct { cdc codec.BinaryCodec } @@ -56,25 +57,27 @@ func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { return AppModuleBasic{cdc: cdc} } -// Name returns the name of the module as a string +// Name returns the name of the module as a string. func (AppModuleBasic) Name() string { return types.ModuleName } -// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} -// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } -// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { @@ -83,14 +86,16 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod return genState.Validate() } -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { panic(err) } } -// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module +// GetTxCmd returns the root Tx command for the module. The subcommands of +// this root command are used by end-users to generate new transactions +// containing messages defined in the module. func (a AppModuleBasic) GetTxCmd() *cobra.Command { return cli.GetTxCmd() } @@ -151,15 +156,19 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw return cdc.MustMarshalJSON(genState) } -// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. func (AppModule) ConsensusVersion() uint64 { return 1 } -// BeginBlock contains the logic that is automatically triggered at the beginning of each block +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. func (am AppModule) BeginBlock(_ context.Context) error { return nil } -// EndBlock contains the logic that is automatically triggered at the end of each block +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. func (am AppModule) EndBlock(_ context.Context) error { return nil }