kafo_module_lint 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e95e511f9b75a6c8e88f407a5ae3dc6f34bc49c
|
4
|
+
data.tar.gz: 5674891c5698c9be89b5f392bf64d1f67a7f4ed4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b91ec3fe9bb3d4fd39271d96c9f628e47ef4ef3d5a61c2b6611fa3085407d3c67c0653c4446a119fe45dc1a9f21740b28346d54f9758f2bc59324a1fada4a14b
|
7
|
+
data.tar.gz: 66b0f4838a7b9c2d66477767ebb45fc2ddba43d8b01a7a52c1df5b5ad59a3711b0a6f68f74b2c5886865918d4a427f7854e9a89ff2d4bf6a0ce37c4ede1d6b1f
|
data/bin/kafo-module-lint
CHANGED
@@ -19,7 +19,7 @@ files = ARGV.empty? ? Dir['manifests/**/*.pp'] : ARGV
|
|
19
19
|
|
20
20
|
result = true
|
21
21
|
KafoModuleLint::TypeLoader.new(options[:modulepath]).with_types do
|
22
|
-
files.
|
22
|
+
files.each do |manifest|
|
23
23
|
puts "Checking #{manifest}" if options[:verbose]
|
24
24
|
linter = KafoModuleLint::Linter.new(manifest)
|
25
25
|
result = false unless linter.pass?
|
@@ -7,11 +7,11 @@ module KafoModuleLint
|
|
7
7
|
attr_reader :path
|
8
8
|
|
9
9
|
def initialize(path)
|
10
|
-
@path = path
|
10
|
+
@path = File.expand_path(path)
|
11
11
|
end
|
12
12
|
|
13
13
|
def pass?
|
14
|
-
errors.empty?
|
14
|
+
skip? || errors.empty?
|
15
15
|
end
|
16
16
|
|
17
17
|
def errors
|
@@ -19,7 +19,7 @@ module KafoModuleLint
|
|
19
19
|
errors = []
|
20
20
|
parsed[:types].each do |param,type|
|
21
21
|
check_param(param, type, errors)
|
22
|
-
end
|
22
|
+
end unless skip?
|
23
23
|
errors
|
24
24
|
end
|
25
25
|
end
|
@@ -48,5 +48,10 @@ module KafoModuleLint
|
|
48
48
|
false
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
def skip?
|
53
|
+
# kafo_parsers doesn't support 3.x future parser
|
54
|
+
ENV['FUTURE_PARSER'] == 'yes'
|
55
|
+
end
|
51
56
|
end
|
52
57
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
require 'pathname'
|
2
3
|
|
3
4
|
module KafoModuleLint
|
4
5
|
describe 'kafo-module-lint' do
|
@@ -33,5 +34,13 @@ module KafoModuleLint
|
|
33
34
|
specify { stdout.must_equal (error + $/) }
|
34
35
|
specify { stderr.must_equal '' }
|
35
36
|
end
|
37
|
+
|
38
|
+
describe "with relative path" do
|
39
|
+
let(:manifest) { ManifestFactory.build({}) }
|
40
|
+
let(:manifest_file) do
|
41
|
+
Pathname.new(ManifestFileFactory.build(manifest).path).relative_path_from(Pathname.new(Dir.pwd)).to_s
|
42
|
+
end
|
43
|
+
specify { exit_code.success?.must_equal true }
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'kafo_module_lint/linter'
|
3
|
+
require 'pathname'
|
3
4
|
|
4
5
|
module KafoModuleLint
|
5
6
|
describe Linter do
|
@@ -27,5 +28,23 @@ module KafoModuleLint
|
|
27
28
|
specify { linter.errors.must_equal [error] }
|
28
29
|
specify { proc { linter.puts_errors }.must_output (error + $/) }
|
29
30
|
end
|
31
|
+
|
32
|
+
describe "with relative path" do
|
33
|
+
let(:manifest) { ManifestFactory.build({}) }
|
34
|
+
let(:manifest_file) do
|
35
|
+
Pathname.new(ManifestFileFactory.build(manifest).path).relative_path_from(Pathname.new(Dir.pwd)).to_s
|
36
|
+
end
|
37
|
+
specify { linter.pass?.must_equal true }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "with future parser" do
|
41
|
+
let(:manifest) { ManifestFactory.build({'a' => 'String', 'b' => 'Unknown[String]'}) }
|
42
|
+
before { ENV['FUTURE_PARSER'] = 'yes' }
|
43
|
+
after { ENV.delete('FUTURE_PARSER') }
|
44
|
+
|
45
|
+
specify { linter.pass?.must_equal true }
|
46
|
+
specify { linter.errors.must_equal [] }
|
47
|
+
specify { proc { linter.puts_errors }.must_output nil }
|
48
|
+
end
|
30
49
|
end
|
31
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kafo_module_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominic Cleal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.6.8
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Validate Puppet modules are correctly documented for Kafo
|