File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5959 ruby-version : ${{ matrix.ruby }}
6060 bundler-cache : true
6161 working-directory : vagrant
62+ - name : Run Rubocop
63+ run : bundle exec rubocop --format github
64+ if : matrix.ruby == '3.1'
65+ working-directory : vagrant
6266 - name : Run tests
6367 run : bundle exec rake
6468 working-directory : vagrant
Original file line number Diff line number Diff line change 1+ require :
2+ - rubocop-minitest
3+ - rubocop-rake
4+
15AllCops :
26 Include :
37 - ' **/Rakefile'
48 - ' lib/**/*.rb'
59 - ' test/**/*.rb'
610 Exclude :
7- - !ruby/regexp /katello-installer/
8- - !ruby/regexp /.spec/
911 - ' vendor/**/*'
10- TargetRubyVersion : 2.0
12+ TargetRubyVersion : ' 2.7'
13+ NewCops : enable
1114
12- Metrics /LineLength :
15+ Layout /LineLength :
1316 Max : 120
1417
1518Metrics/ClassLength :
@@ -18,14 +21,14 @@ Metrics/ClassLength:
1821Metrics/BlockLength :
1922 Max : 50
2023
21- Documentation :
24+ Style/ Documentation :
2225 Enabled : false # don't require documentation
2326
24- MethodLength :
27+ Metrics/ MethodLength :
2528 Description : ' Avoid methods longer than 30 lines of code.'
2629 Max : 30
2730
28- HashSyntax :
31+ Style/ HashSyntax :
2932 Enabled : false # don't force 1.9 hash syntax
3033
3134Layout/EmptyLinesAroundClassBody :
Original file line number Diff line number Diff line change 1- # rubocop:disable Naming/FileName
21source 'https://rubygems.org'
32
4- if RUBY_VERSION < '2.1'
5- gem 'psych' , '~> 2.0'
6- end
7-
83group :test do
94 gem 'deep_merge'
105 gem 'json'
116 gem 'minitest'
127 gem 'mocha'
138 gem 'rake'
14- if RUBY_VERSION < '3.1'
15- # we need a rubocop that still can manage Ruby 2.0 code
16- # but 0.49.x is not compatible with Ruby 3.1
17- gem 'rubocop' , '<0.50'
18- end
19- end
209
21- # rubocop:enable Naming/FileName
10+ # Make sure the Ruby version is supported
11+ # https://docs.rubocop.org/rubocop/compatibility.html#support-matrix
12+ gem 'rubocop' , '~> 1.56.0'
13+ gem 'rubocop-minitest'
14+ gem 'rubocop-performance'
15+ gem 'rubocop-rake'
16+ end
Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ default_tasks = %i[test]
1313begin
1414 require 'rubocop/rake_task'
1515 RuboCop ::RakeTask . new
16- # insert 0, because Ruby 2.0 doesn't know Array.prepend
17- default_tasks . insert ( 0 , 'rubocop' )
16+ default_tasks . prepend ( 'rubocop' )
1817rescue LoadError
1918 puts 'Rubocop not loaded'
2019end
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- $LOAD_PATH. unshift File . dirname ( __FILE__ )
3+ $LOAD_PATH. unshift __dir__
44
5- files = Dir [ File . dirname ( __FILE__ ) + ' /forklift/**/*.rb' ]
5+ files = Dir [ " #{ __dir__ } /forklift/**/*.rb" ]
66files . uniq . each { |f | require f }
77
88module Forklift
Original file line number Diff line number Diff line change 55module Forklift
66 class BoxDistributor
77
8- VAGRANTFILE_API_VERSION = '2' . freeze
8+ VAGRANTFILE_API_VERSION = '2'
99
1010 def initialize ( boxes )
1111 @ansible_groups = { }
@@ -177,12 +177,12 @@ def configure_networks(networks)
177177 def configure_ansible ( machine , ansible , box_name )
178178 return unless ansible
179179
180- if ansible . key? ( 'group' ) && ! ansible [ 'group' ] . nil?
180+ unless ansible [ 'group' ] . nil?
181181 @ansible_groups [ ansible [ 'group' ] . to_s ] ||= [ ]
182182 @ansible_groups [ ansible [ 'group' ] . to_s ] << box_name
183183 end
184184
185- if ansible . key? ( 'server' ) && ! ansible [ 'server' ] . nil?
185+ unless ansible [ 'server' ] . nil?
186186 @ansible_groups [ "server-#{ box_name } " ] = ansible [ 'server' ]
187187 end
188188
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def add_boxes!(box_file)
3131
3232 def filter_boxes!
3333 box_config = Settings . new . settings [ 'boxes' ]
34- return unless box_config && box_config . key? ( 'exclude' )
34+ return unless box_config & .key? ( 'exclude' )
3535
3636 @boxes . reject! do |name , _box |
3737 box_config [ 'exclude' ] . any? { |exclude | name . match ( /#{ exclude } / ) }
You can’t perform that action at this time.
0 commit comments