metadata-json-lint 2.2.0 → 2.3.0

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
  SHA256:
3
- metadata.gz: 18ae05b2da0e3412d155e0ef98619401e66103b491592d0bf39662ef779ff510
4
- data.tar.gz: 1e072d693b6a7f3f1f819b81584a0766da507a18526195d7111617fcd1404cfd
3
+ metadata.gz: 2e2f55149a6287836431cd28e8cf6203eca183ea091f8f96548c25d986d4dc8f
4
+ data.tar.gz: bd4f45e60c82c71fe1a5f6ff14e0ab226e29ed2e8fc56bf77cd2779baddaf2ca
5
5
  SHA512:
6
- metadata.gz: a6e20d329944205d3e8c24cc86176feca9a94609dfba8aabce7bf92c1529518ca51b6d24ef874df397b49f8e8769df3694f41983696a316b0cb1f06b8721c371
7
- data.tar.gz: cbf678ed70b94343ea6f123104bbc8471888b32c65fa4b40e7189adce53d679d879c4a1393afe11f8a5968622c83b331ab862a08583c862b188ac03dfc689ed3
6
+ metadata.gz: cb58fb3b7472f1d2ec6b432cafd16b32c83163369e84d6c596cacd46cb42de41424abfe9634fee6c429be2ca8445463d585d3bef7a2c1986fe83fe7f6f132c42
7
+ data.tar.gz: dc6b2d9873836cec6147306d415d799915b4162c37f397c14d4f0ea9df7fcd5282ff8afaadf14df6f09320f73836ef98802c44018ca26d0dcc38ee274e68757c
@@ -26,4 +26,4 @@ Metrics/PerceivedComplexity:
26
26
  Enabled: false
27
27
 
28
28
  Metrics/ModuleLength:
29
- Max: 175
29
+ Max: 185
@@ -5,13 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
+ ## 2.3.0
9
+
10
+ * Add duplicate testing in requirements list
11
+ * Fix wrong license file content so GitHub can properly detect it
12
+ * Fix a typo in the README.md
13
+
8
14
  ## 2.2.0
15
+
9
16
  * Validate Puppet version_requirement [#99](https://github.com/voxpupuli/metadata-json-lint/issues/99)
10
17
  * Add optional check `--strict-puppet-version` to validate the Puppet Agent Version is not EOL or open ended [#100](https://github.com/voxpupuli/metadata-json-lint/pull/100)
11
18
 
12
19
  ## 2.1.0
13
20
 
14
21
  ### Changes
22
+
15
23
  * Improve rendering of post\_install message by trimming unnecessary leading
16
24
  spaces [#89](https://github.com/voxpupuli/metadata-json-lint/pull/89)
17
25
  * Fail when checking version requirements if the version range is empty
@@ -20,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
20
28
  [#93](https://github.com/voxpupuli/metadata-json-lint/pull/93)
21
29
 
22
30
  ### Fixed
31
+
23
32
  * Prevent metadata-json-lint from crashing when the `requirements` field does
24
33
  not contain an array
25
34
  [#94](https://github.com/voxpupuli/metadata-json-lint/pull/94)
@@ -30,15 +39,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
30
39
  ## 2.0.2
31
40
 
32
41
  ### Changes
42
+
33
43
  * Make SemanticPuppet completely optional and remove dependency on Puppet [#86](https://github.com/voxpupuli/metadata-json-lint/pull/86)
34
44
  * Only log open dependency warning with --strict-dependencies [#78](https://github.com/voxpupuli/metadata-json-lint/pull/78)
35
45
 
36
46
  ### Fixed
47
+
37
48
  * Fix readme for gemfile usage [#84](https://github.com/voxpupuli/metadata-json-lint/pull/84)
38
49
 
39
50
  ## 2.0.1
40
51
 
41
52
  ### Changes
53
+
42
54
  * Puppet 4.9.0 and newer uses the vendored `semantic_puppet` packaged with Puppet.
43
55
  * If using Puppet 4.8.x and earlier, adding `semantic_puppet` to your Gemfile is required
44
56
  as the vendored `semantic_puppet` was not packaged with Puppet prior to `4.9.0`
@@ -47,40 +59,48 @@ as the vendored `semantic_puppet` was not packaged with Puppet prior to `4.9.0`
47
59
  ## 2.0.0
48
60
 
49
61
  ### Changes
62
+
50
63
  * The `semantic_puppet` gem is no longer included as a runtime dependency due to conflicts with Puppet 5.x libraries that break the `puppet module` command. As such, `semantic_puppet` must be added to a user's Gemfile in Puppet <= 4.x. See [Installation](https://github.com/voxpupuli/metadata-json-lint#installation) docs for more info
51
64
  * `metadata-json-lint` now officially only supports Ruby >= 2.0.0
52
65
 
53
66
  ### Fixed
67
+
54
68
  * Fix puppet 5.x `semantic_puppet` conflicts ([#79](https://github.com/voxpupuli/metadata-json-lint/issues/79))
55
69
  * Clarify Ruby >= 2.x only support ([#74](https://github.com/voxpupuli/metadata-json-lint/issues/74))
56
70
 
57
71
  ## 1.2.2
58
72
 
59
73
  ### Fixed
74
+
60
75
  * Fix `metadata_lint` rake task exiting on success, not continuing ([#70](https://github.com/voxpupuli/metadata-json-lint/issues/70))
61
76
  * Fix failure on incorrect license warning when `--no-strict-license` used ([#69](https://github.com/voxpupuli/metadata-json-lint/issues/69))
62
77
 
63
78
  ## 1.2.1
64
79
 
65
80
  ### Fixed
81
+
66
82
  * Fix missing lib/ files in published gem
67
83
 
68
84
  ## 1.2.0
69
85
 
70
86
  ### Added
87
+
71
88
  * Add `--format`/`-f` option to support a JSON output format
72
89
  * Add warning for mixed version range syntax, supported only in Puppet 5
73
90
 
74
91
  ### Changed
92
+
75
93
  * The default text format mode now outputs more structured messages
76
94
  * README has been edited and clarity improved
77
95
 
78
96
  ### Fixed
97
+
79
98
  * Fix non-zero exit code caused by some checks
80
99
 
81
100
  ## 1.1.0
82
101
 
83
102
  ### Added
103
+
84
104
  * Ensure module `tags` are correctly specified as an array ([#44](https://github.com/voxpupuli/metadata-json-lint/issues/44))
85
105
  * Ensure `requirements` doesn't list the deprecated `pe` key ([#46](https://github.com/voxpupuli/metadata-json-lint/issues/46))
86
106
  * Ensure `dependencies` aren't listed with `version_range` keys ([#47](https://github.com/voxpupuli/metadata-json-lint/issues/47))
@@ -88,6 +108,7 @@ as the vendored `semantic_puppet` was not packaged with Puppet prior to `4.9.0`
88
108
  * Show default strictness option values in `--help` output
89
109
 
90
110
  ### Fixed
111
+
91
112
  * Fix unclear error message when metadata.json does not exist
92
113
  * Fix gem publishing date
93
114
  * Various test improvements, ensuring failures are caught accurately and precisely
data/LICENSE CHANGED
@@ -1,13 +1,178 @@
1
1
  Copyright 2014 HP Development Corporation L.P.
2
2
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this software except in compliance with the License.
5
- You may obtain a copy of the License at
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
6
 
7
- http://www.apache.org/licenses/LICENSE-2.0
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
8
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
data/README.md CHANGED
@@ -41,7 +41,7 @@ rake metadata_lint
41
41
  To set options for the Rake task, include them when you define the task:
42
42
 
43
43
  ```ruby
44
- require 'metadata-json-lint'
44
+ require 'metadata_json_lint'
45
45
  task :metadata_lint do
46
46
  MetadataJsonLint.parse('metadata.json') do |options|
47
47
  options.strict_license = false
@@ -137,6 +137,18 @@ module MetadataJsonLint
137
137
  end
138
138
  module_function :parse
139
139
 
140
+ def validate_requirements_unique(requirements)
141
+ names = requirements.map { |x| x['name'] }
142
+ counts = Hash.new(0)
143
+
144
+ names.each { |name| counts[name.downcase] += 1 }
145
+
146
+ counts.each do |k, v|
147
+ error :requirements, "Duplicate entries in the 'requirements' list with the name '#{k}'" if v > 1
148
+ end
149
+ end
150
+ module_function :validate_requirements_unique
151
+
140
152
  def validate_requirements!(requirements)
141
153
  return unless requirements.is_a?(Array)
142
154
 
@@ -154,6 +166,8 @@ module MetadataJsonLint
154
166
 
155
167
  validate_puppet_ver!(puppet_req) unless puppet_req.instance_variable_get('@requirement').nil?
156
168
  end
169
+
170
+ validate_requirements_unique(requirements)
157
171
  end
158
172
  module_function :validate_requirements!
159
173
 
@@ -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 = '2.2.0'
5
+ s.version = '2.3.0'
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'
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__))
2
+ require 'metadata-json-lint/rake_task'
@@ -0,0 +1 @@
1
+ Duplicate entries in the 'requirements' list with the name 'puppet'
@@ -0,0 +1,87 @@
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": "5.5.1"
63
+ },
64
+ {
65
+ "name": "puppet",
66
+ "version_requirement": "6.11.0"
67
+ }
68
+ ],
69
+ "dependencies": [
70
+ {
71
+ "name": "puppetlabs/stdlib",
72
+ "version_requirement": "4.x"
73
+ },
74
+ {
75
+ "name": "puppetlabs/firewall",
76
+ "version_requirement": ">= 0.0.4"
77
+ },
78
+ {
79
+ "name": "puppetlabs/apt",
80
+ "version_requirement": ">=1.1.0 <2.0.0"
81
+ },
82
+ {
83
+ "name": "puppetlabs/concat",
84
+ "version_requirement": ">= 1.1.0 <2.0.0"
85
+ }
86
+ ]
87
+ }
@@ -147,6 +147,9 @@ test "non_array_requirements" $FAILURE
147
147
  # Run against a metadata.json with an unsupported minimum Puppet version for the requirements
148
148
  test "requirements_eol_version" $FAILURE --strict-puppet-version
149
149
 
150
+ # Run a broken one, expect FAILURE
151
+ test "duplicate-requirement" $FAILURE
152
+
150
153
  # Test running without specifying file to parse
151
154
  cd perfect
152
155
  bundle exec metadata-json-lint
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: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-26 00:00:00.000000000 Z
11
+ date: 2020-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spdx-licenses
@@ -145,6 +145,9 @@ files:
145
145
  - tests/duplicate-dep/Rakefile
146
146
  - tests/duplicate-dep/expected
147
147
  - tests/duplicate-dep/metadata.json
148
+ - tests/duplicate-requirement/Rakefile
149
+ - tests/duplicate-requirement/expected
150
+ - tests/duplicate-requirement/metadata.json
148
151
  - tests/json_format/Rakefile
149
152
  - tests/json_format/expected
150
153
  - tests/json_format/metadata.json
@@ -245,6 +248,9 @@ test_files:
245
248
  - tests/duplicate-dep/Rakefile
246
249
  - tests/duplicate-dep/expected
247
250
  - tests/duplicate-dep/metadata.json
251
+ - tests/duplicate-requirement/Rakefile
252
+ - tests/duplicate-requirement/expected
253
+ - tests/duplicate-requirement/metadata.json
248
254
  - tests/json_format/Rakefile
249
255
  - tests/json_format/expected
250
256
  - tests/json_format/metadata.json