From 5a0d5f9980c8b4f96ae38a25c027212d725326e0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 10 May 2024 18:54:18 +0200 Subject: [PATCH] Rubocop: Enable Naming/VariableNumber I would like to clean up our .rubocop.yaml to follow our standards. I think enabling this cop makes sense, except for the `determine_if_x86_64` method. rubocop prefers `determine_if_x8664` but since `x86_64` is it's own name I disable the cop for this function. --- .rubocop.yml | 3 --- .../fixtures/module/spec/acceptance/demo_spec.rb | 12 ++++++------ lib/beaker/host/mac/pkg.rb | 2 +- lib/beaker/host/pswindows/pkg.rb | 2 +- lib/beaker/host/unix/pkg.rb | 2 +- lib/beaker/host/windows/pkg.rb | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 77d780b63..7ea0f4edf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -22,9 +22,6 @@ Naming/MethodParameterName: Naming/PredicateName: Enabled: false -Naming/VariableNumber: - Enabled: false - RSpec/DescribeClass: Exclude: - acceptance/fixtures/module/spec/**/*.rb diff --git a/acceptance/fixtures/module/spec/acceptance/demo_spec.rb b/acceptance/fixtures/module/spec/acceptance/demo_spec.rb index d66072b69..7f1d19f0c 100644 --- a/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +++ b/acceptance/fixtures/module/spec/acceptance/demo_spec.rb @@ -22,15 +22,15 @@ end it "is able to apply manifests" do - manifest_1 = "user {'foo': + manifest1 = "user {'foo': ensure => present,}" - manifest_2 = "user {'foo': + manifest2 = "user {'foo': ensure => absent,}" - manifest_3 = "user {'root': + manifest3 = "user {'root': ensure => present,}" - apply_manifest(manifest_1, :expect_changes => true) - apply_manifest(manifest_2, :expect_changes => true) - apply_manifest(manifest_3) + apply_manifest(manifest1, :expect_changes => true) + apply_manifest(manifest2, :expect_changes => true) + apply_manifest(manifest3) end describe service('sshd') do diff --git a/lib/beaker/host/mac/pkg.rb b/lib/beaker/host/mac/pkg.rb index 25346e7cc..72b7f4dcb 100644 --- a/lib/beaker/host/mac/pkg.rb +++ b/lib/beaker/host/mac/pkg.rb @@ -43,7 +43,7 @@ def upgrade_package(name, _cmdline_args = '') # Examine the host system to determine the architecture # @return [Boolean] true if x86_64, false otherwise - def determine_if_x86_64 + def determine_if_x86_64 # rubocop:disable Naming/VariableNumber result = exec(Beaker::Command.new("uname -a | grep x86_64"), :expect_all_exit_codes => true) result.exit_code == 0 end diff --git a/lib/beaker/host/pswindows/pkg.rb b/lib/beaker/host/pswindows/pkg.rb index a9d4b78d4..305c58708 100644 --- a/lib/beaker/host/pswindows/pkg.rb +++ b/lib/beaker/host/pswindows/pkg.rb @@ -26,7 +26,7 @@ def uninstall_package(_name, _cmdline_args = '') # Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used # @return [Boolean] true if x86_64, false otherwise - def determine_if_x86_64 + def determine_if_x86_64 # rubocop:disable Naming/VariableNumber identify_windows_architecture.include?('64') end diff --git a/lib/beaker/host/unix/pkg.rb b/lib/beaker/host/unix/pkg.rb index fd5ffbf45..a71a85fdf 100644 --- a/lib/beaker/host/unix/pkg.rb +++ b/lib/beaker/host/unix/pkg.rb @@ -216,7 +216,7 @@ def upgrade_package(name, cmdline_args = '', opts = {}) # Examine the host system to determine the architecture # @return [Boolean] true if x86_64, false otherwise - def determine_if_x86_64 + def determine_if_x86_64 # rubocop:disable Naming/VariableNumber if self[:platform].include?('solaris') result = exec(Beaker::Command.new("uname -a | grep x86_64"), :accept_all_exit_codes => true) result.exit_code == 0 diff --git a/lib/beaker/host/windows/pkg.rb b/lib/beaker/host/windows/pkg.rb index 861fd2df7..7b080d822 100644 --- a/lib/beaker/host/windows/pkg.rb +++ b/lib/beaker/host/windows/pkg.rb @@ -31,7 +31,7 @@ def uninstall_package(name, _cmdline_args = '') # Examine the host system to determine the architecture, overrides default host determine_if_x86_64 so that wmic is used # @return [Boolean] true if x86_64, false otherwise - def determine_if_x86_64 + def determine_if_x86_64 # rubocop:disable Naming/VariableNumber identify_windows_architecture.include?('64') end