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

style: update golangci config and fix lint errors #1384

Merged
merged 19 commits into from
Aug 22, 2022
Merged

Conversation

ryanchristo
Copy link
Member

@ryanchristo ryanchristo commented Aug 20, 2022

Description

This pull request updates the lint configuration and fixes lint errors and warnings. This pull request also updates workflows to ensure each module is checked if changes are made within the given module and skips checks if no changes are made.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@@ -1,4 +1,4 @@
package grpc_gateway
package grpcgateway
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

Comment on lines +10 to +11
// ToAPI converts to pulsar based data structure
func (d *DateCriteria) ToAPI() *api.DateCriteria {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

Comment on lines +476 to +477
// QueryProjectsByReferenceIDCmd returns command that retrieves list of projects by reference id with pagination.
func QueryProjectsByReferenceIDCmd() *cobra.Command {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

@@ -23,7 +23,7 @@ import (
const (
FlagAddIssuers string = "add-issuers"
FlagRemoveIssuers string = "remove-issuers"
FlagReferenceId string = "reference-id"
FlagReferenceID string = "reference-id"
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

@@ -8,7 +8,7 @@ import (
"github.com/regen-network/regen-ledger/x/ecocredit"
)

const MaxReferenceIdLength = 32
const MaxReferenceIDLength = 32
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

Comment on lines +36 to +37
RegexClassID = `[A-Z]{1,3}[0-9]{2,}`
RegexProjectID = fmt.Sprintf(`%s-[A-Z0-9]{2,}`, RegexClassID)
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

@@ -58,24 +56,24 @@ var (
// least three digits
//
// e.g. C01
func FormatClassId(creditTypeAbbreviation string, classSeqNo uint64) string {
func FormatClassID(creditTypeAbbreviation string, classSeqNo uint64) string {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

// <project-sequence> is the sequence number of the project, padded to at least
// three digits
//
// e.g. C01-001
func FormatProjectId(classId string, projectSeqNo uint64) string {
return fmt.Sprintf("%s-%03d", classId, projectSeqNo)
func FormatProjectID(classID string, projectSeqNo uint64) string {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

if classId == "" {
// ValidateClassID validates a class ID conforms to the format described in
// FormatClassID. The return is nil if the ID is valid.
func ValidateClassID(classID string) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

if projectId == "" {
// ValidateProjectID validates a project ID conforms to the format described
// in FormatProjectID. The return is nil if the ID is valid.
func ValidateProjectID(projectID string) error {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

// GetClassIdFromProjectId returns the credit class ID in a project ID.
func GetClassIdFromProjectId(projectId string) string {
// GetClassIDFromProjectID returns the credit class ID in a project ID.
func GetClassIDFromProjectID(projectID string) string {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

// GetClassIdFromBatchDenom returns the credit class ID in a batch denom.
func GetClassIdFromBatchDenom(denom string) string {
// GetClassIDFromBatchDenom returns the credit class ID in a batch denom.
func GetClassIDFromBatchDenom(denom string) string {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

// GetProjectIdFromBatchDenom returns the credit project ID in a batch denom.
func GetProjectIdFromBatchDenom(denom string) string {
// GetProjectIDFromBatchDenom returns the credit project ID in a batch denom.
func GetProjectIDFromBatchDenom(denom string) string {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

// GetCreditTypeAbbrevFromClassId returns the credit type abbreviation in a credit class id
func GetCreditTypeAbbrevFromClassId(classId string) string {
// GetCreditTypeAbbrevFromClassID returns the credit type abbreviation in a credit class id
func GetCreditTypeAbbrevFromClassID(classID string) string {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

Comment on lines +36 to +37
// SupplyInvariant cross check the balance of baskets and bank
func SupplyInvariant(ctx sdk.Context, store api.BasketTable, bank bankSupplyStore, basketBalances map[uint64]math.Dec) (string, bool) {
Copy link
Member Author

Choose a reason for hiding this comment

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

breaking change

@ryanchristo ryanchristo marked this pull request as ready for review August 22, 2022 19:18
@ryanchristo ryanchristo requested a review from a team August 22, 2022 19:18
Copy link
Contributor

@technicallyty technicallyty left a comment

Choose a reason for hiding this comment

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

LGTM

@ryanchristo ryanchristo merged commit 256e45e into main Aug 22, 2022
@ryanchristo ryanchristo deleted the ryan/golangci-lint branch August 22, 2022 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants