Class: TaskGen

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
rake_modules/taskgen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ TaskGen

Returns a new instance of TaskGen.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'rake_modules/taskgen.rb', line 22

def initialize(path)
  @tasks_categories = [
    :puppet_lint,
    :typos,
    :syntax,
    :rubocop,
    :common_yaml,
    :hiera_defaults,
    :shellcheck,
    :python_extensions,
    :spec,
    :tox,
    :dhcp,
    :per_module_tox,
    :conftool_schema
  ]
  @git = GitOps.new(path)
  @changed_files = @git.changes_in_head
  @tasks = setup_tasks
  @failed_specs = []
  PuppetSyntax.exclude_paths = ['vendor/**/*']
end

Instance Attribute Details

#failed_specsObject

Returns the value of attribute failed_specs.



20
21
22
# File 'rake_modules/taskgen.rb', line 20

def failed_specs
  @failed_specs
end

#tasksObject

Returns the value of attribute tasks.



20
21
22
# File 'rake_modules/taskgen.rb', line 20

def tasks
  @tasks
end

Instance Method Details



56
57
58
59
60
61
62
63
64
65
66
67
# File 'rake_modules/taskgen.rb', line 56

def print_wmf_style_violations(problems, other = nil, format = '%{path}:%{line} %{message}')
  # Prints the wmf style violations
  other ||= {}
  events = problems.select do |p|
    other.select { |x| x[:message] == p[:message] && x[:path] == p[:path] }.empty?
  end
  events.each do |p|
    p[:KIND] = p[:kind].to_s.upcase
    puts format(format, p).red
  end
  puts "Nothing found".green if events.length.zero?
end

#setup_wmf_lint_checkObject



45
46
47
48
49
50
51
52
53
54
# File 'rake_modules/taskgen.rb', line 45

def setup_wmf_lint_check
  # Sets up puppet-lint to only check for the wmf style guide
  PuppetLint.configuration.checks.each do |check|
    if check == :wmf_styleguide
      PuppetLint.configuration.send('enable_wmf_styleguide')
    else
      PuppetLint.configuration.send("disable_#{check}")
    end
  end
end