scelint 0.4.1 → 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 +4 -4
- data/.github/workflows/pr_tests.yml +1 -1
- data/.github/workflows/tag_deploy_rubygem.yml +2 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -2
- data/exe/scelint +1 -1
- data/lib/scelint/cli.rb +14 -0
- data/lib/scelint/version.rb +1 -1
- data/lib/scelint.rb +27 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc7289501df2ba7489119cef80aff1319b3d4e3ced3c7256f77db2fadb757447
|
|
4
|
+
data.tar.gz: 03347cf49d0b25dfe69b1b20efc9288063b3003bd9b83c73f7096468a3d19a28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c453ffc5c435214e2a18b36f15f79362301500185311e76c674b4b9c7c040c29ff6816df81898a5b23f0a0c94d4f8abc42dd987749310ad6a3f38def9d67c3cc
|
|
7
|
+
data.tar.gz: 739acfe53764dff91810874f45a87ed697ee91915aeb5ee440e6d6350da602ab5ca64b9737c755b7cfee98ede884b80c015c8df4b10a465b928a790ebad04b8e
|
|
@@ -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: 4.0.
|
|
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 }}"
|
|
@@ -187,7 +187,7 @@ jobs:
|
|
|
187
187
|
clean: true
|
|
188
188
|
- uses: ruby/setup-ruby@v1
|
|
189
189
|
with:
|
|
190
|
-
ruby-version: 4.0.
|
|
190
|
+
ruby-version: 4.0.1
|
|
191
191
|
bundler-cache: true
|
|
192
192
|
- name: Build RubyGem
|
|
193
193
|
run: |
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -7,7 +7,7 @@ gem 'rake', '~> 13.3.0'
|
|
|
7
7
|
|
|
8
8
|
group :tests do
|
|
9
9
|
gem 'rspec', '~> 3.13.1'
|
|
10
|
-
gem 'rubocop', '~> 1.
|
|
10
|
+
gem 'rubocop', '~> 1.85.0'
|
|
11
11
|
gem 'rubocop-performance', '~> 1.26.0'
|
|
12
12
|
gem 'rubocop-rake', '~> 0.7.1'
|
|
13
13
|
gem 'rubocop-rspec', '~> 3.9.0'
|
|
@@ -16,5 +16,5 @@ end
|
|
|
16
16
|
group :development do
|
|
17
17
|
gem 'pry', '~> 0.16.0'
|
|
18
18
|
gem 'pry-byebug', '~> 3.12.0'
|
|
19
|
-
gem 'rdoc', '~> 7.
|
|
19
|
+
gem 'rdoc', '~> 7.2.0'
|
|
20
20
|
end
|
data/exe/scelint
CHANGED
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
|
data/lib/scelint/version.rb
CHANGED
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
|
-
|
|
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
|