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

refactor: fix lint issues + gofumpt #15062

Merged
merged 15 commits into from
Feb 19, 2023
Merged

refactor: fix lint issues + gofumpt #15062

merged 15 commits into from
Feb 19, 2023

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented Feb 17, 2023

Description

I'm so sorry for the big diff. It's mostly replacing the old errors with the new cosmossdk.io/errors + some other linter fixes.

Closes: #XXXX


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)

x/feegrant/module/module.go Fixed Show resolved Hide resolved
@github-actions github-actions bot added C:Hubl Tool: Hubl C:Keys Keybase, KMS and HSMs C:orm C:x/genutil genutil module issues labels Feb 17, 2023
@github-actions github-actions bot removed the C:Hubl Tool: Hubl label Feb 17, 2023
@github-actions github-actions bot added C:Confix Issues and PR related to Confix C:Hubl Tool: Hubl C:x/circuit C:x/tx labels Feb 17, 2023
@@ -44,7 +44,7 @@

func (c *ChainInfo) getCacheDir() (string, error) {
cacheDir := path.Join(c.ConfigDir, "cache")
return cacheDir, os.MkdirAll(cacheDir, 0755)
return cacheDir, os.MkdirAll(cacheDir, 0o755)

Check failure

Code scanning / gosec

Expect directory permissions to be 0750 or less

Expect directory permissions to be 0750 or less
@@ -49,12 +49,12 @@
return err
}

if err := os.MkdirAll(configDir, 0755); err != nil {
if err := os.MkdirAll(configDir, 0o755); err != nil {

Check failure

Code scanning / gosec

Expect directory permissions to be 0750 or less

Expect directory permissions to be 0750 or less
@@ -133,7 +133,7 @@
return err
}

err = os.WriteFile(appOptsFilename, bz, 0644)
err = os.WriteFile(appOptsFilename, bz, 0o644)

Check failure

Code scanning / gosec

Expect WriteFile permissions to be 0600 or less

Expect WriteFile permissions to be 0600 or less
@@ -92,7 +92,7 @@
return err
}

if err = os.WriteFile(fdsFilename, bz, 0644); err != nil {
if err = os.WriteFile(fdsFilename, bz, 0o644); err != nil {

Check failure

Code scanning / gosec

Expect WriteFile permissions to be 0600 or less

Expect WriteFile permissions to be 0600 or less
return err
}

configPath := configFilename(configDir)
if err := os.WriteFile(configPath, buf.Bytes(), 0644); err != nil {
if err := os.WriteFile(configPath, buf.Bytes(), 0o644); err != nil {

Check failure

Code scanning / gosec

Expect WriteFile permissions to be 0600 or less

Expect WriteFile permissions to be 0600 or less
@julienrbrt julienrbrt linked an issue Feb 17, 2023 that may be closed by this pull request
@facundomedica facundomedica marked this pull request as ready for review February 17, 2023 18:27
@facundomedica facundomedica requested a review from a team as a code owner February 17, 2023 18:27
errors/stacktrace.go Outdated Show resolved Hide resolved
@@ -37,135 +37,135 @@ const RootCodespace = "sdk"

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we remove the aliases from above?
They've been deprecated since v0.46.

Copy link
Member Author

Choose a reason for hiding this comment

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

There was a build failing because x/upgrade was using this one iirc. Should we keep them until we tag new versions of everything and then remove it?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah makes sense

@@ -5,8 +5,7 @@ import (
"compress/zlib"
"io"

"cosmossdk.io/errors"

errorsmod "cosmossdk.io/errors"
Copy link
Member

Choose a reason for hiding this comment

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

is this linting error? we should try to leave these unchanged

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah ok I was doing those for consistency

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought I was following a pattern, but it was the wrong pattern lol. So I'm changing any import that doesn't have a conflicting import name to be just cosmossdk.io/errors. I was confused because I've seen many places in which the old error package was imported as "sdkerrors" even when there wasn't another package with the same name

store/tracekv/store.go Outdated Show resolved Hide resolved
@facundomedica facundomedica changed the title refactor: fix lint issues refactor: fix lint issues + gofumpt Feb 18, 2023
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm!

@julienrbrt julienrbrt enabled auto-merge (squash) February 19, 2023 10:07
@github-actions github-actions bot added the C:Cosmovisor Issues and PR related to Cosmovisor label Feb 19, 2023
@julienrbrt julienrbrt merged commit 4a6a1e3 into main Feb 19, 2023
@julienrbrt julienrbrt deleted the facu/fix-lint branch February 19, 2023 10:31
@julienrbrt julienrbrt mentioned this pull request Feb 19, 2023
19 tasks
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix linting issues
4 participants