Skip to content

Commit dede31d

Browse files
authored
refactor: enable linter rule ST1016 for 'consistent method receiver names' (#86)
refactor: enable linter ST1016 'Use consistent method receiver names'
1 parent 53f1124 commit dede31d

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ linters:
4040
- '-QF1004' # disable rule 'Use strings.ReplaceAll instead of strings.Replace'
4141
- '-QF1008' # disable rule 'Omit embedded fields from selector'
4242
- '-QF1011' # disable rule 'Omit redundant type from variable declaration'
43-
- '-ST1016' # disable rule 'Use consistent method receiver names'
4443
# https://golangci-lint.run/usage/linters/#staticcheck
4544
# https://staticcheck.dev/docs/configuration/options/#initialisms
4645
initialisms:

internal/iostreams/iostreams_mock.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ func (m *IOStreamsMock) IsTTY() bool {
9898
}
9999

100100
// SetExitCode sets the desired exit code in a thread-safe way
101-
func (io *IOStreamsMock) SetExitCode(code ExitCode) {
102-
atomic.StoreInt32((*int32)(&io.exitCode), int32(code))
101+
func (m *IOStreamsMock) SetExitCode(code ExitCode) {
102+
atomic.StoreInt32((*int32)(&m.exitCode), int32(code))
103103
}
104104

105105
// GetExitCode returns the most-recently set desired exit code in a thread safe way
106-
func (io *IOStreamsMock) GetExitCode() ExitCode {
107-
return ExitCode(atomic.LoadInt32((*int32)(&io.exitCode)))
106+
func (m *IOStreamsMock) GetExitCode() ExitCode {
107+
return ExitCode(atomic.LoadInt32((*int32)(&m.exitCode)))
108108
}
109109

110110
// InitLogFile mocks starting the debug info to

internal/prompts/app_select.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,20 @@ func (apps *TeamApps) IsEmpty() bool {
129129
// Basically, treat as a convenience getter intended for use in the context where
130130
// you have a team you want to filter against and you don't care whether it's an
131131
// auth or an app that corresponds. E.g. when you are comparing to --team flags
132-
func (t *TeamApps) authOrAppTeamDomain() string {
133-
if t.Auth.TeamDomain != "" && (t.Auth.TeamID == t.Hosted.App.TeamID || t.Auth.TeamID == t.Local.App.TeamID) {
132+
func (apps *TeamApps) authOrAppTeamDomain() string {
133+
if apps.Auth.TeamDomain != "" && (apps.Auth.TeamID == apps.Hosted.App.TeamID || apps.Auth.TeamID == apps.Local.App.TeamID) {
134134
// Auth whose team id matches either hosted or local app's team
135135
// Can be safely returned
136-
return t.Auth.TeamDomain
136+
return apps.Auth.TeamDomain
137137
}
138138

139139
// If we get here we might be missing an auth OR the auth doesn't
140140
// match any included app team ids (that is the case when the auth is org
141141
// resolved for a workspace app)
142-
if t.Hosted.App.TeamID != "" {
143-
return t.Hosted.App.TeamDomain
142+
if apps.Hosted.App.TeamID != "" {
143+
return apps.Hosted.App.TeamDomain
144144
}
145-
return t.Local.App.TeamDomain
145+
return apps.Local.App.TeamDomain
146146
}
147147

148148
// authOrAppTeamID greedily returns a team ID corresponding to the TeamApps
@@ -157,14 +157,14 @@ func (t *TeamApps) authOrAppTeamDomain() string {
157157
// Basically, treat as a convenience getter intended for use in the context where
158158
// you have a team you want to filter against and you don't care whether it's an
159159
// auth or an app that corresponds. E.g. when you are comparing to --team flags
160-
func (t *TeamApps) authOrAppTeamID() string {
161-
if t.Auth.TeamID != "" && (t.Hosted.App.TeamID == t.Auth.TeamID || t.Local.App.TeamID == t.Auth.TeamID) {
162-
return t.Auth.TeamID
160+
func (apps *TeamApps) authOrAppTeamID() string {
161+
if apps.Auth.TeamID != "" && (apps.Hosted.App.TeamID == apps.Auth.TeamID || apps.Local.App.TeamID == apps.Auth.TeamID) {
162+
return apps.Auth.TeamID
163163
}
164-
if t.Hosted.App.TeamID != "" {
165-
return t.Hosted.App.TeamID
164+
if apps.Hosted.App.TeamID != "" {
165+
return apps.Hosted.App.TeamID
166166
}
167-
return t.Local.App.TeamID
167+
return apps.Local.App.TeamID
168168
}
169169

170170
// appTransferDisclaimer contains a notice of lost app management permissions

internal/slackdeps/os.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ func (c *Os) Glob(pattern string) (matches []string, err error) {
8585
}
8686

8787
// Exit exits the program with a return code
88-
func (m *Os) Exit(code int) {
88+
func (c *Os) Exit(code int) {
8989
os.Exit(code)
9090
}
9191

9292
// Stdout returns the file descriptor for stdout
93-
func (m *Os) Stdout() types.File {
93+
func (c *Os) Stdout() types.File {
9494
return os.Stdout
9595
}

0 commit comments

Comments
 (0)