Skip to content

The enforce-repeated-arg-type-style rule finds some false positives. #1032

@zak-pawel

Description

@zak-pawel

Describe the bug
The enforce-repeated-arg-type-style rule finds some false positives. I will demonstrate this using the repository https://github.com/influxdata/telegraf (over 650k lines) as an example.

To Reproduce
Steps to reproduce the behavior:

  1. I updated revive go install github.com/mgechev/revive@latest
  2. I cloned repo and switched to particular branch
git clone https://github.com/influxdata/telegraf.git
cd telegraf
git checkout v1.31.3
  1. I run it with the following flags & configuration file:
# flags
revive -config revive.toml ./... | sort
#revive.toml
[rule.enforce-repeated-arg-type-style]
  arguments = ["short"]
  1. Some of the findings are false positives.

Expected behavior
I would like only the findings that are not false positives to be shown.

Logs
Some examples:

plugins/inputs/webhooks/artifactory/artifactory_webhook.go:23:87: repeated argument type can be omitted:
image

plugins/outputs/bigquery/bigquery.go:244:45: repeated argument type can be omitted:
image

plugins/outputs/mqtt/mqtt_test.go:803:59: repeated argument type can be omitted:
image

Desktop (please complete the following information):

  • OS: Ubuntu 23:10
  • Version of Go:
$ go version 
go version go1.23.0 linux/amd64

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions