saltstack-formulas / dhcpd-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
8 stars 56 forks source link

[InSpec] Unused assignment of `service_config_filename` when fixing using `rubocop` #40

Closed myii closed 4 years ago

myii commented 4 years ago

@baby-gnu I've been working through the formulas and fixing the "easy ones" for rubocop lint issues. This formula is a good candidate; rubocop --safe-auto-correct gets us down to the last two offenses:

dhcpd-formula$ rubocop --safe-auto-correct
Inspecting 5 files
..W..

Offenses:

test/integration/default/controls/config_spec.rb:9:3: W: Lint/UselessAssignment: Useless assignment to variable - service_config_filename.
  service_config_filename = '/etc/default/isc-dhcp-server'
  ^^^^^^^^^^^^^^^^^^^^^^^
test/integration/default/controls/config_spec.rb:12:3: W: Lint/UselessAssignment: Useless assignment to variable - service_config_filename.
  service_config_filename = '/etc/rc.conf.d/dhcpd'
  ^^^^^^^^^^^^^^^^^^^^^^^

5 files inspected, 2 offenses detected

Tracking back gets us to eb3c9481. We're defining service_config_filename but actually using config_filename, the same as the block above. Now if service_config_filename was defined for 'arch', 'suse' and 'redhat', this would be a simple fix.

How would you like this to be resolved?

myii commented 4 years ago

Fixed in #48 (3c7cd44).