[PATCH lkp-tests] stats/netperf: fix rubocop offenses

[Why] Inspecting 1 file C Offenses: netperf:51:29: C: Style/NumericPredicate: Use iterations.positive? instead of iterations > 0. throughtput /= iteration if iterations > 0 ^^^^^^^^^^^^^^ 1 file inspectef, 1 offense detected Signed-off-by: Zhang Yale <ylzhangah@qq.com> --- stats/netperf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stats/netperf b/stats/netperf index 7965b1ed..80b07ae5 100755 --- a/stats/netperf +++ b/stats/netperf @@ -48,7 +48,7 @@ avg_throughput = throughput / num # We only cares for the average total throughput/workload # within each iteration. -throughput /= iterations if iterations > 0 +throughput /= iterations if iterations.positive? workload = throughput * time workload = workload * 10**6 / 8.0 / pkt_size if unit == 'Mbps' -- 2.23.0

On Thu, Nov 19, 2020 at 09:00:03PM +0800, Zhang Yale wrote:
[Why]
If there is only one single [Why] section, probably don't need add it. Thanks, Chenglong
Inspecting 1 file C
Offenses:
netperf:51:29: C: Style/NumericPredicate: Use iterations.positive? instead of iterations > 0. throughtput /= iteration if iterations > 0 ^^^^^^^^^^^^^^
1 file inspectef, 1 offense detected
Signed-off-by: Zhang Yale <ylzhangah@qq.com> --- stats/netperf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stats/netperf b/stats/netperf index 7965b1ed..80b07ae5 100755 --- a/stats/netperf +++ b/stats/netperf @@ -48,7 +48,7 @@ avg_throughput = throughput / num # We only cares for the average total throughput/workload # within each iteration.
-throughput /= iterations if iterations > 0 +throughput /= iterations if iterations.positive?
workload = throughput * time workload = workload * 10**6 / 8.0 / pkt_size if unit == 'Mbps' -- 2.23.0

On Fri, Nov 20, 2020 at 09:46:15AM +0800, Wang Chenglong wrote:
On Thu, Nov 19, 2020 at 09:00:03PM +0800, Zhang Yale wrote:
[Why]
If there is only one single [Why] section, probably don't need add it.
Thanks, Chenglong
Ok, I got it. Thanks, Yale
Inspecting 1 file C
Offenses:
netperf:51:29: C: Style/NumericPredicate: Use iterations.positive? instead of iterations > 0. throughtput /= iteration if iterations > 0 ^^^^^^^^^^^^^^
1 file inspectef, 1 offense detected
Signed-off-by: Zhang Yale <ylzhangah@qq.com> --- stats/netperf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stats/netperf b/stats/netperf index 7965b1ed..80b07ae5 100755 --- a/stats/netperf +++ b/stats/netperf @@ -48,7 +48,7 @@ avg_throughput = throughput / num # We only cares for the average total throughput/workload # within each iteration.
-throughput /= iterations if iterations > 0 +throughput /= iterations if iterations.positive?
workload = throughput * time workload = workload * 10**6 / 8.0 / pkt_size if unit == 'Mbps' -- 2.23.0
participants (2)
-
Wang Chenglong
-
Zhang Yale