Skip to content

Commit fa7ed23

Browse files
Merge pull request #253 from scotje/maint_drop_ruby_2.1.x
(MAINT) Drop Ruby 2.1.x and Puppet 4.x compatibility
2 parents 8b5731d + a1b5e4b commit fa7ed23

File tree

108 files changed

+412
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+412
-119
lines changed

.rubocop.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
require: rubocop-performance
12
inherit_from: .rubocop_todo.yml
23

34
AllCops:
5+
TargetRubyVersion: 2.3
46
Exclude:
57
# Ignore HTML related things
68
- '**/*.erb'
@@ -9,6 +11,7 @@ AllCops:
911
- spec/fixtures/modules/**/*
1012
- spec/fixtures/ruby/**/*
1113

14+
1215
# DISABLED - not useful
1316
Bundler/OrderedGems:
1417
Enabled: false
@@ -34,7 +37,7 @@ Lint/EnsureReturn:
3437
Enabled: false
3538

3639
# MAYBE useful - errors when rescue {} happens.
37-
Lint/HandleExceptions:
40+
Lint/SuppressedException:
3841
Enabled: false
3942

4043
# MAYBE useful - but too many instances
@@ -119,7 +122,7 @@ Lint/ParenthesesAsGroupedExpression:
119122
Lint/RescueException:
120123
Enabled: false
121124

122-
Lint/StringConversionInInterpolation:
125+
Lint/RedundantStringCoercion:
123126
Enabled: false
124127

125128
Lint/UnusedBlockArgument:
@@ -143,13 +146,13 @@ Naming/AccessorMethodName:
143146
Style/Alias:
144147
Enabled: false
145148

146-
Layout/AlignArray:
149+
Layout/ArrayAlignment:
147150
Enabled: false
148151

149-
Layout/AlignHash:
152+
Layout/HashAlignment:
150153
Enabled: false
151154

152-
Layout/AlignParameters:
155+
Layout/ParameterAlignment:
153156
Enabled: false
154157

155158
Metrics/BlockNesting:
@@ -161,9 +164,6 @@ Style/AsciiComments:
161164
Style/Attr:
162165
Enabled: false
163166

164-
Style/BracesAroundHashParameters:
165-
Enabled: false
166-
167167
Style/CaseEquality:
168168
Enabled: false
169169

@@ -198,7 +198,7 @@ Style/WhenThen:
198198
Style/WordArray:
199199
Enabled: false
200200

201-
Style/UnneededPercentQ:
201+
Style/RedundantPercentQ:
202202
Enabled: false
203203

204204
Layout/Tab:
@@ -207,7 +207,7 @@ Layout/Tab:
207207
Layout/SpaceBeforeSemicolon:
208208
Enabled: false
209209

210-
Layout/TrailingBlankLines:
210+
Layout/TrailingEmptyLines:
211211
Enabled: false
212212

213213
Layout/SpaceInsideBlockBraces:
@@ -292,10 +292,10 @@ Style/EachWithObject:
292292
Layout/EmptyLineBetweenDefs:
293293
Enabled: false
294294

295-
Layout/IndentArray:
295+
Layout/FirstArrayElementIndentation:
296296
Enabled: false
297297

298-
Layout/IndentHash:
298+
Layout/FirstHashElementIndentation:
299299
Enabled: false
300300

301301
Layout/IndentationConsistency:
@@ -313,7 +313,7 @@ Layout/EmptyLinesAroundAccessModifier:
313313
Style/EmptyLiteral:
314314
Enabled: false
315315

316-
Metrics/LineLength:
316+
Layout/LineLength:
317317
Enabled: false
318318

319319
Style/MethodCallWithoutArgsParentheses:
@@ -430,6 +430,9 @@ Style/Not:
430430
Style/NumericLiterals:
431431
Enabled: false
432432

433+
Style/NumericPredicate:
434+
Enabled: false
435+
433436
Style/OneLineConditional:
434437
Enabled: false
435438

@@ -526,7 +529,7 @@ Layout/EmptyLinesAroundBlockBody:
526529
Layout/EmptyLinesAroundClassBody:
527530
Enabled: false
528531

529-
Style/UnneededInterpolation:
532+
Style/RedundantInterpolation:
530533
Enabled: false
531534

532535
Style/SymbolProc:
@@ -575,5 +578,24 @@ Naming/VariableNumber:
575578
Layout/EndOfLine:
576579
EnforcedStyle: lf
577580

578-
Layout/IndentHeredoc: # Not appicable on Ruby 2.1
581+
Layout/HeredocIndentation: # Not appicable on Ruby 2.1
579582
Enabled: false
583+
584+
Lint/RaiseException:
585+
Enabled: true
586+
587+
Lint/StructNewOverride:
588+
Enabled: true
589+
590+
Style/HashEachMethods:
591+
Enabled: true
592+
593+
Style/HashTransformKeys:
594+
Enabled: false # requires Ruby 2.5
595+
596+
Style/HashTransformValues:
597+
Enabled: false # requires Ruby 2.4
598+
599+
Naming/MethodParameterName:
600+
Enabled: true
601+
AllowedNames: [ o ]

.travis.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@ script: 'SPEC_OPTS="--format documentation" COVERAGE="yes" bundle exec rake $CHE
1616
jobs:
1717
fast_finish: true
1818
include:
19-
- rvm: 2.1.9
20-
env: PUPPET_GEM_VERSION="~> 4" CHECK=spec
21-
- rvm: 2.4.1
22-
env: PUPPET_GEM_VERSION="~> 4" CHECK=spec
23-
- rvm: 2.4.1
19+
- rvm: 2.3
20+
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
21+
- rvm: 2.4
2422
env: PUPPET_GEM_VERSION="~> 5" CHECK=spec
2523
- rvm: 2.5
2624
env: PUPPET_GEM_VERSION="~> 6" CHECK=spec
2725
- rvm: 2.7
2826
env: PUPPET_GEM_VERSION="~> 6" CHECK=spec
29-
- rvm: 2.1.9
30-
env: PUPPET_GEM_VERSION="~> 4" CHECK=rubocop
3127
- bundler_args: ""
3228
rvm: 2.5
3329
before_script:

Gemfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source ENV['GEM_SOURCE'] || "https://rubygems.org"
24

35
gemspec
@@ -37,8 +39,9 @@ group :development do
3739
gem 'pry-byebug'
3840
end
3941

42+
gem 'rubocop', '~> 0.81.0' # last release that supports Ruby 2.3.0
4043
gem 'rubocop-rspec'
41-
gem 'rubocop', '~> 0.57.2'
44+
gem 'rubocop-performance'
4245

4346
# Evaluate Gemfile.local if it exists
4447
if File.exists? "#{__FILE__}.local"

Rakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
if Bundler.rubygems.find_name('puppet_litmus').any?
24
require 'puppet_litmus/rake_tasks'
35

@@ -54,7 +56,7 @@ PuppetLint.configuration.ignore_paths = %w(acceptance/**/*.pp spec/**/*.pp pkg/*
5456
desc 'Validate Ruby source files and ERB templates.'
5557
task :validate do
5658
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
57-
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
59+
sh "ruby -c #{ruby_file}" unless /spec\/fixtures/.match?(ruby_file)
5860
end
5961
Dir['lib/puppet-strings/yard/templates/**/*.erb'].each do |template|
6062
sh "erb -P -x -T '-' #{template} | ruby -c"
@@ -93,10 +95,12 @@ namespace :litmus do
9395
`gem build puppet-strings.gemspec --quiet`
9496
result = $CHILD_STATUS
9597
raise "Unable to build the puppet-strings gem. Returned exit code #{result.exitstatus}" unless result.exitstatus.zero?
98+
9699
puts 'Built'
97100
# Find the gem build artifact
98101
gem_tar = Dir.glob('puppet-strings-*.gem').max_by { |f| File.mtime(f) }
99102
raise "Unable to find package in 'puppet-strings-*.gem'" if gem_tar.nil?
103+
100104
gem_tar = File.expand_path(gem_tar)
101105

102106
target_string = if args[:target_node_name].nil?

lib/puppet-strings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# The root module for Puppet Strings.
24
module PuppetStrings
35
# The glob patterns used to search for files to document.

lib/puppet-strings/describe.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'json'
24
require 'puppet-strings/json'
35

lib/puppet-strings/json.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'json'
24

35
# The module for JSON related functionality.

lib/puppet-strings/markdown.rb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'puppet-strings/json'
24

35
# module for parsing Yard Registries and generating markdown
@@ -15,15 +17,15 @@ module PuppetStrings::Markdown
1517
# @return [String] markdown doc
1618
def self.generate
1719
final = "# Reference\n\n"
18-
final << "<!-- DO NOT EDIT: This document was generated by Puppet Strings -->\n\n"
19-
final << PuppetStrings::Markdown::TableOfContents.render
20-
final << PuppetStrings::Markdown::PuppetClasses.render
21-
final << PuppetStrings::Markdown::DefinedTypes.render
22-
final << PuppetStrings::Markdown::ResourceTypes.render
23-
final << PuppetStrings::Markdown::Functions.render
24-
final << PuppetStrings::Markdown::DataTypes.render
25-
final << PuppetStrings::Markdown::PuppetTasks.render
26-
final << PuppetStrings::Markdown::PuppetPlans.render
20+
final += "<!-- DO NOT EDIT: This document was generated by Puppet Strings -->\n\n"
21+
final += PuppetStrings::Markdown::TableOfContents.render
22+
final += PuppetStrings::Markdown::PuppetClasses.render
23+
final += PuppetStrings::Markdown::DefinedTypes.render
24+
final += PuppetStrings::Markdown::ResourceTypes.render
25+
final += PuppetStrings::Markdown::Functions.render
26+
final += PuppetStrings::Markdown::DataTypes.render
27+
final += PuppetStrings::Markdown::PuppetTasks.render
28+
final += PuppetStrings::Markdown::PuppetPlans.render
2729

2830
final
2931
end

lib/puppet-strings/markdown/base.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'puppet-strings'
24
require 'puppet-strings/json'
35
require 'puppet-strings/yard'
@@ -68,7 +70,7 @@ def initialize(registry, component_type)
6870

6971
# @return [String] top-level name
7072
def name
71-
@registry[:name].to_s unless @registry[:name].nil?
73+
@registry[:name]&.to_s
7274
end
7375

7476
# @return [String] 'Overview' text (untagged text)

lib/puppet-strings/markdown/data_type.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'puppet-strings/markdown/base'
24

35
module PuppetStrings::Markdown

0 commit comments

Comments
 (0)