openvox-lint 1.3.2 → 1.3.4
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/CHANGELOG.md +43 -1
- data/DOCUMENTATION.md +77 -27
- data/README.md +76 -27
- data/docs/ARCHITECTURE_REVIEW.md +229 -0
- data/lib/openvox-lint/check_plugin.rb +10 -12
- data/lib/openvox-lint/checks.rb +1 -1
- data/lib/openvox-lint/cli.rb +86 -14
- data/lib/openvox-lint/configuration.rb +28 -2
- data/lib/openvox-lint/lexer.rb +25 -8
- data/lib/openvox-lint/linter.rb +55 -4
- data/lib/openvox-lint/plugins/checks/arrow_alignment.rb +1 -1
- data/lib/openvox-lint/plugins/checks/autoloader_layout.rb +1 -1
- data/lib/openvox-lint/plugins/checks/space_before_arrow.rb +1 -1
- data/lib/openvox-lint/plugins/checks/trailing_comma.rb +1 -1
- data/lib/openvox-lint/plugins/checks/variable_is_lowercase.rb +1 -1
- data/lib/openvox-lint/report.rb +51 -3
- data/lib/openvox-lint/version.rb +1 -1
- data/lib/openvox-lint.rb +1 -1
- metadata +9 -6
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Resource bodies and parameter lists should end with a trailing comma.
|
|
4
4
|
#
|
|
5
|
-
# Only fires inside resource bodies (NAME { ... }) — not inside
|
|
5
|
+
# Only fires inside resource bodies (NAME or CLASSREF { ... }) — not inside
|
|
6
6
|
# conditionals (if/unless/case), class bodies, or other brace contexts
|
|
7
7
|
# where a trailing comma is not expected.
|
|
8
8
|
OpenvoxLint.new_check(:trailing_comma) do
|
|
@@ -5,7 +5,7 @@ OpenvoxLint.new_check(:variable_is_lowercase) do
|
|
|
5
5
|
def check
|
|
6
6
|
tokens.each do |tok|
|
|
7
7
|
next unless tok.type == :VARIABLE
|
|
8
|
-
name = tok.value.sub(
|
|
8
|
+
name = tok.value.sub(/^\$:*/, '')
|
|
9
9
|
next if name =~ /\A[a-z_][a-z0-9_:]*\z/ || name.empty?
|
|
10
10
|
notify :warning,
|
|
11
11
|
message: "variable '#{tok.value}' contains uppercase characters",
|
data/lib/openvox-lint/report.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
|
+
require 'pathname'
|
|
4
5
|
|
|
5
6
|
module OpenvoxLint
|
|
6
7
|
# Formats and outputs lint problems in the requested format.
|
|
@@ -12,6 +13,7 @@ module OpenvoxLint
|
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def format(problems, io: $stdout)
|
|
16
|
+
problems = with_display_paths(problems)
|
|
15
17
|
case @config.log_format
|
|
16
18
|
when 'json' then format_json(problems, io)
|
|
17
19
|
when 'csv' then format_csv(problems, io)
|
|
@@ -42,15 +44,25 @@ module OpenvoxLint
|
|
|
42
44
|
def format_csv(problems, io)
|
|
43
45
|
io.puts 'path,line,column,kind,check,message'
|
|
44
46
|
problems.each do |p|
|
|
45
|
-
io.puts [
|
|
46
|
-
|
|
47
|
+
io.puts [
|
|
48
|
+
csv_escape(p[:path]),
|
|
49
|
+
csv_escape(p[:line]),
|
|
50
|
+
csv_escape(p[:column]),
|
|
51
|
+
csv_escape(p[:kind]),
|
|
52
|
+
csv_escape(p[:check]),
|
|
53
|
+
csv_escape(p[:message]),
|
|
54
|
+
].join(',')
|
|
47
55
|
end
|
|
48
56
|
end
|
|
49
57
|
|
|
50
58
|
def format_github(problems, io)
|
|
51
59
|
problems.each do |p|
|
|
52
60
|
kind = p[:kind] == :error ? 'error' : 'warning'
|
|
53
|
-
|
|
61
|
+
file = github_escape_property(p[:path])
|
|
62
|
+
line = github_escape_property(p[:line])
|
|
63
|
+
col = github_escape_property(p[:column])
|
|
64
|
+
message = github_escape_data("#{p[:check]}: #{p[:message]}")
|
|
65
|
+
io.puts "::#{kind} file=#{file},line=#{line},col=#{col}::#{message}"
|
|
54
66
|
end
|
|
55
67
|
end
|
|
56
68
|
|
|
@@ -82,5 +94,41 @@ module OpenvoxLint
|
|
|
82
94
|
{ path: p[:path], line: p[:line], column: p[:column],
|
|
83
95
|
kind: p[:kind].to_s, check: p[:check].to_s, message: p[:message] }
|
|
84
96
|
end
|
|
97
|
+
|
|
98
|
+
# GitHub workflow-command escaping:
|
|
99
|
+
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message
|
|
100
|
+
# Encode '%' first so attacker-supplied %0A/%0D cannot decode back to newlines.
|
|
101
|
+
def github_escape_data(value)
|
|
102
|
+
value.to_s.gsub('%', '%25').gsub("\r", '%0D').gsub("\n", '%0A').gsub('::', '%3A%3A')
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def github_escape_property(value)
|
|
106
|
+
github_escape_data(value).gsub(':', '%3A').gsub(',', '%2C')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def csv_escape(value)
|
|
110
|
+
s = value.to_s
|
|
111
|
+
if s.match?(/[",\r\n]/)
|
|
112
|
+
%("#{s.gsub('"', '""')}")
|
|
113
|
+
else
|
|
114
|
+
s
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# When --relative is set, emit paths relative to Dir.pwd.
|
|
119
|
+
# Problems hashes are not mutated.
|
|
120
|
+
def with_display_paths(problems)
|
|
121
|
+
return problems unless @config.relative
|
|
122
|
+
problems.map { |p| p.merge(path: display_path(p[:path])) }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def display_path(path)
|
|
126
|
+
return path if path.nil? || path.to_s.empty?
|
|
127
|
+
Pathname.new(File.expand_path(path.to_s)).relative_path_from(
|
|
128
|
+
Pathname.new(File.expand_path(Dir.pwd))
|
|
129
|
+
).to_s
|
|
130
|
+
rescue ArgumentError
|
|
131
|
+
path
|
|
132
|
+
end
|
|
85
133
|
end
|
|
86
134
|
end
|
data/lib/openvox-lint/version.rb
CHANGED
data/lib/openvox-lint.rb
CHANGED
|
@@ -42,7 +42,7 @@ module OpenvoxLint
|
|
|
42
42
|
|
|
43
43
|
def new_check(name, &block)
|
|
44
44
|
if checks.key?(name)
|
|
45
|
-
$stderr.puts "openvox-lint: warning: check '#{name}' is already registered — overwriting"
|
|
45
|
+
$stderr.puts "openvox-lint: warning: check '#{name}' is already registered — overwriting"
|
|
46
46
|
end
|
|
47
47
|
klass = Class.new(CheckPlugin, &block)
|
|
48
48
|
klass.instance_variable_set(:@check_name, name)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openvox-lint
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jerald Sheets
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -57,10 +57,12 @@ description: |
|
|
|
57
57
|
It checks your .pp files against the OpenVox Language Style Guide (the
|
|
58
58
|
current canonical reference) and catches common errors, deprecated patterns
|
|
59
59
|
(legacy facts, Hiera 3, import, etc.), strict-mode issues, and Puppet 8+ /
|
|
60
|
-
OpenVox 8.x problems. Includes real --fix support for
|
|
60
|
+
OpenVox 8.x problems. Includes real --fix support for five checks:
|
|
61
|
+
trailing_whitespace, hard_tabs, quoted_booleans, double_quoted_strings,
|
|
62
|
+
and single_quote_string_with_variables.
|
|
61
63
|
|
|
62
64
|
Fully compatible with OpenVox 8.x and Puppet 8.x. Drop-in replacement for
|
|
63
|
-
the archived puppet-lint with
|
|
65
|
+
the archived puppet-lint with Ruby 2.6+ support and OpenVox-specific
|
|
64
66
|
checks.
|
|
65
67
|
email:
|
|
66
68
|
- jsheets@xai.com
|
|
@@ -74,6 +76,7 @@ files:
|
|
|
74
76
|
- LICENSE
|
|
75
77
|
- README.md
|
|
76
78
|
- bin/openvox-lint
|
|
79
|
+
- docs/ARCHITECTURE_REVIEW.md
|
|
77
80
|
- lib/openvox-lint.rb
|
|
78
81
|
- lib/openvox-lint/check_plugin.rb
|
|
79
82
|
- lib/openvox-lint/checks.rb
|
|
@@ -138,14 +141,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
138
141
|
requirements:
|
|
139
142
|
- - ">="
|
|
140
143
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: 2.
|
|
144
|
+
version: 2.6.0
|
|
142
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
requirements:
|
|
144
147
|
- - ">="
|
|
145
148
|
- !ruby/object:Gem::Version
|
|
146
149
|
version: '0'
|
|
147
150
|
requirements: []
|
|
148
|
-
rubygems_version: 3.
|
|
151
|
+
rubygems_version: 3.4.19
|
|
149
152
|
signing_key:
|
|
150
153
|
specification_version: 4
|
|
151
154
|
summary: Check OpenVox/Puppet manifests against the OpenVox Language Style Guide
|