Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: enable linter confusing-naming (#2223)
Yilong Li46e3d8e3dd35
diff --git a/.golangci.yaml b/.golangci.yamlindex 8221b90c76..acacc94df9 100644--- a/.golangci.yaml+++ b/.golangci.yaml@@ -71,8 +71,6 @@ linters-settings:# TODO(dragonly): Remove the rules below in the following PRs.- name: empty-blockdisabled: true- - name: confusing-naming- disabled: true- name: deferdisabled: truegocritic:diff --git a/bin/bb/cmd/root_test.go b/bin/bb/cmd/root_test.goindex ad4d9a80d0..fc9c67c358 100644--- a/bin/bb/cmd/root_test.go+++ b/bin/bb/cmd/root_test.go@@ -20,7 +20,7 @@ const (PortTestCreateDatabase)-func execute(t *testing.T, cmd *cobra.Command, args ...string) (string, error) {+func executeCommand(t *testing.T, cmd *cobra.Command, args ...string) (string, error) {t.Helper()var buf bytes.Buffer@@ -42,7 +42,7 @@ func tableTest(t *testing.T, tables []testTable) {log.SetLevel(zap.DebugLevel)t.Helper()for _, tc := range tables {- actual, err := execute(t, NewRootCmd(), tc.args...)+ actual, err := executeCommand(t, NewRootCmd(), tc.args...)if err != tc.expectedErr {t.Errorf(`"> bb %v"diff --git a/plugin/vcs/github/github.go b/plugin/vcs/github/github.goindex cbbc2a295f..e5bad04594 100644--- a/plugin/vcs/github/github.go+++ b/plugin/vcs/github/github.go@@ -198,9 +198,9 @@ type WebhookPushEvent struct {Commits []WebhookCommit `json:"commits"`}-// fetchUserInfo fetches user information from the given resourceURI, which+// fetchUserInfoImpl fetches user information from the given resourceURI, which// should be either "user" or "users/{username}".-func (p *Provider) fetchUserInfo(ctx context.Context, oauthCtx common.OauthContext, instanceURL, resourceURI string) (*vcs.UserInfo, error) {+func (p *Provider) fetchUserInfoImpl(ctx context.Context, oauthCtx common.OauthContext, instanceURL, resourceURI string) (*vcs.UserInfo, error) {url := fmt.Sprintf("%s/%s", p.APIURL(instanceURL), resourceURI)code, body, err := oauth.Get(ctx,@@ -240,7 +240,7 @@ func (p *Provider) fetchUserInfo(ctx context.Context, oauthCtx common.OauthConte// TryLogin tries to fetch the user info from the current OAuth context.func (p *Provider) TryLogin(ctx context.Context, oauthCtx common.OauthContext, instanceURL string) (*vcs.UserInfo, error) {- return p.fetchUserInfo(ctx, oauthCtx, instanceURL, "user")+ return p.fetchUserInfoImpl(ctx, oauthCtx, instanceURL, "user")}// CommitAuthor represents a GitHub API response for a commit author.@@ -307,7 +307,7 @@ func (p *Provider) FetchCommitByID(ctx context.Context, oauthCtx common.OauthCon// FetchUserInfo fetches user info of given user ID.func (p *Provider) FetchUserInfo(ctx context.Context, oauthCtx common.OauthContext, instanceURL, username string) (*vcs.UserInfo, error) {- return p.fetchUserInfo(ctx, oauthCtx, instanceURL, fmt.Sprintf("users/%s", username))+ return p.fetchUserInfoImpl(ctx, oauthCtx, instanceURL, fmt.Sprintf("users/%s", username))}func getRoleAndMappedRole(roleName string) (githubRole RepositoryRole, bytebaseRole common.ProjectRole) {diff --git a/plugin/vcs/gitlab/gitlab.go b/plugin/vcs/gitlab/gitlab.goindex 8cbfe0f808..3972f4160c 100644--- a/plugin/vcs/gitlab/gitlab.go+++ b/plugin/vcs/gitlab/gitlab.go@@ -336,9 +336,9 @@ func (p *Provider) fetchPaginatedRepositoryList(ctx context.Context, oauthCtx coreturn repos, len(repos) >= apiPageSize, nil}-// fetchUserInfo fetches user information from the given resourceURI, which+// fetchUserInfoImpl fetches user information from the given resourceURI, which// should be either "user" or "users/{userID}".-func (p *Provider) fetchUserInfo(ctx context.Context, oauthCtx common.OauthContext, instanceURL, resourceURI string) (*vcs.UserInfo, error) {+func (p *Provider) fetchUserInfoImpl(ctx context.Context, oauthCtx common.OauthContext, instanceURL, resourceURI string) (*vcs.UserInfo, error) {url := fmt.Sprintf("%s/%s", p.APIURL(instanceURL), resourceURI)code, body, err := oauth.Get(ctx,@@ -378,7 +378,7 @@ func (p *Provider) fetchUserInfo(ctx context.Context, oauthCtx common.OauthConte// TryLogin tries to fetch the user info from the current OAuth context.func (p *Provider) TryLogin(ctx context.Context, oauthCtx common.OauthContext, instanceURL string) (*vcs.UserInfo, error) {- return p.fetchUserInfo(ctx, oauthCtx, instanceURL, "user")+ return p.fetchUserInfoImpl(ctx, oauthCtx, instanceURL, "user")}// FetchCommitByID fetches the commit data by its ID from the repository.@@ -426,7 +426,7 @@ func (p *Provider) FetchCommitByID(ctx context.Context, oauthCtx common.OauthCon// FetchUserInfo fetches user info of given user ID.func (p *Provider) FetchUserInfo(ctx context.Context, oauthCtx common.OauthContext, instanceURL, userID string) (*vcs.UserInfo, error) {- return p.fetchUserInfo(ctx, oauthCtx, instanceURL, fmt.Sprintf("users/%s", userID))+ return p.fetchUserInfoImpl(ctx, oauthCtx, instanceURL, fmt.Sprintf("users/%s", userID))}func getRoleAndMappedRole(accessLevel int32) (gitLabRole ProjectRole, bytebaseRole common.ProjectRole) {diff --git a/resources/mysqlutil/mysqlutil.go b/resources/mysqlutil/mysqlutil.goindex 465a8abfcf..c907a79f7d 100644--- a/resources/mysqlutil/mysqlutil.go+++ b/resources/mysqlutil/mysqlutil.go@@ -94,7 +94,7 @@ func Install(resourceDir string) error {return fmt.Errorf("failed to check binary directory path %q, error: %w", mysqlutilDir, err)}// Install if not exist yet- if err := install(resourceDir, mysqlutilDir, tarName, version); err != nil {+ if err := installImpl(resourceDir, mysqlutilDir, tarName, version); err != nil {return fmt.Errorf("cannot install mysqlutil, error: %w", err)}}@@ -121,7 +121,7 @@ func Install(resourceDir string) error {return fmt.Errorf("failed to remove the old version mysqlutil binary directory %q, error: %w", mysqlutilDir, err)}// Install the current version- if err := install(resourceDir, mysqlutilDir, tarName, version); err != nil {+ if err := installImpl(resourceDir, mysqlutilDir, tarName, version); err != nil {return fmt.Errorf("cannot install mysqlutil, error: %w", err)}break@@ -131,8 +131,8 @@ func Install(resourceDir string) error {return nil}-// install installs mysqlutil in resourceDir.-func install(resourceDir, mysqlutilDir, tarName, version string) error {+// installImpl installs mysqlutil in resourceDir.+func installImpl(resourceDir, mysqlutilDir, tarName, version string) error {tmpDir := path.Join(resourceDir, fmt.Sprintf("tmp-%s", version))if err := os.RemoveAll(tmpDir); err != nil {return fmt.Errorf("failed to remove mysqlutil binaries temp directory %q, error: %w", tmpDir, err)diff --git a/store/repository.go b/store/repository.goindex 56bf0b2b56..f0117ffa15 100644--- a/store/repository.go+++ b/store/repository.go@@ -144,7 +144,7 @@ func (s *Store) DeleteRepository(ctx context.Context, delete *api.RepositoryDele}defer tx.PTx.Rollback()- if err := s.deleteRepository(ctx, tx.PTx, delete); err != nil {+ if err := s.deleteRepositoryImpl(ctx, tx.PTx, delete); err != nil {return FormatError(err)}@@ -608,8 +608,8 @@ func patchRepositoryImpl(ctx context.Context, tx *sql.Tx, patch *api.RepositoryPreturn &repository, nil}-// deleteRepository permanently deletes a repository by ID.-func (s *Store) deleteRepository(ctx context.Context, tx *sql.Tx, delete *api.RepositoryDelete) error {+// deleteRepositoryImpl permanently deletes a repository by ID.+func (s *Store) deleteRepositoryImpl(ctx context.Context, tx *sql.Tx, delete *api.RepositoryDelete) error {// Updates the project workflow_type to "UI"workflowType := api.UIWorkflowprojectPatch := api.ProjectPatch{