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

chore(linters): Fix findings found by testifylint for Windows and enable testifylint linter in golangci-lint. #14238

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

zak-pawel
Copy link
Collaborator

Address findings for testifylint for windows.
Enable testifylint linter in golangci-lint.

@zak-pawel
Copy link
Collaborator Author

I enabled all checkers for https://github.com/Antonboom/testifylint/tree/v0.2.3 (version contained in current golangci-lint), except https://github.com/Antonboom/testifylint/tree/v0.2.3#float-compare:

❌   assert.Equal(t, 42.42, a)
     assert.True(t, a == 42.42)
     assert.False(t, a != 42.42)
	
✅   assert.InEpsilon(t, 42.42, a, 0.0001)
     assert.InDelta(t, 42.42, a, 0.01)

For float-compare following findings are found:

/home/pzak/work/telegraf/plugins/inputs/ctrlx_datalayer/ctrlx_datalayer_test.go:208:4: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/ctrlx_datalayer/ctrlx_datalayer_test.go:228:4: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_powerstat/intel_powerstat_test.go:739:4: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_powerstat/intel_powerstat_test.go:773:4: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_powerstat/rapl_test.go:33:2: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_powerstat/rapl_test.go:105:2: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_powerstat/rapl_test.go:106:2: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:47:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:48:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:49:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:50:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:51:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:52:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:134:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:135:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:136:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:137:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:138:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/intel_rdt/publisher_test.go:139:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/netflow/type_conversion_test.go:62:2: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/postgresql_extensible/postgresql_extensible_test.go:137:4: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/vsphere/vsphere_test.go:181:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/inputs/vsphere/vsphere_test.go:207:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/groundwork/groundwork_test.go:95:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/groundwork/groundwork_test.go:96:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/groundwork/groundwork_test.go:97:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/groundwork/groundwork_test.go:164:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/groundwork/groundwork_test.go:165:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/groundwork/groundwork_test.go:166:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/nebius_cloud_monitoring/nebius_cloud_monitoring_test.go:74:5: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/nebius_cloud_monitoring/nebius_cloud_monitoring_test.go:96:5: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/nebius_cloud_monitoring/nebius_cloud_monitoring_test.go:118:5: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/nebius_cloud_monitoring/nebius_cloud_monitoring_test.go:143:5: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/sensu/sensu_test.go:203:4: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/yandex_cloud_monitoring/yandex_cloud_monitoring_test.go:74:5: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/yandex_cloud_monitoring/yandex_cloud_monitoring_test.go:95:5: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/outputs/yandex_cloud_monitoring/yandex_cloud_monitoring_test.go:116:5: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/parsers/nagios/parser_test.go:522:3: float-compare: use require.InEpsilon (or InDelta)
/home/pzak/work/telegraf/plugins/parsers/nagios/parser_test.go:523:3: float-compare: use require.InEpsilon (or InDelta)

But in our case, I don't feel a great improvement from turning it on.
What do you think?

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. My only concern is the workaround for the linter issue sticking with us forever. :-)

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 2, 2023
@powersj powersj merged commit 7da8956 into influxdata:master Nov 2, 2023
23 checks passed
@github-actions github-actions bot added this to the v1.28.4 milestone Nov 2, 2023
Hipska added a commit to Super-Visions/telegraf that referenced this pull request Nov 7, 2023
* master:
  fix(inputs.win_perf_counter): Do not rely on returned buffer size (influxdata#14241)
  feat(inputs.modbus): Add support for string-fields (influxdata#14145)
  chore(deps): Bump cloud.google.com/go/storage from 1.30.1 to 1.34.1 (influxdata#14253)
  chore(deps): Bump github.com/rabbitmq/amqp091-go from 1.8.1 to 1.9.0 (influxdata#14252)
  chore(deps): Bump github.com/hashicorp/consul/api from 1.25.1 to 1.26.1 (influxdata#14251)
  chore(deps): Bump github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs from 1.23.5 to 1.26.0 (influxdata#14249)
  fix(config): Fix comment removal in TOML files (influxdata#14240)
  feat(outputs.prometheus_client): Support listen on vsock (influxdata#14108)
  fix(inputs.mqtt_consumer): Resolve could not mark message delivered (influxdata#14243)
  chore(linters): Fix findings found by testifylint for Windows and enable it. (influxdata#14238)
  feat(migrations): Add option migration for inputs.nats_consumer (influxdata#14234)
  feat(migrations): Add option migration for inputs.mqtt_consumer (influxdata#14233)
  test(inputs.jolokia2_agent): Sort metrics as order is not consistent (influxdata#14227)
powersj pushed a commit that referenced this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore linter ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants