scelint 0.4.0 → 0.5.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
2
  SHA256:
3
- metadata.gz: 6a3144b8bd1796b88e9e950dbdf68ddefc0fccaca2ba823190bcc6fc22ccac34
4
- data.tar.gz: 04f59fe1645302f3af681d9f16bffb25fa70bd39430bf1e672790c22c2293ea1
3
+ metadata.gz: fc7289501df2ba7489119cef80aff1319b3d4e3ced3c7256f77db2fadb757447
4
+ data.tar.gz: 03347cf49d0b25dfe69b1b20efc9288063b3003bd9b83c73f7096468a3d19a28
5
5
  SHA512:
6
- metadata.gz: 4c4bb2b4821805154d73776022f245ea1daf5dfbdb12ab0bdd73c88f82f70236da690c5bce75e9e31208f9b7f5315f1f2f6c6a44daba90f6320de04154e5d0f6
7
- data.tar.gz: b7eeb5bb9e7258641be0a5a14f0c45c1b287e8c95255425b11306ff94b4ec6a7582ba5a6da83867ff75cd627780280a39959e022621d33c16428915fefcd3878
6
+ metadata.gz: c453ffc5c435214e2a18b36f15f79362301500185311e76c674b4b9c7c040c29ff6816df81898a5b23f0a0c94d4f8abc42dd987749310ad6a3f38def9d67c3cc
7
+ data.tar.gz: 739acfe53764dff91810874f45a87ed697ee91915aeb5ee440e6d6350da602ab5ca64b9737c755b7cfee98ede884b80c015c8df4b10a465b928a790ebad04b8e
@@ -34,7 +34,7 @@ jobs:
34
34
  name: Add issue to project
35
35
  runs-on: ubuntu-latest
36
36
  steps:
37
- - uses: actions/add-to-project@v0.5.0
37
+ - uses: actions/add-to-project@v1.0.2
38
38
  with:
39
39
  project-url: https://github.com/orgs/simp/projects/11
40
40
  github-token: ${{ secrets.AUTO_TRIAGE_TOKEN }}
@@ -13,11 +13,11 @@ jobs:
13
13
  name: 'Ruby Style'
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
- - uses: actions/checkout@v3
16
+ - uses: actions/checkout@v6
17
17
  - name: "Install Ruby"
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: 3.3
20
+ ruby-version: 4.0.1
21
21
  bundler-cache: true
22
22
  - run: bundle exec rake rubocop
23
23
 
@@ -27,12 +27,13 @@ jobs:
27
27
  strategy:
28
28
  matrix:
29
29
  ruby:
30
- - '3.2' # Puppet 8
30
+ - '3.2' # Puppet/OpenVox 8
31
31
  - '3.3'
32
- - '3.4' # Latest
32
+ - '3.4'
33
+ - '4.0' # Latest
33
34
 
34
35
  steps:
35
- - uses: actions/checkout@v3
36
+ - uses: actions/checkout@v6
36
37
  - name: Set up Ruby
37
38
  uses: ruby/setup-ruby@v1
38
39
  with:
@@ -63,7 +63,7 @@ jobs:
63
63
  steps:
64
64
  - name: "Assert '${{ github.ref }}' is a tag"
65
65
  run: '[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || { echo "::error ::GITHUB_REF is not a tag: ${GITHUB_REF}"; exit 1 ; }'
66
- - uses: actions/checkout@v3
66
+ - uses: actions/checkout@v6
67
67
  with:
68
68
  ref: ${{ github.ref }}
69
69
  clean: true
@@ -92,7 +92,7 @@ jobs:
92
92
  echo "release_command=$GEM_RELEASE_COMMAND" | tee -a "$GITHUB_OUTPUT"
93
93
  - uses: ruby/setup-ruby@v1
94
94
  with:
95
- ruby-version: 3.2
95
+ ruby-version: 4.0.1
96
96
  bundler-cache: true
97
97
  - name: Test build the package
98
98
  run: "${{ steps.commands.outputs.build_command }}"
@@ -117,7 +117,7 @@ jobs:
117
117
  tag: ${{ steps.tag-check.outputs.tag }}
118
118
  steps:
119
119
  - name: Checkout code
120
- uses: actions/checkout@v3
120
+ uses: actions/checkout@v6
121
121
  with:
122
122
  ref: ${{ github.ref }}
123
123
  clean: true
@@ -181,13 +181,13 @@ jobs:
181
181
  PKG_DIR: ${{ needs.releng-checks.outputs.pkg_dir }}
182
182
  steps:
183
183
  - name: Checkout code
184
- uses: actions/checkout@v3
184
+ uses: actions/checkout@v6
185
185
  with:
186
186
  ref: ${{ github.ref }}
187
187
  clean: true
188
188
  - uses: ruby/setup-ruby@v1
189
189
  with:
190
- ruby-version: 3.2
190
+ ruby-version: 4.0.1
191
191
  bundler-cache: true
192
192
  - name: Build RubyGem
193
193
  run: |
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 0.5.0 / 2026-03-11
2
+ * Validate parameter names
3
+ * Fix command-line argument processing
4
+
5
+ ### 0.4.1 / 2026-01-26
6
+ * Support compliance_engine 0.2.x
7
+ * Test with Ruby 4.0
8
+
1
9
  ### 0.4.0 / 2025-08-26
2
10
  * Updates for recent rubocop and plugins
3
11
  * Bump minimum required Ruby version to 3.2.0 (oldest version we're testing with)
data/Gemfile CHANGED
@@ -7,14 +7,14 @@ gem 'rake', '~> 13.3.0'
7
7
 
8
8
  group :tests do
9
9
  gem 'rspec', '~> 3.13.1'
10
- gem 'rubocop', '~> 1.80.0'
11
- gem 'rubocop-performance', '~> 1.25.0'
10
+ gem 'rubocop', '~> 1.85.0'
11
+ gem 'rubocop-performance', '~> 1.26.0'
12
12
  gem 'rubocop-rake', '~> 0.7.1'
13
- gem 'rubocop-rspec', '~> 3.6.0'
13
+ gem 'rubocop-rspec', '~> 3.9.0'
14
14
  end
15
15
 
16
16
  group :development do
17
- gem 'pry', '~> 0.15.2'
18
- gem 'pry-byebug', '~> 3.11.0'
19
- gem 'rdoc', '~> 6.14.2'
17
+ gem 'pry', '~> 0.16.0'
18
+ gem 'pry-byebug', '~> 3.12.0'
19
+ gem 'rdoc', '~> 7.2.0'
20
20
  end
data/exe/scelint CHANGED
@@ -3,4 +3,4 @@
3
3
 
4
4
  require 'scelint/cli'
5
5
 
6
- Scelint::CLI.start(['lint'] + ARGV)
6
+ Scelint::CLI.start
data/lib/scelint/cli.rb CHANGED
@@ -6,6 +6,20 @@ require 'logger'
6
6
 
7
7
  # SCELint CLI
8
8
  class Scelint::CLI < Thor
9
+ def self.exit_on_failure?
10
+ true
11
+ end
12
+
13
+ # When the first argument is not a known subcommand or an option flag,
14
+ # treat all arguments as paths for the default `lint` command.
15
+ def self.start(given_args = ARGV, config = {})
16
+ args = given_args
17
+ if args.first && !args.first.start_with?('-') && !all_commands.key?(args.first)
18
+ args = ['lint'] + args
19
+ end
20
+ super(args, config)
21
+ end
22
+
9
23
  class_option :quiet, type: :boolean, aliases: '-q', default: false
10
24
  class_option :verbose, type: :boolean, aliases: '-v', default: false
11
25
  class_option :debug, type: :boolean, aliases: '-d', default: false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Scelint
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
data/lib/scelint.rb CHANGED
@@ -396,7 +396,33 @@ module Scelint
396
396
  # @param check [String] The name of the check
397
397
  # @param parameter [String] The parameter to validate
398
398
  def check_parameter(file, check, parameter)
399
- errors << "#{file} (check '#{check}'): invalid parameter '#{parameter}'" unless parameter.is_a?(String) && !parameter.empty?
399
+ # Regular expression to match valid Puppet class parameter names
400
+ valid_parameter = %r{\A([a-z][a-z0-9_]*::)+[a-z][a-z0-9_]*\z}
401
+ # From https://www.puppet.com/docs/puppet/7/lang_reserved.html
402
+ reserved_words = ['and', 'application', 'attr', 'case', 'component', 'consumes', 'default', 'define', 'elsif',
403
+ 'environment', 'false', 'function', 'if', 'import', 'in', 'inherits', 'node',
404
+ 'or', 'private', 'produces', 'regexp', 'site', 'true', 'type', 'undef', 'unit', 'unless',
405
+ 'main', 'settings', 'init', 'any', 'array', 'binary', 'boolean', 'catalogentry', 'class',
406
+ 'collection', 'callable', 'data', 'default', 'deferred', 'enum', 'float', 'hash', 'integer',
407
+ 'notundef', 'numeric', 'optional', 'pattern', 'resource', 'regexp', 'runtime', 'scalar',
408
+ 'semver', 'semVerRange', 'sensitive', 'string', 'struct', 'timespan', 'timestamp', 'tuple',
409
+ 'type', 'undef', 'variant', 'facts', 'trusted', 'server_facts', 'title', 'name'].freeze
410
+
411
+ unless parameter.is_a?(String) && !parameter.empty?
412
+ errors << "#{file} (check '#{check}'): invalid parameter '#{parameter}'"
413
+ return
414
+ end
415
+
416
+ unless parameter.match?(valid_parameter)
417
+ errors << "#{file} (check '#{check}'): invalid parameter name '#{parameter}'"
418
+ return
419
+ end
420
+
421
+ parameter.split('::').each do |part|
422
+ if reserved_words.include?(part)
423
+ errors << "#{file} (check '#{check}'): parameter name '#{parameter}' contains reserved word '#{part}'"
424
+ end
425
+ end
400
426
  end
401
427
 
402
428
  # Check remediation
data/scelint.gemspec CHANGED
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency 'deep_merge', '~> 1.2'
28
28
  spec.add_dependency 'thor', '~> 1.3'
29
- spec.add_dependency 'compliance_engine', '~> 0.1.0'
29
+ spec.add_dependency 'compliance_engine', '>= 0.1.0', '< 0.3.0'
30
30
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scelint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Pritchard
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-08-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: deep_merge
@@ -42,17 +41,22 @@ dependencies:
42
41
  name: compliance_engine
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - "~>"
44
+ - - ">="
46
45
  - !ruby/object:Gem::Version
47
46
  version: 0.1.0
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: 0.3.0
48
50
  type: :runtime
49
51
  prerelease: false
50
52
  version_requirements: !ruby/object:Gem::Requirement
51
53
  requirements:
52
- - - "~>"
54
+ - - ">="
53
55
  - !ruby/object:Gem::Version
54
56
  version: 0.1.0
55
- description:
57
+ - - "<"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.3.0
56
60
  email:
57
61
  - simp@simp-project.org
58
62
  executables:
@@ -82,7 +86,6 @@ licenses:
82
86
  metadata:
83
87
  homepage_uri: https://github.com/simp/rubygem-simp-scelint
84
88
  source_code_uri: https://github.com/simp/rubygem-simp-scelint
85
- post_install_message:
86
89
  rdoc_options: []
87
90
  require_paths:
88
91
  - lib
@@ -97,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
100
  - !ruby/object:Gem::Version
98
101
  version: '0'
99
102
  requirements: []
100
- rubygems_version: 3.4.19
101
- signing_key:
103
+ rubygems_version: 4.0.3
102
104
  specification_version: 4
103
105
  summary: Linter SIMP Compliance Engine data
104
106
  test_files: []