metadata-json-lint 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +44 -0
- data/lib/metadata-json-lint/rake_task.rb +3 -1
- data/lib/metadata_json_lint.rb +5 -6
- data/metadata-json-lint.gemspec +1 -1
- data/tests/bad_license/metadata.json +1 -1
- data/tests/json_format/expected +1 -1
- data/tests/json_format/metadata.json +1 -1
- data/tests/rake_chaining/Rakefile +7 -0
- data/tests/rake_chaining/metadata.json +91 -0
- data/tests/test.sh +11 -3
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e405de9a698335b307d33abbf151c898a9cde8ff
|
4
|
+
data.tar.gz: 6d63faf1798bbe981406d5792a06845d5ecee2f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7871b687d36c40ee1519866af02a3fbf603e20b3fe163599ef9b153d235f1db4a58ffbfd06cee090048ec943d2c6afd1da12af72de24eda00aac90323db47b0a
|
7
|
+
data.tar.gz: 59c178ba9192e930789cb239304e81223eb781501f75a2cc2ae49dde805d933ce86e76cd94d7640bff5519c3d983dc95f8e2e090dfc6556d7c91ed2bb70edf76
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
|
+
|
8
|
+
## 1.2.2
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
* Fix `metadata_lint` rake task exiting on success, not continuing ([#70](https://github.com/voxpupuli/metadata-json-lint/issues/70))
|
12
|
+
* Fix failure on incorrect license warning when `--no-strict-license` used ([#69](https://github.com/voxpupuli/metadata-json-lint/issues/69))
|
13
|
+
|
14
|
+
## 1.2.1
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
* Fix missing lib/ files in published gem
|
18
|
+
|
19
|
+
## 1.2.0
|
20
|
+
|
21
|
+
### Added
|
22
|
+
* Add `--format`/`-f` option to support a JSON output format
|
23
|
+
* Add warning for mixed version range syntax, supported only in Puppet 5
|
24
|
+
|
25
|
+
### Changed
|
26
|
+
* The default text format mode now outputs more structured messages
|
27
|
+
* README has been edited and clarity improved
|
28
|
+
|
29
|
+
### Fixed
|
30
|
+
* Fix non-zero exit code caused by some checks
|
31
|
+
|
32
|
+
## 1.1.0
|
33
|
+
|
34
|
+
### Added
|
35
|
+
* Ensure module `tags` are correctly specified as an array ([#44](https://github.com/voxpupuli/metadata-json-lint/issues/44))
|
36
|
+
* Ensure `requirements` doesn't list the deprecated `pe` key ([#46](https://github.com/voxpupuli/metadata-json-lint/issues/46))
|
37
|
+
* Ensure `dependencies` aren't listed with `version_range` keys ([#47](https://github.com/voxpupuli/metadata-json-lint/issues/47))
|
38
|
+
* Support strictness configuration via Ruby API, for use in rake tasks definitions
|
39
|
+
* Show default strictness option values in `--help` output
|
40
|
+
|
41
|
+
### Fixed
|
42
|
+
* Fix unclear error message when metadata.json does not exist
|
43
|
+
* Fix gem publishing date
|
44
|
+
* Various test improvements, ensuring failures are caught accurately and precisely
|
data/lib/metadata_json_lint.rb
CHANGED
@@ -51,7 +51,7 @@ module MetadataJsonLint
|
|
51
51
|
ARGV[0]
|
52
52
|
end
|
53
53
|
|
54
|
-
MetadataJsonLint.parse(mj)
|
54
|
+
exit(MetadataJsonLint.parse(mj) ? 0 : 1)
|
55
55
|
end
|
56
56
|
module_function :run
|
57
57
|
|
@@ -108,10 +108,9 @@ module MetadataJsonLint
|
|
108
108
|
# Shoulds/recommendations
|
109
109
|
# From: https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html#write-a-metadatajson-file
|
110
110
|
#
|
111
|
-
if !parsed['license'].nil? && !SpdxLicenses.exist?(parsed['license']) && parsed['license'] != 'proprietary'
|
111
|
+
if options[:strict_license] && !parsed['license'].nil? && !SpdxLicenses.exist?(parsed['license']) && parsed['license'] != 'proprietary'
|
112
112
|
msg = "License identifier #{parsed['license']} is not in the SPDX list: http://spdx.org/licenses/"
|
113
|
-
|
114
|
-
options[:strict_license] == true ? error(:license, msg) : warn(:license, msg)
|
113
|
+
warn(:license, msg)
|
115
114
|
end
|
116
115
|
|
117
116
|
if !parsed['tags'].nil? && !parsed['tags'].is_a?(Array)
|
@@ -131,11 +130,11 @@ module MetadataJsonLint
|
|
131
130
|
end
|
132
131
|
|
133
132
|
if !@errors.empty? || (!@warnings.empty? && (options[:fail_on_warnings] == true))
|
134
|
-
|
133
|
+
return false
|
135
134
|
end
|
136
135
|
end
|
137
136
|
|
138
|
-
|
137
|
+
true
|
139
138
|
end
|
140
139
|
module_function :parse
|
141
140
|
|
data/metadata-json-lint.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'date'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'metadata-json-lint'
|
5
|
-
s.version = '1.2.
|
5
|
+
s.version = '1.2.2'
|
6
6
|
s.date = Date.today.to_s
|
7
7
|
s.summary = 'metadata-json-lint /path/to/metadata.json'
|
8
8
|
s.description = 'Utility to verify Puppet metadata.json files'
|
data/tests/json_format/expected
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"
|
1
|
+
"warnings":\[{"check":"license","msg":"License identifier Unknown-1.0 is not in the SPDX list: http://spdx.org/licenses/"}\]
|
@@ -0,0 +1,91 @@
|
|
1
|
+
{
|
2
|
+
"name": "puppetlabs-postgresql",
|
3
|
+
"version": "3.4.1",
|
4
|
+
"author": "Inkling/Puppet Labs",
|
5
|
+
"summary": "PostgreSQL defined resource types",
|
6
|
+
"license": "Apache-2.0",
|
7
|
+
"source": "git://github.com/puppetlabs/puppet-postgresql.git",
|
8
|
+
"project_page": "https://github.com/puppetlabs/puppet-postgresql",
|
9
|
+
"issues_url": "https://github.com/puppetlabs/puppet-postgresql/issues",
|
10
|
+
"operatingsystem_support": [
|
11
|
+
{
|
12
|
+
"operatingsystem": "RedHat",
|
13
|
+
"operatingsystemrelease": [
|
14
|
+
"5",
|
15
|
+
"6",
|
16
|
+
"7"
|
17
|
+
]
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"operatingsystem": "CentOS",
|
21
|
+
"operatingsystemrelease": [
|
22
|
+
"5",
|
23
|
+
"6",
|
24
|
+
"7"
|
25
|
+
]
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"operatingsystem": "OracleLinux",
|
29
|
+
"operatingsystemrelease": [
|
30
|
+
"5",
|
31
|
+
"6",
|
32
|
+
"7"
|
33
|
+
]
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"operatingsystem": "Scientific",
|
37
|
+
"operatingsystemrelease": [
|
38
|
+
"5",
|
39
|
+
"6",
|
40
|
+
"7"
|
41
|
+
]
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"operatingsystem": "Debian",
|
45
|
+
"operatingsystemrelease": [
|
46
|
+
"6",
|
47
|
+
"7"
|
48
|
+
]
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"operatingsystem": "Ubuntu",
|
52
|
+
"operatingsystemrelease": [
|
53
|
+
"10.04",
|
54
|
+
"12.04",
|
55
|
+
"14.04"
|
56
|
+
]
|
57
|
+
}
|
58
|
+
],
|
59
|
+
"requirements": [
|
60
|
+
{
|
61
|
+
"name": "puppet",
|
62
|
+
"version_requirement": "3.x"
|
63
|
+
}
|
64
|
+
],
|
65
|
+
"dependencies": [
|
66
|
+
{
|
67
|
+
"name": "puppetlabs/stdlib",
|
68
|
+
"version_requirement": "1.2.3"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"name": "puppetlabs/apt",
|
72
|
+
"version_requirement": "< 1.2.3"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"name": "puppetlabs/puppetdb",
|
76
|
+
"version_requirement": "<= 1.2.3"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"name": "puppetlabs/vcsrepo",
|
80
|
+
"version_requirement": ">= 1.0.0 < 2.0.0"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"name": "puppetlabs/rabbitmq",
|
84
|
+
"version_requirement": "1.x"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"name": "puppetlabs/motd",
|
88
|
+
"version_requirement": "1.2.x"
|
89
|
+
}
|
90
|
+
]
|
91
|
+
}
|
data/tests/test.sh
CHANGED
@@ -66,7 +66,7 @@ test_rake() {
|
|
66
66
|
local RESULT=-1;
|
67
67
|
|
68
68
|
cd $name;
|
69
|
-
bundle exec rake $rake_task
|
69
|
+
bundle exec rake $rake_task >last_rake_output 2>&1
|
70
70
|
RESULT=$?
|
71
71
|
if [ $RESULT -ne $expect ]; then
|
72
72
|
fail "Failing Test '${name}' (rake: ${rake_task})"
|
@@ -98,8 +98,10 @@ test "duplicate-dep" $SUCCESS --no-fail-on-warnings
|
|
98
98
|
|
99
99
|
# Run a broken one, expect FAILURE
|
100
100
|
test "bad_license" $FAILURE
|
101
|
-
# Run with --no-strict-license, expect SUCCESS
|
102
|
-
test "bad_license" $SUCCESS --no-strict-license
|
101
|
+
# Run with --no-strict-license only, expect SUCCESS
|
102
|
+
test "bad_license" $SUCCESS --no-strict-license
|
103
|
+
# Run with --no-fail-on-warnings, expect SUCCESS
|
104
|
+
test "bad_license" $SUCCESS --no-fail-on-warnings
|
103
105
|
|
104
106
|
# Run a broken one, expect FAILURE
|
105
107
|
test "long_summary" $FAILURE
|
@@ -154,4 +156,10 @@ test_rake "rake_global_options" $SUCCESS
|
|
154
156
|
# Test multiple lints with different options
|
155
157
|
test_rake "rake_multiple_json_options" $SUCCESS metadata_lint_multi
|
156
158
|
|
159
|
+
# Test successful lint followed by further tasks
|
160
|
+
test_rake "rake_chaining" $SUCCESS test
|
161
|
+
if ! grep -qx "Successfully linted" rake_chaining/last_rake_output; then
|
162
|
+
fail "Failing Test 'rake_chaining' failed to run second rake task"
|
163
|
+
fi
|
164
|
+
|
157
165
|
exit $STATUS
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metadata-json-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vox Pupuli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spdx-licenses
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- ".rubocop.yml"
|
113
113
|
- ".rubocop_todo.yml"
|
114
114
|
- ".travis.yml"
|
115
|
+
- CHANGELOG.md
|
115
116
|
- Gemfile
|
116
117
|
- LICENSE
|
117
118
|
- README.md
|
@@ -165,6 +166,8 @@ files:
|
|
165
166
|
- tests/perfect/metadata.json
|
166
167
|
- tests/proprietary/Rakefile
|
167
168
|
- tests/proprietary/metadata.json
|
169
|
+
- tests/rake_chaining/Rakefile
|
170
|
+
- tests/rake_chaining/metadata.json
|
168
171
|
- tests/rake_global_options/Rakefile
|
169
172
|
- tests/rake_global_options/expected
|
170
173
|
- tests/rake_global_options/metadata.json
|
@@ -249,6 +252,8 @@ test_files:
|
|
249
252
|
- tests/perfect/metadata.json
|
250
253
|
- tests/proprietary/Rakefile
|
251
254
|
- tests/proprietary/metadata.json
|
255
|
+
- tests/rake_chaining/Rakefile
|
256
|
+
- tests/rake_chaining/metadata.json
|
252
257
|
- tests/rake_global_options/Rakefile
|
253
258
|
- tests/rake_global_options/expected
|
254
259
|
- tests/rake_global_options/metadata.json
|