Skip to content

Commit 0bd04f5

Browse files
authored
Merge pull request #13 from voxpupuli/ruby32
Require Ruby 3.2 or newer
2 parents 3471452 + 447c674 commit 0bd04f5

File tree

35 files changed

+139
-207
lines changed

35 files changed

+139
-207
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ jobs:
5656
run: bundle exec rake acceptance
5757

5858
tests:
59+
if: always()
5960
needs:
6061
- rubocop_and_matrix
6162
- test
6263
runs-on: ubuntu-24.04
6364
name: Test suite
6465
steps:
65-
- run: echo Test suite completed
66+
- name: Decide whether the needed jobs succeeded or failed
67+
uses: re-actors/alls-green@release/v1
68+
with:
69+
jobs: ${{ toJSON(needs) }}

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ Style/ClassAndModuleChildren:
1919

2020
Style/SpecialGlobalVars:
2121
Enabled: false
22+
23+
AllCops:
24+
TargetRubyVersion: 3.2

.rubocop_todo.yml

Lines changed: 38 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
3-
# using RuboCop version 1.75.8.
3+
# using RuboCop version 1.79.2.
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
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 3
10+
# This cop supports unsafe autocorrection (--autocorrect-all).
11+
# Configuration parameters: RequireParenthesesForMethodChains.
12+
Lint/AmbiguousRange:
13+
Exclude:
14+
- 'lib/openvox-strings/yard/parsers/puppet/statement.rb'
15+
916
# Offense count: 1
1017
Lint/CopDirectiveSyntax:
1118
Exclude:
@@ -16,12 +23,6 @@ Lint/MixedRegexpCaptureTypes:
1623
Exclude:
1724
- 'Gemfile'
1825

19-
# Offense count: 1
20-
# This cop supports safe autocorrection (--autocorrect).
21-
Lint/RedundantCopDisableDirective:
22-
Exclude:
23-
- 'lib/puppet/face/strings.rb'
24-
2526
# Offense count: 2
2627
Naming/AccessorMethodName:
2728
Exclude:
@@ -52,6 +53,27 @@ Naming/MethodParameterName:
5253
- 'lib/openvox-strings/yard/handlers/ruby/data_type_handler.rb'
5354
- 'lib/openvox-strings/yard/parsers/puppet/parser.rb'
5455

56+
# Offense count: 3
57+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
58+
# AllowedMethods: call
59+
# WaywardPredicates: nonzero?
60+
Naming/PredicateMethod:
61+
Exclude:
62+
- 'lib/openvox-strings/markdown/resource_type.rb'
63+
- 'lib/openvox-strings/yard/parsers/json/task_statement.rb'
64+
- 'lib/openvox-strings/yard/parsers/puppet/statement.rb'
65+
66+
# Offense count: 1
67+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
68+
# NamePrefix: is_, has_, have_, does_
69+
# ForbiddenPrefixes: is_, has_, have_, does_
70+
# AllowedMethods: is_a?
71+
# MethodDefinitionMacros: define_method, define_singleton_method
72+
Naming/PredicatePrefix:
73+
Exclude:
74+
- 'spec/**/*'
75+
- 'lib/openvox-strings/yard/tags/overload_tag.rb'
76+
5577
# Offense count: 4
5678
# Configuration parameters: MinSize.
5779
Performance/CollectionLiteralInLoop:
@@ -94,10 +116,6 @@ RSpec/ExpectInHook:
94116
Exclude:
95117
- 'spec/unit/openvox-strings/json_spec.rb'
96118

97-
# Offense count: 91
98-
RSpec/MultipleExpectations:
99-
Max: 64
100-
101119
# Offense count: 5
102120
# Configuration parameters: AllowedGroups.
103121
RSpec/NestedGroups:
@@ -114,33 +132,27 @@ RSpec/RepeatedExampleGroupDescription:
114132
RSpec/SpecFilePathFormat:
115133
Enabled: false
116134

117-
# Offense count: 2
118-
# This cop supports safe autocorrection (--autocorrect).
119-
Rake/Desc:
120-
Exclude:
121-
- 'Rakefile'
122-
123135
# Offense count: 1
124136
Style/ClassVars:
125137
Exclude:
126138
- 'lib/openvox-strings/yard/templates/default/layout/html/setup.rb'
127139

140+
# Offense count: 6
141+
# This cop supports unsafe autocorrection (--autocorrect-all).
142+
Style/CollectionQuerying:
143+
Exclude:
144+
- 'lib/openvox-strings/yard/handlers/ruby/function_handler.rb'
145+
- 'lib/openvox-strings/yard/handlers/ruby/provider_handler.rb'
146+
- 'lib/openvox-strings/yard/handlers/ruby/rsapi_handler.rb'
147+
- 'lib/openvox-strings/yard/handlers/ruby/type_base.rb'
148+
128149
# Offense count: 3
129150
# This cop supports unsafe autocorrection (--autocorrect-all).
130151
Style/CombinableLoops:
131152
Exclude:
132153
- 'lib/openvox-strings/markdown.rb'
133154
- 'lib/openvox-strings/yard/handlers/ruby/data_type_handler.rb'
134155

135-
# Offense count: 2
136-
# This cop supports unsafe autocorrection (--autocorrect-all).
137-
# Configuration parameters: EnforcedStyle.
138-
# SupportedStyles: literals, strict
139-
Style/MutableConstant:
140-
Exclude:
141-
- 'lib/openvox-strings/yard/handlers/ruby/base.rb'
142-
- 'lib/openvox-strings/yard/parsers/puppet/statement.rb'
143-
144156
# Offense count: 20
145157
# Configuration parameters: AllowedMethods.
146158
# AllowedMethods: respond_to_missing?
@@ -160,27 +172,6 @@ Style/OptionalBooleanParameter:
160172
- 'lib/openvox-strings/yard/handlers/ruby/data_type_handler.rb'
161173
- 'lib/openvox-strings/yard/handlers/ruby/function_handler.rb'
162174

163-
# Offense count: 2
164-
# This cop supports safe autocorrection (--autocorrect).
165-
Style/RedundantParentheses:
166-
Exclude:
167-
- 'lib/openvox-strings/yard/handlers/puppet/function_handler.rb'
168-
- 'lib/openvox-strings/yard/tags/overload_tag.rb'
169-
170-
# Offense count: 2
171-
# This cop supports safe autocorrection (--autocorrect).
172-
Style/RedundantRegexpEscape:
173-
Exclude:
174-
- 'Gemfile'
175-
176-
# Offense count: 1
177-
# This cop supports safe autocorrection (--autocorrect).
178-
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
179-
# SupportedStyles: slashes, percent_r, mixed
180-
Style/RegexpLiteral:
181-
Exclude:
182-
- 'Gemfile'
183-
184175
# Offense count: 2
185176
# This cop supports unsafe autocorrection (--autocorrect-all).
186177
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
@@ -189,68 +180,3 @@ Style/SafeNavigation:
189180
Exclude:
190181
- 'lib/openvox-strings/yard/handlers/puppet/function_handler.rb'
191182
- 'lib/openvox-strings/yard/handlers/ruby/function_handler.rb'
192-
193-
# Offense count: 3
194-
# This cop supports safe autocorrection (--autocorrect).
195-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
196-
# SupportedStyles: single_quotes, double_quotes
197-
Style/StringLiterals:
198-
Exclude:
199-
- 'Gemfile'
200-
- 'Rakefile'
201-
202-
# Offense count: 6
203-
# This cop supports safe autocorrection (--autocorrect).
204-
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
205-
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
206-
Style/TernaryParentheses:
207-
Exclude:
208-
- 'lib/openvox-strings/tasks/generate.rb'
209-
- 'lib/openvox-strings/yard/templates/default/layout/html/setup.rb'
210-
- 'lib/openvox-strings/yard/templates/default/tags/setup.rb'
211-
- 'lib/puppet/face/strings.rb'
212-
- 'spec/spec_helper.rb'
213-
214-
# Offense count: 17
215-
# This cop supports safe autocorrection (--autocorrect).
216-
# Configuration parameters: EnforcedStyleForMultiline.
217-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
218-
Style/TrailingCommaInArguments:
219-
Exclude:
220-
- 'lib/openvox-strings/yard.rb'
221-
- 'lib/openvox-strings/yard/code_objects/type.rb'
222-
- 'lib/openvox-strings/yard/handlers/ruby/function_handler.rb'
223-
- 'lib/puppet/face/strings.rb'
224-
- 'spec/unit/openvox-strings/yard/handlers/puppet/class_handler_spec.rb'
225-
- 'spec/unit/openvox-strings/yard/handlers/puppet/function_handler_spec.rb'
226-
- 'spec/unit/openvox-strings/yard/handlers/ruby/function_handler_spec.rb'
227-
228-
# Offense count: 16
229-
# This cop supports safe autocorrection (--autocorrect).
230-
# Configuration parameters: EnforcedStyleForMultiline.
231-
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
232-
Style/TrailingCommaInArrayLiteral:
233-
Exclude:
234-
- 'lib/openvox-strings/markdown.rb'
235-
- 'lib/openvox-strings/yard/templates/default/layout/html/setup.rb'
236-
- 'spec/acceptance/generate_json_spec.rb'
237-
- 'spec/acceptance/running_strings_generate_spec.rb'
238-
- 'spec/unit/openvox-strings/yard/code_objects/task_spec.rb'
239-
- 'spec/unit/openvox-strings/yard/handlers/ruby/data_type_handler_spec.rb'
240-
- 'spec/unit/openvox-strings/yard/parsers/puppet/parser_spec.rb'
241-
242-
# Offense count: 30
243-
# This cop supports safe autocorrection (--autocorrect).
244-
# Configuration parameters: EnforcedStyleForMultiline.
245-
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
246-
Style/TrailingCommaInHashLiteral:
247-
Exclude:
248-
- 'lib/openvox-strings/describe.rb'
249-
- 'lib/openvox-strings/json.rb'
250-
- 'lib/openvox-strings/tasks/generate.rb'
251-
- 'lib/openvox-strings/tasks/validate.rb'
252-
- 'lib/openvox-strings/yard/code_objects/data_type.rb'
253-
- 'lib/openvox-strings/yard/code_objects/task.rb'
254-
- 'lib/openvox-strings/yard/templates/default/layout/html/setup.rb'
255-
- 'spec/acceptance/generate_json_spec.rb'
256-
- 'spec/unit/openvox-strings/yard/code_objects/task_spec.rb'

Gemfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# frozen_string_literal: true
22

3-
source ENV['GEM_SOURCE'] || "https://rubygems.org"
3+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
44

55
gemspec
66

77
def location_for(place_or_version, fake_version = nil)
8-
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
9-
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
8+
git_url_regex = /\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?/
9+
file_url_regex = %r{\Afile://(?<path>.*)}
1010

1111
if place_or_version && (git_url = place_or_version.match(git_url_regex))
1212
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
@@ -31,10 +31,6 @@ group :development do
3131
gem 'redcarpet'
3232
end
3333

34-
group :rubocop do
35-
gem 'voxpupuli-rubocop', '~> 3.1.0'
36-
end
37-
3834
# https://github.com/OpenVoxProject/puppet/issues/90
3935
gem 'syslog', '~> 0.3' if RUBY_VERSION >= '3.4'
4036

Rakefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
require 'rspec/core/rake_task'
44

55
RSpec::Core::RakeTask.new(:spec) do |t|
6-
t.exclude_pattern = "spec/acceptance/**/*.rb"
6+
t.exclude_pattern = 'spec/acceptance/**/*.rb'
77
end
88

99
RSpec::Core::RakeTask.new(:acceptance) do |t|
10-
t.pattern = "spec/unit/**/*.rb"
10+
t.pattern = 'spec/unit/**/*.rb'
1111
end
1212

13+
desc 'run unit tests'
1314
task :spec
15+
16+
desc 'run acceptance tests'
1417
task :acceptance
1518

1619
# Add our own tasks

lib/openvox-strings.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ def self.render_describe(describe_types, list = false, show_providers = true, li
7979

8080
# Runs the YARD documentation server.
8181
# @param [Array<String>] args The arguments to YARD.
82-
def self.run_server(*args)
82+
def self.run_server(*)
8383
require 'openvox-strings/yard'
8484
OpenvoxStrings::Yard.setup!
8585

86-
YARD::CLI::Server.run(*args)
86+
YARD::CLI::Server.run(*)
8787
end
8888
end

lib/openvox-strings/describe.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def self.render(describe_types = [], list_types = false, show_type_providers = t
1515
document = {
1616
defined_types: YARD::Registry.all(:puppet_defined_type).sort_by!(&:name).map!(&:to_hash),
1717
resource_types: YARD::Registry.all(:puppet_type).sort_by!(&:name).map!(&:to_hash),
18-
providers: YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash)
18+
providers: YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash),
1919
}
2020
# if --list flag passed, produce a summarized list of types
2121
if list_types

lib/openvox-strings/json.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def self.render(file = nil)
1717
providers: YARD::Registry.all(:puppet_provider).sort_by!(&:name).map!(&:to_hash),
1818
puppet_functions: YARD::Registry.all(:puppet_function).sort_by!(&:name).map!(&:to_hash),
1919
puppet_tasks: YARD::Registry.all(:puppet_task).sort_by!(&:name).map!(&:to_hash),
20-
puppet_plans: YARD::Registry.all(:puppet_plan).sort_by!(&:name).map!(&:to_hash)
20+
puppet_plans: YARD::Registry.all(:puppet_plan).sort_by!(&:name).map!(&:to_hash),
2121
# TODO: Need Ruby documentation?
2222
}
2323

lib/openvox-strings/markdown.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def self.groups
2323
OpenvoxStrings::Markdown::Function,
2424
OpenvoxStrings::Markdown::DataType,
2525
OpenvoxStrings::Markdown::PuppetTask,
26-
OpenvoxStrings::Markdown::PuppetPlan
26+
OpenvoxStrings::Markdown::PuppetPlan,
2727
]
2828
end
2929

@@ -33,7 +33,7 @@ def self.generate
3333
output = [
3434
"# Reference\n\n",
3535
"<!-- DO NOT EDIT: This document was generated by Puppet Strings -->\n\n",
36-
"## Table of Contents\n\n"
36+
"## Table of Contents\n\n",
3737
]
3838

3939
# Create table of contents

lib/openvox-strings/tasks/generate.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
options = {
1414
debug: args[:debug] == 'true',
1515
backtrace: args[:backtrace] == 'true',
16-
markup: args[:markup] || 'markdown'
16+
markup: args[:markup] || 'markdown',
1717
}
1818

1919
raise('Error: Both JSON and Markdown output have been selected. Please select one.') if args[:json] == 'true' && args[:markdown] == 'true'
@@ -33,7 +33,7 @@ def parse_format_option(args, options, format)
3333
options[format] = !(args[format] == 'false' || args[format].empty?)
3434
return unless options[format]
3535

36-
options[:path] = args[format] == 'true' ? nil : args[format]
36+
options[:path] = (args[format] == 'true') ? nil : args[format]
3737
end
3838
# rubocop:enable Style/PreferredHashMethods
3939

0 commit comments

Comments
 (0)