Skip to content

Commit 4a49f54

Browse files
Merge pull request #407 from puppetlabs/CAT-2281-Remove_puppet_7_test_infrastructure
(CAT-2281) Remove puppet 7 infrastructure
2 parents cd6349c + 0ea6f0d commit 4a49f54

File tree

19 files changed

+40
-50
lines changed

19 files changed

+40
-50
lines changed

.github/workflows/ci.yml

-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
ruby_version:
21-
- "2.7"
2221
- "3.2"
2322
include:
24-
- ruby-version: '2.7'
25-
puppet_gem_version: '~> 7.0'
2623
- ruby_version: '3.2'
2724
puppet_gem_version: '~> 8.0'
2825
runs_on:
@@ -42,11 +39,8 @@ jobs:
4239
strategy:
4340
matrix:
4441
ruby_version:
45-
- "2.7"
4642
- "3.2"
4743
include:
48-
- ruby-version: '2.7'
49-
puppet_gem_version: '~> 7.0'
5044
- ruby_version: '3.2'
5145
puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8'
5246
runs_on:

.github/workflows/nightly.yml

-6
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
ruby_version:
14-
- "2.7"
1514
- "3.2"
1615
include:
17-
- ruby-version: '2.7'
18-
puppet_gem_version: '~> 7.0'
1916
- ruby_version: '3.2'
2017
puppet_gem_version: '~> 8.0'
2118
runs_on:
@@ -34,11 +31,8 @@ jobs:
3431
strategy:
3532
matrix:
3633
ruby_version:
37-
- "2.7"
3834
- "3.2"
3935
include:
40-
- ruby-version: '2.7'
41-
puppet_gem_version: '~> 7.0'
4236
- ruby_version: '3.2'
4337
puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8'
4438
runs_on:

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AllCops:
1212
- vendor/bundle/**/*
1313
NewCops: enable
1414
SuggestExtensions: false
15-
TargetRubyVersion: '2.7'
15+
TargetRubyVersion: '3.1'
1616

1717
# Disabled
1818
Style/ClassAndModuleChildren:

.rubocop_todo.yml

+18-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-01-22 15:21:03 UTC using RuboCop version 1.50.2.
3+
# on 2025-04-09 10:54:46 UTC using RuboCop version 1.70.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -14,7 +14,7 @@ Gemspec/RequireMFA:
1414
Exclude:
1515
- 'puppet-strings.gemspec'
1616

17-
# Offense count: 45
17+
# Offense count: 44
1818
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
1919
Metrics/AbcSize:
2020
Max: 95
@@ -25,17 +25,12 @@ Metrics/AbcSize:
2525
Metrics/BlockLength:
2626
Max: 44
2727

28-
# Offense count: 1
29-
# Configuration parameters: CountBlocks.
30-
Metrics/BlockNesting:
31-
Max: 4
32-
3328
# Offense count: 5
3429
# Configuration parameters: CountComments, CountAsOne.
3530
Metrics/ClassLength:
3631
Max: 283
3732

38-
# Offense count: 34
33+
# Offense count: 33
3934
# Configuration parameters: AllowedMethods, AllowedPatterns.
4035
Metrics/CyclomaticComplexity:
4136
Max: 36
@@ -68,6 +63,7 @@ Naming/AccessorMethodName:
6863
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
6964
Naming/FileName:
7065
Exclude:
66+
- 'Rakefile.rb'
7167
- 'lib/puppet-strings.rb'
7268

7369
# Offense count: 1
@@ -85,12 +81,14 @@ Naming/MethodParameterName:
8581
- 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb'
8682
- 'lib/puppet-strings/yard/parsers/puppet/parser.rb'
8783

88-
# Offense count: 2
84+
# Offense count: 4
8985
# Configuration parameters: MinSize.
9086
Performance/CollectionLiteralInLoop:
9187
Exclude:
88+
- 'lib/puppet-strings/yard/handlers/puppet/base.rb'
9289
- 'lib/puppet-strings/yard/handlers/ruby/provider_handler.rb'
9390
- 'lib/puppet-strings/yard/handlers/ruby/rsapi_handler.rb'
91+
- 'lib/puppet-strings/yard/util.rb'
9492

9593
# Offense count: 1
9694
RSpec/BeforeAfterAll:
@@ -123,7 +121,7 @@ RSpec/DescribeClass:
123121
- 'spec/acceptance/generate_markdown_spec.rb'
124122
- 'spec/acceptance/running_strings_generate_spec.rb'
125123

126-
# Offense count: 48
124+
# Offense count: 51
127125
# Configuration parameters: CountAsOne.
128126
RSpec/ExampleLength:
129127
Max: 66
@@ -159,6 +157,7 @@ Style/ClassVars:
159157
- 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb'
160158

161159
# Offense count: 3
160+
# This cop supports unsafe autocorrection (--autocorrect-all).
162161
Style/CombinableLoops:
163162
Exclude:
164163
- 'lib/puppet-strings/markdown.rb'
@@ -187,3 +186,12 @@ Style/OptionalBooleanParameter:
187186
- 'lib/puppet-strings/yard/code_objects/type.rb'
188187
- 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb'
189188
- 'lib/puppet-strings/yard/handlers/ruby/function_handler.rb'
189+
190+
# Offense count: 2
191+
# This cop supports unsafe autocorrection (--autocorrect-all).
192+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
193+
# AllowedMethods: present?, blank?, presence, try, try!
194+
Style/SafeNavigation:
195+
Exclude:
196+
- 'lib/puppet-strings/yard/handlers/puppet/function_handler.rb'
197+
- 'lib/puppet-strings/yard/handlers/ruby/function_handler.rb'

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ group :development do
3636
gem 'rspec', '~> 3.1'
3737
gem 'rspec-its', '~> 1.0'
3838

39-
gem 'rubocop', '~> 1.64.0', require: false
39+
gem 'rubocop', '~> 1.70.0', require: false
4040
gem 'rubocop-performance', '~> 1.16', require: false
4141
gem 'rubocop-rspec', '~> 3.0', require: false
4242

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Strings processes code and YARD-style code comments to create documentation in H
1111

1212
### Requirements
1313

14-
* Ruby 2.7.0 or newer
15-
* Puppet 7.0.0 or newer
14+
* Ruby 3.1.0 or newer
15+
* Puppet 8.0.0 or newer
1616

1717
### Install Puppet Strings
1818

lib/puppet-strings/markdown/base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def defaults
181181
def toc_info
182182
{
183183
name: name.to_s,
184-
link: link,
184+
link:,
185185
desc: summary || @registry[:docstring][:text][0..140].tr("\n", ' '),
186186
private: private?
187187
}

lib/puppet-strings/yard/code_objects/function.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def to_hash
9494
hash[:signatures] << { signature: o.signature, docstring: PuppetStrings::Yard::Util.docstring_to_hash(o.docstring, %i[param option enum return example]) }
9595
end
9696
else
97-
hash[:signatures] << { signature: signature, docstring: PuppetStrings::Yard::Util.docstring_to_hash(docstring, %i[param option enum return example]) }
97+
hash[:signatures] << { signature:, docstring: PuppetStrings::Yard::Util.docstring_to_hash(docstring, %i[param option enum return example]) }
9898
end
9999

100100
hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)

lib/puppet-strings/yard/handlers/puppet/base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def set_parameter_types(object)
2121
tags.each do |tag|
2222
next if statement.parameters.find { |p| tag.name == p.name }
2323

24-
log.warn "The @param tag for parameter '#{tag.name}' has no matching parameter at #{statement.file}:#{statement.line}." unless tag.name == 'name' || tag.name == 'title'
24+
log.warn "The @param tag for parameter '#{tag.name}' has no matching parameter at #{statement.file}:#{statement.line}." unless %w[name title].include?(tag.name)
2525
end
2626

2727
# Assign the types for the parameter

lib/puppet-strings/yard/handlers/ruby/base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class PuppetStrings::Yard::Handlers::Ruby::Base < YARD::Handlers::Ruby::Base
77
# A regular expression for detecting the start of a Ruby heredoc.
88
# Note: the first character of the heredoc start may have been cut off by YARD.
9-
HEREDOC_START = /^<?<[-~]?['"]?(\w+)['"]?[^\n]*\n?/.freeze
9+
HEREDOC_START = /^<?<[-~]?['"]?(\w+)['"]?[^\n]*\n?/
1010

1111
protected
1212

lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def extract_params(hash)
237237
default = value['value'] unless value['value'].nil?
238238
end
239239
data_type = [data_type] unless data_type.nil? || data_type.is_a?(Array)
240-
params_hash[key] = { types: data_type, default: default }
240+
params_hash[key] = { types: data_type, default: }
241241
end
242242

243243
params_hash

lib/puppet-strings/yard/handlers/ruby/provider_handler.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def register_provider_docstring(object)
6161
# Look for a call to a dispatch method with a block
6262
next unless
6363
child.method_name &&
64-
(child.method_name.source == 'desc' || child.method_name.source == 'doc=') &&
64+
['desc', 'doc='].include?(child.method_name.source) &&
6565
child.parameters(false).count == 1
6666

6767
docstring = node_as_string(child.parameters[0])

lib/puppet-strings/yard/handlers/ruby/type_base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def find_docstring(node, kind)
3434
elsif child.is_a?(YARD::Parser::Ruby::MethodCallNode)
3535
# Look for a call to a dispatch method with a block
3636
next unless child.method_name &&
37-
(child.method_name.source == 'desc' || child.method_name.source == 'doc=') &&
37+
['desc', 'doc='].include?(child.method_name.source) &&
3838
child.parameters(false).count == 1
3939

4040
docstring = node_as_string(child.parameters[0])

lib/puppet-strings/yard/parsers/puppet/statement.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module PuppetStrings::Yard::Parsers::Puppet
77
# Represents the base Puppet language statement.
88
class Statement
99
# The pattern for parsing docstring comments.
10-
COMMENT_REGEX = /^\s*#+\s?/.freeze
10+
COMMENT_REGEX = /^\s*#+\s?/
1111

1212
attr_reader :source, :file, :line, :docstring, :comments_range
1313

@@ -170,7 +170,7 @@ def initialize(object, file)
170170
case type_expr
171171
when Puppet::Pops::Model::AccessExpression
172172
# TODO: I don't like rebuilding the source from the AST, but AccessExpressions don't expose the original source
173-
@alias_of = +"#{PuppetStrings::Yard::Util.ast_to_text(type_expr.left_expr)}[" # alias_of should be mutable so we add a + to the string.
173+
@alias_of = "#{PuppetStrings::Yard::Util.ast_to_text(type_expr.left_expr)}[" # alias_of should be mutable so we add a + to the string.
174174
@alias_of << type_expr.keys.map { |key| PuppetStrings::Yard::Util.ast_to_text(key) }.join(', ')
175175
@alias_of << ']'
176176
else

lib/puppet-strings/yard/tags/overload_tag.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def object=(value)
7575
# @param [Array] args The args passed to the method.
7676
# @param block The block passed to the method.
7777
# @return Returns what the method call on the object would return.
78-
def method_missing(method_name, *args, &block)
79-
return object.send(method_name, *args, &block) if object.respond_to? method_name
78+
def method_missing(method_name, ...)
79+
return object.send(method_name, ...) if object.respond_to? method_name
8080

8181
super
8282
end

lib/puppet-strings/yard/templates/default/tags/setup.rb

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,7 @@
44
# @return [Array<YARD::Tag>] Returns the parameter tags if the object should have parameters.
55
def param
66
tag(:param) if
7-
object.type == :method ||
8-
object.type == :puppet_class ||
9-
object.type == :puppet_data_type ||
10-
object.type == :puppet_defined_type ||
11-
object.type == :puppet_function ||
12-
object.type == :puppet_task ||
13-
object.type == :puppet_plan
7+
%i[method puppet_class puppet_data_type puppet_defined_type puppet_function puppet_task puppet_plan].include?(object.type)
148
end
159

1610
# Renders the overload section.

lib/puppet-strings/yard/util.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def self.tags_to_hashes(tags)
4040

4141
tag = { tag_name: t.tag_name }
4242
# grab nested information for @option and @enum tags
43-
if tag[:tag_name] == 'option' || tag[:tag_name] == 'enum'
43+
if %w[option enum].include?(tag[:tag_name])
4444
tag[:opt_name] = t.pair.name
4545
tag[:opt_text] = t.pair.text
4646
tag[:opt_types] = t.pair.types if t.pair.types

puppet-strings.gemspec

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
1212
s.summary = 'Puppet documentation via YARD'
1313
s.email = '[email protected]'
1414
s.homepage = 'https://github.com/puppetlabs/puppet-strings'
15-
s.required_ruby_version = '>= 2.7.0'
15+
s.required_ruby_version = '>= 3.1.0'
1616

1717
s.extra_rdoc_files = [
1818
'CHANGELOG.md',
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
2222
]
2323
s.files = Dir['CHANGELOG.md', 'README.md', 'LICENSE', 'lib/**/*', 'exe/**/*']
2424

25-
s.add_runtime_dependency 'puppet', '>= 7.0.0'
26-
s.add_runtime_dependency 'rgen', '~> 0.9'
27-
s.add_runtime_dependency 'yard', '~> 0.9'
25+
s.add_dependency 'puppet', '>= 8.0.0'
26+
s.add_dependency 'rgen', '~> 0.9'
27+
s.add_dependency 'yard', '~> 0.9'
2828
end

spec/unit/puppet-strings/json_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class klass(Integer $param1, $param2, String $param3 = hi) inherits foo::bar {
310310
#
311311
# @param [Proc] block The block to capture output from
312312
# @return [Hash] A hash containing the captured output
313-
def capture_output(&_block)
313+
def capture_output(&)
314314
begin
315315
$stdout = StringIO.new
316316
$stderr = StringIO.new

0 commit comments

Comments
 (0)