forked from voxpupuli/puppet-jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
72 lines (61 loc) · 1.71 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
69
70
71
72
require 'puppetlabs_spec_helper/rake_tasks'
require 'rubocop/rake_task'
require 'puppet-strings/tasks'
RuboCop::RakeTask.new
exclude_paths = [
'pkg/**/*',
'vendor/**/*',
'spec/**/*',
'examples/**/*'
]
# Make sure we don't have the default rake task floating around
Rake::Task['lint'].clear
PuppetLint.configuration.relative = true
PuppetLint::RakeTask.new(:lint) do |l|
l.disable_checks = %w(80chars class_inherits_from_params_class)
l.ignore_paths = exclude_paths
l.fail_on_warnings = true
l.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
end
PuppetSyntax.exclude_paths = exclude_paths
namespace :travis do
desc 'Syntax check travis.yml'
task :lint do
# warnings are currently non-fatal due to suspected problems with
# validation of matrix::include
#sh "travis lint --exit-code" do |ok, res|
sh 'travis lint --skip-completion-check' do |ok, res|
unless ok
# exit without verbose rake error message
exit res.exitstatus
end
end
end
end
sh_scripts = %w(
templates/jenkins-slave-run.erb
)
desc 'Syntax check shellscripts'
task :shellcheck do
sh "shellcheck #{sh_scripts.join(' ')}" do |ok, res|
unless ok
# exit without verbose rake error message
exit res.exitstatus
end
end
end
default_tasks = [
:lint,
:validate,
:parallel_spec,
]
# rubocop 0.47.0 blows up with puppet 3.8, mostly likely due to monkey patching
# shenanigans:
# Running RuboCop...
# wrong number of arguments (5 for 1..3)
# ../puppet-jenkins/.bundle/ruby/2.0.0/gems/puppet-3.8.7/lib/puppet/vendor/safe_yaml/lib/safe_yaml.rb:162:in `safe_load'
require 'puppet'
if not Puppet.version =~ /^3/
default_tasks.unshift :rubocop
end
task :default => default_tasks