File tree 7 files changed +28
-26
lines changed
7 files changed +28
-26
lines changed Original file line number Diff line number Diff line change 59
59
ruby-version : ${{ matrix.ruby }}
60
60
bundler-cache : true
61
61
working-directory : vagrant
62
+ - name : Run Rubocop
63
+ run : bundle exec rubocop --format github
64
+ if : matrix.ruby == '3.1'
65
+ working-directory : vagrant
62
66
- name : Run tests
63
67
run : bundle exec rake
64
68
working-directory : vagrant
Original file line number Diff line number Diff line change
1
+ require :
2
+ - rubocop-minitest
3
+ - rubocop-rake
4
+
1
5
AllCops :
2
6
Include :
3
7
- ' **/Rakefile'
@@ -6,10 +10,10 @@ AllCops:
6
10
Exclude :
7
11
- !ruby/regexp /katello-installer/
8
12
- !ruby/regexp /.spec/
9
- - ' vendor/**/* '
10
- TargetRubyVersion : 2.0
13
+ TargetRubyVersion : ' 2.7 '
14
+ NewCops : enable
11
15
12
- Metrics /LineLength :
16
+ Layout /LineLength :
13
17
Max : 120
14
18
15
19
Metrics/ClassLength :
@@ -18,14 +22,14 @@ Metrics/ClassLength:
18
22
Metrics/BlockLength :
19
23
Max : 50
20
24
21
- Documentation :
25
+ Style/ Documentation :
22
26
Enabled : false # don't require documentation
23
27
24
- MethodLength :
28
+ Metrics/ MethodLength :
25
29
Description : ' Avoid methods longer than 30 lines of code.'
26
30
Max : 30
27
31
28
- HashSyntax :
32
+ Style/ HashSyntax :
29
33
Enabled : false # don't force 1.9 hash syntax
30
34
31
35
Layout/EmptyLinesAroundClassBody :
Original file line number Diff line number Diff line change 1
- # rubocop:disable Naming/FileName
2
1
source 'https://rubygems.org'
3
2
4
- if RUBY_VERSION < '2.1'
5
- gem 'psych' , '~> 2.0'
6
- end
7
-
8
3
group :test do
9
4
gem 'deep_merge'
10
5
gem 'json'
11
6
gem 'minitest'
12
7
gem 'mocha'
13
8
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
20
9
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]
13
13
begin
14
14
require 'rubocop/rake_task'
15
15
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' )
18
17
rescue LoadError
19
18
puts 'Rubocop not loaded'
20
19
end
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- $LOAD_PATH. unshift File . dirname ( __FILE__ )
3
+ $LOAD_PATH. unshift __dir__
4
4
5
- files = Dir [ File . dirname ( __FILE__ ) + ' /forklift/**/*.rb' ]
5
+ files = Dir [ " #{ __dir__ } /forklift/**/*.rb" ]
6
6
files . uniq . each { |f | require f }
7
7
8
8
module Forklift
Original file line number Diff line number Diff line change 5
5
module Forklift
6
6
class BoxDistributor
7
7
8
- VAGRANTFILE_API_VERSION = '2' . freeze
8
+ VAGRANTFILE_API_VERSION = '2'
9
9
10
10
def initialize ( boxes )
11
11
@ansible_groups = { }
@@ -177,12 +177,12 @@ def configure_networks(networks)
177
177
def configure_ansible ( machine , ansible , box_name )
178
178
return unless ansible
179
179
180
- if ansible . key? ( 'group' ) && ! ansible [ 'group' ] . nil?
180
+ unless ansible [ 'group' ] . nil?
181
181
@ansible_groups [ ansible [ 'group' ] . to_s ] ||= [ ]
182
182
@ansible_groups [ ansible [ 'group' ] . to_s ] << box_name
183
183
end
184
184
185
- if ansible . key? ( 'server' ) && ! ansible [ 'server' ] . nil?
185
+ unless ansible [ 'server' ] . nil?
186
186
@ansible_groups [ "server-#{ box_name } " ] = ansible [ 'server' ]
187
187
end
188
188
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def add_boxes!(box_file)
31
31
32
32
def filter_boxes!
33
33
box_config = Settings . new . settings [ 'boxes' ]
34
- return unless box_config && box_config . key? ( 'exclude' )
34
+ return unless box_config & .key? ( 'exclude' )
35
35
36
36
@boxes . reject! do |name , _box |
37
37
box_config [ 'exclude' ] . any? { |exclude | name . match ( /#{ exclude } / ) }
You can’t perform that action at this time.
0 commit comments