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

feat: goimports-reviser script #282

Closed
wants to merge 2 commits into from
Closed

feat: goimports-reviser script #282

wants to merge 2 commits into from

Conversation

h5law
Copy link
Contributor

@h5law h5law commented Dec 17, 2023

Summary

Human Summary

Add bash script to add goimports-reviser import grouping excluding files where scaffolding comments are in the import area. This may need to be improved upon in fututre but its a start at least.

I also include all the changes it makes.

AI Summary

Summary generated by Reviewpad on 17 Dec 23 01:52 UTC

This pull request includes the following changes:

  1. The file relay.go:
  • The import statement for "crypto/sha256" has been updated to be imported within parentheses.
  • The function getSignableBytes has not been modified.
  1. The file pkg/relayer/session/errors.go:
  • A new import block has been added that includes the package cosmossdk.io/errors.
  • The variable codespace now has the value "relayer_session".
  1. The file require.go in the testutil/testerrors package:
  • The package errorsmod from the import statement cosmossdk.io/errors has been imported.
  • The import statements have been slightly modified to use parentheses for multiple imports.
  1. The file template.go in the testutil/testkeyring/gen_accounts package:
  • An import statement for text/template was added.
  • The import statements are now surrounded by parentheses.
  • The variable preGeneratedAccountLineFmt was not modified.
  1. The file errors.go:
  • The import statement for the package cosmossdk.io/errors has been modified to be imported in a separate block using parentheses.
  • The changes have been made in the config, pkg/sdk, appgateserver, pkg/appgateserver/config, pkg/client/keyring/errors.go, x/supplier/types/key_proof.go, pkg/client/tx, x/supplier/client/config, pkg/client/keyring/errors.go, pkg/client/tx, urls.go, and pkg/signer packages.
  1. The file yaml.go:
  • The import statement for the "strings" package has been updated to use parentheses for multiple imports.
  • The code comment has been modified to provide additional explanation about the YAML format and the need for proper indentation.
  1. The file x/supplier/token_supplier.go:
  • Added imports for encoding/binary.
  • Updated import formatting to use parentheses for multiple imports.
  1. The file errors.go in the pkg/sdk package:
  • An import statement has been added for the package cosmossdk.io/errors.
  • The import statement has been formatted to use parentheses for multiple imports.
  1. The file key_supplier.go:
  • Added import for encoding/binary.
  • Updated import formatting to use parentheses for multiple imports.
  1. The file errors.go:
  • Import statement for sdkerrors "cosmossdk.io/errors" has been modified to be imported in a separate block using parentheses.
  • The changes have been made in the config and pkg/appgateserver/config packages.
  1. The file pkg/observable/interface.go:
  • Importing the context package and adding parentheses to the import statement.
  1. The file errors.go in the pkg/client/keyring package:
  • Import statement for the package cosmossdk.io/errors has been modified to be a multiline import statement.
  • The variable ErrEmptySigningKeyName has not been changed.
  1. The file errors.go in the x/supplier package:
  • Import statement for the package cosmossdk.io/errors has been modified to be a multiline import statement.
  1. The file x/supplier/keeper/supplier_keeper.go:
  • Importing the package context and adding parentheses to the import statement.
  1. The file template.go in the exported package:
  • The import "text/template" has been modified to use multi-line import syntax.
  • A new import statement for the text/template package has been added.
  • The variable relayFixtureLineFmt has not been modified.
  1. The file errors.go:
  • The changes include importing the "cosmossdk.io/errors" package and adding parentheses for multiple imports.
  • Additionally, a new error variable "ErrObserverClosed" is defined using the imported package.
  1. The file pkg/client/keyring/errors.go:
  • Import statement for the package cosmossdk.io/errors has been modified to be a multiline import statement.
  • The variable ErrEmptySigningKeyName has not been changed.
  1. The file errors.go in the appgateserver package:
  • An import statement has been updated to import the sdkerrors package from the cosmossdk.io/errors module.
  • The import has been formatted using parentheses and each import is now placed on a new line.
  1. The file x/supplier/types/key_proof.go:
  • Added import block for encoding/binary package.
  1. The file errors.go:
  • Changes in the import section, importing the package cosmossdk.io/errors with updated formatting using parentheses.
  1. The file errors.go in the pkg/appgateserver/config package:
  • Imported the sdkerrors package from cosmossdk.io/errors.
  • Reformatted the import using parentheses.
  • The content of the codespace variable remains the same.
  1. The file errors.go in the x/supplier/client/config package:
  • Imported the package cosmossdk.io/errors using the single import statement format.
  • Updated the import section to use parentheses for multiple imports.
  1. The file urls.go in the sdk package:
  • An import statement for the package fmt has been added.
  1. The file simple_signer.go in the pkg/signer package:
  • Imported package github.com/cosmos/cosmos-sdk/crypto/keyring has been moved inside a separate import block.
  • No other changes have been made to the file.
  1. The file context.go in the polylog package:
  • The import statement for context has been changed to be imported within parentheses.
  • The CtxKey constant has been defined as the key used to store the polylog.Logger in a context.Context.
  1. The file restore-scaffold-lines.sh:
  • This file introduces a new bash script named "goimports-revisor.sh" that will be used to run the "goimports-reviser" tool.
  • The script defines an array of flags to be passed to the tool and a function named "process_file" to check for exclusion comments and run the tool on the file.
  • The script then uses the "find" command to search for ".go" files, excluding certain patterns and filenames, and executes the "process_file" function on each file.
  1. The file key_gateway.go:
  • The diff of the file includes adding an import for encoding/binary.
  • Updated import formatting to use parentheses for multiple imports.

Please review these changes and ensure that they align with the intended functionality of the files.

Issue

In part (#270 (comment))

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Run all unit tests: make go_develop_and_test
  • Run E2E tests locally: make test_e2e
  • Run E2E tests on DevNet: Add the devnet-test-e2e label to the PR. This is VERY expensive, only do it after all the reviews are complete.

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have performed a self-review of my own code
  • I have commented my code, updated documentation and left TODOs throughout the codebase

@h5law h5law added the code health Cleans up some code label Dec 17, 2023
@h5law h5law added this to the Shannon TestNet milestone Dec 17, 2023
@h5law h5law requested review from Olshansk and okdas December 17, 2023 01:20
@h5law h5law self-assigned this Dec 17, 2023
@h5law h5law closed this Dec 17, 2023
@h5law h5law deleted the feat/go-imports-reviser branch December 17, 2023 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Cleans up some code
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

1 participant