puppet-lint-version_comparison-check 0.1.0 → 1.0.0

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
- SHA1:
3
- metadata.gz: f268cbd291c0bbfb8297dffed518b0224410cae7
4
- data.tar.gz: 85d703692cb86a74fbe4d4fe73d0c66eb836f20d
2
+ SHA256:
3
+ metadata.gz: 6bcd113ab1b2615a258c6728ec80d28c326ebffea43cd9792edd736ef0f24783
4
+ data.tar.gz: 00ff9331aa96fe9e7fb1923c0a0c8f3570399951b0ff4e49ec7c7a34a6c29572
5
5
  SHA512:
6
- metadata.gz: 7e7a1c6690bfadea8ed2b5510cd77cbb0d29699cdc2033b8908f18e8c8cb1c232f211bcbd018ed603e0133987ba9b2be3c58f0c34e33187ce3742594c7661157
7
- data.tar.gz: e61c0c2b2a12061cd46def83bcf2cfb3c1085512023d04afd5c9d889077d8153cac786fa7f8ca661e1af22ab60852fb618f638b7978ac386e6739db74e50ba03
6
+ metadata.gz: dc7130382c2365cd42df054dadd482bf18ffc753e9662cb31367cead43e37bc0dae7e95c84a47fee20a5e5fab71c001d4624be29586e397771bc4b7235d6ec8b
7
+ data.tar.gz: ce7799a7fa00c4e3178fafdf46607a74779d8c15b450ef0764fdd9b89ec0e52f8e02353647a90c4b009a9969c41c6462afffde3df2a0c61d20341eb0f8f6a336
data/README.md CHANGED
@@ -1,13 +1,30 @@
1
1
  puppet-lint-version_comparison-check
2
- =================================
2
+ ====================================
3
3
 
4
- [![Build Status](https://travis-ci.org/camptocamp/puppet-lint-version_comparison-check.svg)](https://travis-ci.org/camptocamp/puppet-lint-version_comparison-check)
5
- [![Code Climate](https://codeclimate.com/github/camptocamp/puppet-lint-version_comparison-check/badges/gpa.svg)](https://codeclimate.com/github/camptocamp/puppet-lint-version_comparison-check)
6
- [![Gem Version](https://badge.fury.io/rb/puppet-lint-version_comparison-check.svg)](http://badge.fury.io/rb/puppet-lint-version_comparison-check)
7
- [![Coverage Status](https://img.shields.io/coveralls/camptocamp/puppet-lint-version_comparison-check.svg)](https://coveralls.io/r/camptocamp/puppet-lint-version_comparison-check?branch=master)
4
+ [![License](https://img.shields.io/github/license/voxpupuli/puppet-lint-version_comparison-check.svg)](https://github.com/voxpupuli/puppet-lint-version_comparison-check/blob/master/LICENSE)
5
+ [![Test](https://github.com/voxpupuli/puppet-lint-version_comparison-check/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/puppet-lint-version_comparison-check/actions/workflows/test.yml)
6
+ [![Release](https://github.com/voxpupuli/puppet-lint-version_comparison-check/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-lint-version_comparison-check/actions/workflows/release.yml)
7
+ [![RubyGem Version](https://img.shields.io/gem/v/puppet-lint-version_comparison-check.svg)](https://rubygems.org/gems/puppet-lint-version_comparison-check)
8
+ [![RubyGem Downloads](https://img.shields.io/gem/dt/puppet-lint-version_comparison-check.svg)](https://rubygems.org/gems/puppet-lint-version_comparison-check)
9
+ [![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice)
10
+ [![codecov](https://codecov.io/gh/voxpupuli/puppet-lint-version_comparison-check/branch/master/graph/badge.svg)](https://codecov.io/gh/voxpupuli/puppet-lint-version_comparison-check)
8
11
 
9
12
  A puppet-lint plugin to check for versions compared as numbers.
10
13
 
14
+ ## Installing
15
+
16
+ ### From the command line
17
+
18
+ ```shell
19
+ $ gem install puppet-lint-version_comparison-check
20
+ ```
21
+
22
+ ### In a Gemfile
23
+
24
+ ```ruby
25
+ gem 'puppet-lint-version_comparison-check', :require => false
26
+ ```
27
+
11
28
  ## Checks
12
29
 
13
30
  ### Version compared as number
@@ -19,7 +36,7 @@ Not doing so will fail with the future parser starting with Puppet 3.7.4.
19
36
  #### What you have done
20
37
 
21
38
  ```puppet
22
- if $version >= '4' { }
39
+ if $version >= 4 { }
23
40
  ```
24
41
 
25
42
  #### What you should have done
@@ -41,3 +58,25 @@ Alternatively, if you’re calling puppet-lint via the Rake task, you should ins
41
58
  ```ruby
42
59
  PuppetLint.configuration.send('disable_version_comparison')
43
60
  ```
61
+
62
+ ## Transfer Notice
63
+
64
+ This plugin was originally authored by [Camptocamp](http://www.camptocamp.com).
65
+ The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
66
+ Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp.
67
+
68
+ Previously: https://github.com/camptocamp/puppet-lint-version_comparison-check
69
+
70
+ ## License
71
+
72
+ This gem is licensed under the Apache-2 license.
73
+
74
+ ## Release information
75
+
76
+ To make a new release, please do:
77
+ * update the version in the gemspec file
78
+ * Install gems with `bundle install --with release --path .vendor`
79
+ * generate the changelog with `bundle exec rake changelog`
80
+ * Check if the new version matches the closed issues/PRs in the changelog
81
+ * Create a PR with it
82
+ * After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages
@@ -28,11 +28,11 @@ PuppetLint.new_check(:version_comparison) do
28
28
  def fix(problem)
29
29
  versioncmp = PuppetLint::Lexer::Token.new(
30
30
  :NAME, 'versioncmp',
31
- problem[:token].line, problem[:token].column,
31
+ problem[:token].line, problem[:token].column
32
32
  )
33
33
  lparen = PuppetLint::Lexer::Token.new(
34
34
  :LPAREN, '(',
35
- problem[:token].line, problem[:token].column+1,
35
+ problem[:token].line, problem[:token].column+1
36
36
  )
37
37
  rparen = PuppetLint::Lexer::Token.new(
38
38
  :RPAREN, ')',
@@ -57,11 +57,11 @@ PuppetLint.new_check(:version_comparison) do
57
57
  value_token.value = 0
58
58
  value_token.type = :NUMBER
59
59
  # Insert ')' after value
60
- tokens.insert(idx+2, space)
61
- tokens.insert(idx+2, rparen)
60
+ tokens.insert(idx+1, rparen)
62
61
  # Insert value as string after comma
63
- tokens.insert(idx+2, value)
62
+ tokens.insert(idx+1, value)
64
63
  # Insert comma after token
64
+ tokens.insert(idx+1, space)
65
65
  tokens.insert(idx+1, comma)
66
66
  # Insert 'versioncmp(' before token
67
67
  tokens.insert(idx, lparen)
@@ -73,11 +73,12 @@ describe 'version_comparison' do
73
73
  if $version <= 1 { }
74
74
  if $some_version < 3 { }
75
75
  if $mod::params::version == 2 { }
76
+ if $::operatingsystemmajrelease<'6' { }
76
77
  EOS
77
78
  end
78
79
 
79
- it 'should detect 4 problems' do
80
- expect(problems).to have(4).problems
80
+ it 'should detect 5 problems' do
81
+ expect(problems).to have(5).problems
81
82
  end
82
83
 
83
84
  it 'should create warnings' do
@@ -85,6 +86,7 @@ describe 'version_comparison' do
85
86
  expect(problems).to contain_fixed(msg).on_line(2).in_column(12)
86
87
  expect(problems).to contain_fixed(msg).on_line(3).in_column(12)
87
88
  expect(problems).to contain_fixed(msg).on_line(4).in_column(12)
89
+ expect(problems).to contain_fixed(msg).on_line(5).in_column(12)
88
90
  end
89
91
 
90
92
  it 'should should use versioncmp' do
@@ -94,6 +96,7 @@ describe 'version_comparison' do
94
96
  if versioncmp($version, '1') <= 0 { }
95
97
  if versioncmp($some_version, '3') < 0 { }
96
98
  if versioncmp($mod::params::version, '2') == 0 { }
99
+ if versioncmp($::operatingsystemmajrelease, '6')<0 { }
97
100
  EOS
98
101
  )
99
102
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,28 @@
1
- require 'coveralls'
2
- Coveralls.wear!
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'simplecov'
5
+ require 'simplecov-console'
6
+ require 'codecov'
7
+ rescue LoadError
8
+ else
9
+ SimpleCov.start do
10
+ track_files 'lib/**/*.rb'
11
+
12
+ add_filter '/spec'
13
+
14
+ enable_coverage :branch
15
+
16
+ # do not track vendored files
17
+ add_filter '/vendor'
18
+ add_filter '/.vendor'
19
+ end
20
+
21
+ SimpleCov.formatters = [
22
+ SimpleCov::Formatter::Console,
23
+ SimpleCov::Formatter::Codecov,
24
+ ]
25
+ end
3
26
 
4
27
  require 'puppet-lint'
5
28
 
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-version_comparison-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Camptocamp
7
+ - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2021-09-17 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
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rspec
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -67,33 +73,19 @@ dependencies:
67
73
  - !ruby/object:Gem::Version
68
74
  version: '1.0'
69
75
  - !ruby/object:Gem::Dependency
70
- name: mime-types
76
+ name: simplecov
71
77
  requirement: !ruby/object:Gem::Requirement
72
78
  requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.0'
83
- - !ruby/object:Gem::Dependency
84
- name: coveralls
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
79
+ - - ">="
88
80
  - !ruby/object:Gem::Version
89
- version: '0.7'
81
+ version: '0'
90
82
  type: :development
91
83
  prerelease: false
92
84
  version_requirements: !ruby/object:Gem::Requirement
93
85
  requirements:
94
- - - "~>"
86
+ - - ">="
95
87
  - !ruby/object:Gem::Version
96
- version: '0.7'
88
+ version: '0'
97
89
  - !ruby/object:Gem::Dependency
98
90
  name: rake
99
91
  requirement: !ruby/object:Gem::Requirement
@@ -108,9 +100,8 @@ dependencies:
108
100
  - - ">="
109
101
  - !ruby/object:Gem::Version
110
102
  version: '0'
111
- description: |2
112
- A puppet-lint plugin to check for versions compared as numbers.
113
- email: raphael.pinson@camptocamp.com
103
+ description: " A puppet-lint plugin to check for versions compared as numbers.\n"
104
+ email: voxpupuli@groups.io
114
105
  executables: []
115
106
  extensions: []
116
107
  extra_rdoc_files: []
@@ -120,7 +111,7 @@ files:
120
111
  - lib/puppet-lint/plugins/check_version_comparison.rb
121
112
  - spec/puppet-lint/plugins/check_version_comparison/version_comparison_spec.rb
122
113
  - spec/spec_helper.rb
123
- homepage: https://github.com/camptocamp/puppet-lint-version_comparison-check
114
+ homepage: https://github.com/voxpupuli/puppet-lint-version_comparison-check
124
115
  licenses:
125
116
  - Apache-2.0
126
117
  metadata: {}
@@ -139,11 +130,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
130
  - !ruby/object:Gem::Version
140
131
  version: '0'
141
132
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.2.2
133
+ rubygems_version: 3.2.22
144
134
  signing_key:
145
135
  specification_version: 4
146
136
  summary: A puppet-lint plugin to check for versions compared as numbers.
147
137
  test_files:
148
- - spec/spec_helper.rb
149
138
  - spec/puppet-lint/plugins/check_version_comparison/version_comparison_spec.rb
139
+ - spec/spec_helper.rb