forked from test-kitchen/test-kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
68 lines (59 loc) · 2.08 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'cucumber'
require 'cucumber/rake/task'
Rake::TestTask.new(:unit) do |t|
t.libs.push "lib"
t.test_files = FileList['spec/**/*_spec.rb']
t.verbose = true
end
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = ['features', '-x', '--format progress']
end
desc "Run all test suites"
task :test => [:unit, :features]
desc "Display LOC stats"
task :stats do
puts "\n## Production Code Stats"
sh "countloc -r lib/kitchen lib/kitchen.rb"
puts "\n## Test Code Stats"
sh "countloc -r spec features"
end
unless RUBY_ENGINE == 'jruby'
require 'cane/rake_task'
require 'tailor/rake_task'
desc "Run cane to check quality metrics"
Cane::RakeTask.new do |cane|
cane.canefile = './.cane'
end
Tailor::RakeTask.new do |task|
task.file_set('bin/*', 'binaries')
task.file_set('lib/**/*.rb', 'code') do |style|
# TODO: Tailor is confused thinking `module Kitchen` is a class. Until
# the classes are split in seperate files, let's punt on this
style.max_code_lines_in_class 1550, level: :warn
# NOTE: Kitchen::InitGenerator.default_yaml is over the default 30 lines
# and produces a warning. Since most of it is increasing readability of
# the data structure, allowing it here to prevent it from growing
style.max_code_lines_in_method 34
style.max_line_length 80, level: :warn
style.max_line_length 160, level: :error
end
task.file_set('spec/**/*.rb', 'tests') do |style|
# allow vertical alignment of `let(:foo) { block }` blocks
style.spaces_before_lbrace 1, level: :off
end
task.file_set('spec/kitchen/data_munger_spec.rb', 'tests') do |style|
# allow data formatting in DataMunger
style.indentation_spaces 2, level: :off
# allow far larger spec file to cover all data input cases as possible
style.max_code_lines_in_class 600, level: :off
end
end
desc "Run all quality tasks"
task :quality => [:cane, :stats]
else
desc "Run all quality tasks"
task :quality => [:stats]
end
task :default => [:test, :quality]