diff --git a/.rubocop.yml b/.rubocop.yml index e011f1a..62d4b5b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,15 +13,18 @@ Metrics/LineLength: Style/Documentation: Enabled: false +Style/FormatStringToken: + EnforcedStyle: template + Style/HashSyntax: Enabled: false SupportedStyles: - ruby19 - hash_rockets -Style/ExtraSpacing: +Layout/ExtraSpacing: AllowForAlignment: true -Style/AlignHash: +Layout/AlignHash: EnforcedHashRocketStyle: table EnforcedColonStyle: table diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c1e6a96..9445d4a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -65,17 +65,3 @@ Metrics/ParameterLists: # Offense count: 4 Metrics/PerceivedComplexity: Max: 13 - -# Offense count: 1 -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: format, sprintf, percent -Style/FormatString: - Exclude: - - 'app/models/concerns/fog_extensions/xenserver/server.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: SupportedStyles. -# SupportedStyles: percent, brackets -Style/SymbolArray: - EnforcedStyle: brackets diff --git a/Gemfile b/Gemfile index 3449fdd..3c20a52 100644 --- a/Gemfile +++ b/Gemfile @@ -3,4 +3,4 @@ source 'https://rubygems.org' gemspec gem 'nokogiri', '< 1.7', require: false if RUBY_VERSION.start_with? '2.0.' -gem 'rubocop', '~> 0.48.1', require: false +gem 'rubocop', '~> 0.49.1', require: false diff --git a/app/models/concerns/fog_extensions/xenserver/server.rb b/app/models/concerns/fog_extensions/xenserver/server.rb index 0940acc..56d4a5d 100644 --- a/app/models/concerns/fog_extensions/xenserver/server.rb +++ b/app/models/concerns/fog_extensions/xenserver/server.rb @@ -41,7 +41,7 @@ def state end def vm_description - _('%{cpus} CPUs and %{ram} memory') % { :cpus => vcpus_max, :ram => number_to_human_size(memory_max.to_i) } + format(_('%{cpus} CPUs and %{ram} memory'), :cpus => vcpus_max, :ram => number_to_human_size(memory_max.to_i)) end def interfaces diff --git a/app/models/foreman_xen/xenserver.rb b/app/models/foreman_xen/xenserver.rb index a0243ee..becec82 100644 --- a/app/models/foreman_xen/xenserver.rb +++ b/app/models/foreman_xen/xenserver.rb @@ -187,7 +187,7 @@ def new_vm(attr = {}) return unless errors.empty? opts = vm_instance_defaults.merge(attr.to_hash).symbolize_keys - [:networks, :volumes].each do |collection| + %i[networks volumes].each do |collection| nested_attrs = opts.delete("#{collection}_attributes".to_sym) opts[collection] = nested_attributes_for(collection, nested_attrs) if nested_attrs end