puppet-lint-roles-profiles 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b945872a2eb66807e4b1d9ecb5f96ad20dc03ce
4
- data.tar.gz: e5c4b11b9c66a5b85581a3bc7ae48780670d3823
3
+ metadata.gz: c617ba6a13ec44e4c41a130c446564a297dd45d3
4
+ data.tar.gz: 5623bfe60411cecfdb68a469206642daab28f7c1
5
5
  SHA512:
6
- metadata.gz: 9e40e268d84f92c85cca3ed00402e02c4a1a6c594e975908e44bcbbaa77406c3bd647c5b2a8afd5b53b8dd59a5d2010c87b8839877ddce048282634976a6ce08
7
- data.tar.gz: df7b1bdbad9ba0810c5027b7c058c5dbf8e6e135a42cb77a244d0c3aef421459a3ee0fe4e4c6ef20660b9e221491edcb317276de79a7ac3e8667582b40369fb9
6
+ metadata.gz: 898397f3e133513d2e184a9cc3ddb0f0e32e6e19f651a45c5d33207ebc2563db6689ef02a81b7d487ad7c4aa37c082f41fd4d5fc8b7c1d3bf0a90a68710c027c
7
+ data.tar.gz: 89658130c10d3b8b1d8edddbbe0ac88ee237d54122a192211d8ea6352d8984853cc2213e9c35d0a0a02714d03239f52c0b2607e51a49fd0de7a88181365c954d
@@ -5,7 +5,7 @@ PuppetLint.new_check(:roles_with_params) do
5
5
  # breaks when roles have params that have variables as defaults
6
6
  c[:param_tokens].select { |t| t.type == :VARIABLE }.each do |t|
7
7
  notify :warning, {
8
- :message => 'roles must not have parameters',
8
+ :message => 'Roles must not have parameters',
9
9
  :line => t.line,
10
10
  :column => t.column,
11
11
  }
@@ -15,33 +15,29 @@ PuppetLint.new_check(:roles_with_params) do
15
15
  end
16
16
 
17
17
  PuppetLint.new_check(:roles_include_profiles) do
18
+ def warn(t)
19
+ notify :warning, {
20
+ :message => "Roles must only include profiles",
21
+ :line => t.line,
22
+ :column => t.column
23
+ }
24
+ end
25
+
18
26
  def check
19
27
  class_indexes.select { |c| c[:name_token].value =~ /^roles?(::|$)/ }.each do |c|
20
28
  # As only `include profile` is allowed any resource is bad
21
29
  resource_indexes.select { |r| r[:start] >= c[:start] and r[:end] <= c[:end] }.each do |r|
22
- notify :warning, {
23
- :message => "Roles must only `include profiles`",
24
- :line => r[:type].line,
25
- :column => r[:type].column,
26
- }
30
+ warn(r[:type])
27
31
  end
28
32
  # each include must be followed with a profile
29
33
  tokens[c[:start]..c[:end]].select { |t| t.value == 'include' }.each do |t|
30
34
  unless t.next_code_token.value =~ /^(::)?profiles?(::|$)/
31
- notify :warning, {
32
- :message => "Roles must only `include profiles`",
33
- :line => t.line,
34
- :column => t.column
35
- }
35
+ warn(t)
36
36
  end
37
37
  end
38
38
  # Conditional logic should be avoided
39
39
  tokens[c[:start]..c[:end]].select { |t| [ :IF, :ELSE, :ELSIF, :UNLESS, :CASE].include?(t.type) }.each do |t|
40
- notify :warning, {
41
- :message => "Roles must only `include profiles`",
42
- :line => t.line,
43
- :column => t.column
44
- }
40
+ warn(t)
45
41
  end
46
42
  end
47
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-roles-profiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hostnet