puppet-lint-strict_indent-check 2.0.5 → 2.0.6

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
- SHA1:
3
- metadata.gz: 774fca327b9758ac7472d007f70eb8998dd8e122
4
- data.tar.gz: 59a9bd1bcbc55fd51a2c246254893d6cc825a734
2
+ SHA256:
3
+ metadata.gz: 804d6abcaf4f2a4901a92c870bc3757ef41686d03a69cc8b8d12e79ac1314ee8
4
+ data.tar.gz: 12f31bfa8b97c32a9672b21070d18fa1e17e4b6a5f52ce3fc9c906ef694dda96
5
5
  SHA512:
6
- metadata.gz: 529d73f1f372ecf68d4929577e7738a4df9c925792e8c5d02e1ff1ac244d471e6eebf67dd2f30ff81d1dd484a72edc4c036c1951e546db08ef1a61bea883062a
7
- data.tar.gz: fa04875c8410244a07c37c98f4159f99caa63cd6c01f465581d32eacd95752618391500df6802e3848309d4f35d1016285945852aff05804501e6c3f5793271c
6
+ metadata.gz: f2597a26fe5b2d90e1f734fb4bd1a01f5c9521b751b2afe37b354103e8f186f4ee8b8c031642e6e825316e523229ea6d659581253a968a1419608496b07347fa
7
+ data.tar.gz: a90981494f25f52346791744c7e29adf56a1f44f42508a7cfb71c85c67830c9d395fca8cf49715c479bdf60d38cf2b3cfc07f8b7884f92f1c3e7d2fd1426480c
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  Installation
2
2
  ===
3
3
 
4
+ [![Build Status](https://travis-ci.org/relud/puppet-lint-strict_indent-check.svg?branch=master)](https://travis-ci.org/relud/puppet-lint-strict_indent-check)
5
+
4
6
  <pre>
5
7
  gem install puppet-lint-strict_indent-check
6
8
  </pre>
@@ -3,19 +3,27 @@
3
3
 
4
4
  PuppetLint.new_check(:'strict_indent') do
5
5
  def match(tokens)
6
+ opening_token = {
7
+ :RBRACE => :LBRACE,
8
+ :RBRACK => :LBRACK,
9
+ :RPAREN => :LPAREN,
10
+ :HEREDOC => :HEREDOC_OPEN,
11
+ :HEREDOC_POST => :HEREDOC_OPEN,
12
+ }
6
13
  open = {
7
14
  :LBRACE => [],
8
15
  :LBRACK => [],
9
16
  :LPAREN => [],
17
+ :HEREDOC_OPEN => [],
10
18
  }
11
19
 
12
20
  matches = {}
13
21
 
14
22
  tokens.each do |token|
15
- if [:LBRACE, :LBRACK, :LPAREN].include?(token.type)
23
+ if [:LBRACE, :LBRACK, :LPAREN, :HEREDOC_OPEN].include?(token.type)
16
24
  open[token.type] << token
17
- elsif [:RBRACE, :RBRACK, :RPAREN].include?(token.type)
18
- match = open[("L" + token.type.to_s[1..-1]).to_sym].pop
25
+ elsif [:RBRACE, :RBRACK, :RPAREN, :HEREDOC, :HEREDOC_POST].include?(token.type)
26
+ match = open[opening_token[token.type]].pop
19
27
  if not match.nil?
20
28
  matches[token] = match
21
29
  matches[match] = token
@@ -45,6 +53,9 @@ PuppetLint.new_check(:'strict_indent') do
45
53
  open_groups = 0
46
54
  prev_token = token.prev_token
47
55
  while not prev_token.nil? and prev_token.type != :NEWLINE
56
+ if prev_token.type == :HEREDOC_OPEN
57
+ temp_indent += 1
58
+ end
48
59
  if [:LBRACE, :LBRACK, :LPAREN].include?(prev_token.type)
49
60
  if matches[prev_token].nil? or matches[prev_token].line > prev_token.line
50
61
  # left braces not matched in the same line increase indent
@@ -120,6 +131,10 @@ PuppetLint.new_check(:'strict_indent') do
120
131
  actual = 0
121
132
  if token.next_token.type == :INDENT
122
133
  actual = token.next_token.value.length
134
+ elsif token.prev_token.type == :HEREDOC
135
+ actual = token.prev_token.value.split("\n").last.length
136
+ elsif token.prev_token.type == :HEREDOC_OPEN
137
+ actual = next_token.prev_token.value.split("\n").last.length
123
138
  else
124
139
  actual = 0
125
140
  end
@@ -0,0 +1,4 @@
1
+ $variable = @(EOT)
2
+ This is a multiline
3
+ heredoc string
4
+ | EOT
@@ -0,0 +1,4 @@
1
+ $variable = @(EOT)
2
+ This is a multiline
3
+ heredoc string
4
+ | EOT
@@ -0,0 +1,21 @@
1
+ $variable = @(EOT)
2
+ This is a multiline
3
+ heredoc string
4
+ | EOT
5
+
6
+ $variable_with_interpolation = @("EOT")
7
+ Another example
8
+ ${variable}
9
+ with
10
+ ${variable}
11
+ with interpolation
12
+ | EOT
13
+
14
+ case fact('os.family') {
15
+ 'debian': {
16
+ $greeting = @(EOT)
17
+ Hello
18
+ World
19
+ | EOT
20
+ }
21
+ }
@@ -1,3 +1,6 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
1
4
  require 'puppet-lint'
2
5
 
3
6
  PuppetLint::Plugins.load_spec_helper
metadata CHANGED
@@ -1,97 +1,114 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-strict_indent-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Thorn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2019-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>'
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>'
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-its
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-collection_matchers
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: |2
84
- Extends puppet-lint to ensure that your manifests follow a strict indentation pattern.
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: " Extends puppet-lint to ensure that your manifests follow a strict
98
+ indentation pattern.\n"
85
99
  email: daniel@relud.com
86
100
  executables: []
87
101
  extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
- - README.md
91
104
  - LICENSE
105
+ - README.md
92
106
  - lib/puppet-lint/plugins/check_strict_indent.rb
93
107
  - spec/fixtures/fail/1.pp
108
+ - spec/fixtures/fail/heredoc_extra.pp
109
+ - spec/fixtures/fail/heredoc_unsuficient.pp
94
110
  - spec/fixtures/pass/1.pp
111
+ - spec/fixtures/pass/heredoc.pp
95
112
  - spec/puppet-lint/plugins/check_strict_indent_spec.rb
96
113
  - spec/spec_helper.rb
97
114
  homepage: https://github.com/relud/puppet-lint-strict_indent-check
@@ -104,22 +121,24 @@ require_paths:
104
121
  - lib
105
122
  required_ruby_version: !ruby/object:Gem::Requirement
106
123
  requirements:
107
- - - '>='
124
+ - - ">="
108
125
  - !ruby/object:Gem::Version
109
126
  version: '0'
110
127
  required_rubygems_version: !ruby/object:Gem::Requirement
111
128
  requirements:
112
- - - '>='
129
+ - - ">="
113
130
  - !ruby/object:Gem::Version
114
131
  version: '0'
115
132
  requirements: []
116
- rubyforge_project:
117
- rubygems_version: 2.0.14.1
133
+ rubygems_version: 3.0.2
118
134
  signing_key:
119
135
  specification_version: 4
120
136
  summary: puppet-lint strict indent check
121
137
  test_files:
122
- - spec/fixtures/fail/1.pp
123
138
  - spec/fixtures/pass/1.pp
124
- - spec/puppet-lint/plugins/check_strict_indent_spec.rb
139
+ - spec/fixtures/pass/heredoc.pp
140
+ - spec/fixtures/fail/1.pp
141
+ - spec/fixtures/fail/heredoc_extra.pp
142
+ - spec/fixtures/fail/heredoc_unsuficient.pp
125
143
  - spec/spec_helper.rb
144
+ - spec/puppet-lint/plugins/check_strict_indent_spec.rb