Skip to content

Commit

Permalink
the linter has spoken
Browse files Browse the repository at this point in the history
  • Loading branch information
wass3rw3rk committed May 5, 2023
1 parent f1da366 commit 9b0b09b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions core/matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ func doRuleActions(message models.Message, outputMsgs chan<- models.Message, rul
directive = false
}
// Create copy of message so as to not overwrite other message action type messages
copy := deepcopy.Copy(message).(models.Message)
err = handleMessage(action, outputMsgs, &copy, directive, rule.StartMessageThread, hitRule, bot)
dcopy := deepcopy.Copy(message).(models.Message)
err = handleMessage(action, outputMsgs, &dcopy, directive, rule.StartMessageThread, hitRule, bot)
// Fallback to error if action type is invalid
default:
log.Error().Msgf("the rule %#q of type %#q is not a supported action", action.Name, action.Type)
Expand Down
4 changes: 2 additions & 2 deletions remote/cli/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func (c *Client) Name() string {
}

// Reaction implementation to satisfy remote interface.
func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.Bot) {
func (c *Client) Reaction(_ models.Message, _ models.Rule, _ *models.Bot) {
// not implemented for CLI
}

// Read implementation to satisfy remote interface.
func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot) {
func (c *Client) Read(inputMsgs chan<- models.Message, _ map[string]models.Rule, bot *models.Bot) {
user := bot.CLIUser
if user == "" {
user = "Flottbot-CLI-User"
Expand Down
4 changes: 2 additions & 2 deletions remote/discord/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (c *Client) Name() string {
// .
// reaction: 🔥
// .
func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.Bot) {
func (c *Client) Reaction(message models.Message, rule models.Rule, _ *models.Bot) {
if rule.RemoveReaction != "" {
// Init api client
dg := c.new()
Expand All @@ -76,7 +76,7 @@ func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.
}

// Read implementation to satisfy remote interface.
func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot) {
func (c *Client) Read(inputMsgs chan<- models.Message, _ map[string]models.Rule, bot *models.Bot) {
dg := c.new()
if dg == nil {
log.Error().Msg("failed to initialize discord client")
Expand Down
6 changes: 3 additions & 3 deletions remote/gchat/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (c *Client) Name() string {
}

// Read messages from Google Chat.
func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot) {
func (c *Client) Read(inputMsgs chan<- models.Message, _ map[string]models.Rule, _ *models.Bot) {
ctx := context.Background()

// init client
Expand Down Expand Up @@ -79,7 +79,7 @@ func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.R
}

// Send messages to Google Chat.
func (c *Client) Send(message models.Message, bot *models.Bot) {
func (c *Client) Send(message models.Message, _ *models.Bot) {
ctx := context.Background()

service, err := chat.NewService(
Expand Down Expand Up @@ -110,6 +110,6 @@ func (c *Client) Send(message models.Message, bot *models.Bot) {
}

// Reaction implementation to satisfy remote interface.
func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.Bot) {
func (c *Client) Reaction(_ models.Message, _ models.Rule, _ *models.Bot) {
// Not implemented for Google Chat
}
4 changes: 2 additions & 2 deletions remote/scheduler/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (c *Client) Name() string {
}

// Reaction implementation to satisfy remote interface.
func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.Bot) {
func (c *Client) Reaction(_ models.Message, _ models.Rule, _ *models.Bot) {
// not implemented for Scheduler
}

Expand Down Expand Up @@ -123,7 +123,7 @@ func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.R
}

// Send implementation to satisfy remote interface.
func (c *Client) Send(message models.Message, bot *models.Bot) {
func (c *Client) Send(_ models.Message, _ *models.Bot) {
// not implemented for Scheduler
}

Expand Down
3 changes: 1 addition & 2 deletions remote/slack/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Slack helper functions (anything that uses the 'slack-go/slack' package)
*/

// getEventsAPIHealthHandler creates and returns the handler for health checks on the Slack Events API reader.
func getEventsAPIHealthHandler(bot *models.Bot) func(w http.ResponseWriter, r *http.Request) {
func getEventsAPIHealthHandler(_ *models.Bot) func(w http.ResponseWriter, r *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
log.Error().Msgf("received invalid method: %s", r.Method)
Expand Down Expand Up @@ -219,7 +219,6 @@ func getEventsAPIEventHandler(api *slack.Client, signingSecret string, inputMsgs

// process regular Callback events
if eventsAPIEvent.Type == slackevents.CallbackEvent {
//nolint:contextcheck // TODO: create and pass context?
handleCallBack(api, eventsAPIEvent.InnerEvent, bot, inputMsgs, w)
}
}
Expand Down
6 changes: 3 additions & 3 deletions remote/slack/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (l *slackLogger) Output(_ int, s string) error {
}

// Reaction implementation to satisfy remote interface.
func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.Bot) {
func (c *Client) Reaction(message models.Message, rule models.Rule, _ *models.Bot) {
if rule.RemoveReaction != "" {
// Init api client
api := c.new()
Expand Down Expand Up @@ -83,7 +83,7 @@ func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.

// Read implementation to satisfy remote interface
// Utilizes the Slack API client to read messages from Slack.
func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot) {
func (c *Client) Read(inputMsgs chan<- models.Message, _ map[string]models.Rule, bot *models.Bot) {
// init api client
api := c.new()

Expand Down Expand Up @@ -129,7 +129,7 @@ func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.R
}

// Send implementation to satisfy remote interface.
func (c *Client) Send(message models.Message, bot *models.Bot) {
func (c *Client) Send(message models.Message, _ *models.Bot) {
log.Debug().Msgf("sending message %#q", message.ID)

api := c.new()
Expand Down
6 changes: 3 additions & 3 deletions remote/telegram/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ func (c *Client) Name() string {
}

// Reaction implementation to satisfy remote interface.
func (c *Client) Reaction(message models.Message, rule models.Rule, bot *models.Bot) {
func (c *Client) Reaction(_ models.Message, _ models.Rule, _ *models.Bot) {
// not implemented for Telegram
}

// Read implementation to satisfy remote interface.
func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot) {
func (c *Client) Read(inputMsgs chan<- models.Message, _ map[string]models.Rule, bot *models.Bot) {
telegramAPI := c.new()
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
Expand Down Expand Up @@ -132,7 +132,7 @@ func (c *Client) Read(inputMsgs chan<- models.Message, rules map[string]models.R
}

// Send implementation to satisfy remote interface.
func (c *Client) Send(message models.Message, bot *models.Bot) {
func (c *Client) Send(message models.Message, _ *models.Bot) {
telegramAPI := c.new()

chatID, err := strconv.ParseInt(message.ChannelID, 10, 64)
Expand Down

0 comments on commit 9b0b09b

Please sign in to comment.