Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Allow newer aruba/cucumber versions #373

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 2 additions & 34 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,8 @@
---
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
- rubocop-rake
- rubocop-rspec

AllCops:
NewCops: enable
DisplayCopNames: true
ExtraDetails: true
DisplayStyleGuide: true
TargetRubyVersion: '2.7'
Exclude:
- vendor/**/*
- .vendor/**/*

# this currently doesn't work with the way we handle our secrets
Gemspec/RequireMFA:
Enabled: false

# current Vox Pupuli default is to use `add_development_dependency` in the gemspec
Gemspec/DevelopmentDependencies:
Enabled: false

Style/TrailingCommaInHashLiteral:
Enabled: True
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArrayLiteral:
Enabled: True
EnforcedStyleForMultiline: consistent_comma

Style/TrailingCommaInArguments:
Enabled: True
EnforcedStyleForMultiline: comma
inherit_gem:
voxpupuli-rubocop: rubocop.yml

Metrics:
Enabled: false
23 changes: 18 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-05-02 19:00:08 UTC using RuboCop version 1.50.2.
# on 2024-05-02 19:12:37 UTC using RuboCop version 1.62.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -27,6 +27,7 @@ Lint/DuplicateMethods:
- 'lib/hiera/backend/eyaml/subcommand.rb'

# Offense count: 5
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Exclude:
- 'lib/hiera/backend/eyaml/parser/encrypted_tokens.rb'
Expand All @@ -50,6 +51,8 @@ Lint/ShadowingOuterLocalVariable:
- 'lib/hiera/backend/eyaml_backend.rb'

# Offense count: 7
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AutoCorrect.
Lint/UselessAssignment:
Exclude:
- 'features/support/env.rb'
Expand All @@ -61,12 +64,14 @@ Lint/UselessAssignment:

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AutoCorrect.
Lint/UselessMethodDefinition:
Exclude:
- 'lib/hiera/backend/eyaml/parser/token.rb'

# Offense count: 1
# Configuration parameters: CheckForMethodsWithNoSideEffects.
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
- 'lib/hiera/backend/eyaml/parser/token.rb'
Expand Down Expand Up @@ -101,10 +106,11 @@ Naming/HeredocDelimiterNaming:
- 'lib/hiera/backend/eyaml/subcommands/unknown_command.rb'

# Offense count: 1
# Configuration parameters: AllowedPatterns.
# Configuration parameters: EnforcedStyle, AllowedPatterns.
# SupportedStyles: snake_case, camelCase
Naming/MethodName:
EnforcedStyle: snake_case
Exclude:
- 'lib/hiera/backend/eyaml/encryptors/pkcs7.rb'

# Offense count: 1
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
Expand Down Expand Up @@ -201,6 +207,7 @@ Style/ClassVars:

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
Style/CollectionCompact:
Exclude:
- 'lib/hiera/backend/eyaml/parser/parser.rb'
Expand Down Expand Up @@ -305,7 +312,13 @@ Style/RedundantArgument:

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowComments.
Style/RedundantFilterChain:
Exclude:
- 'lib/hiera/backend/eyaml/edithelper.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AutoCorrect, AllowComments.
Style/RedundantInitialize:
Exclude:
- 'lib/hiera/backend/eyaml/parser/token.rb'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ gemspec

group :development do
gem 'activesupport'
gem 'aruba', '~> 2.1'
gem 'cucumber', '~> 8'
gem 'aruba', '~> 2.2'
gem 'cucumber', '~> 9.2'
gem 'hiera-eyaml-plaintext'
gem 'puppet', *location_for(ENV['PUPPET_VERSION']) if ENV['PUPPET_VERSION']
end
Expand Down
11 changes: 2 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ else
end

begin
require 'rubocop/rake_task'
require 'voxpupuli/rubocop/rake'
rescue LoadError
# Do nothing if no required gem installed
else
RuboCop::RakeTask.new(:rubocop) do |task|
# These make the rubocop experience maybe slightly less terrible
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
# Use Rubocop's Github Actions formatter if possible
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
end
# the voxpupuli-rubocop gem is optional
end
14 changes: 4 additions & 10 deletions hiera-eyaml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,11 @@ Gem::Specification.new do |gem|
gem.require_paths = ['lib']

gem.add_runtime_dependency 'highline', '~> 2.1'
gem.add_runtime_dependency 'optimist', '~> 3.0', '>= 3.0.1'
gem.add_runtime_dependency 'optimist', '~> 3.1'

gem.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
# 1.51 requires Ruby 2.7
gem.add_development_dependency 'rubocop', '~> 1.50.0'
# 1.18 requires Ruby 2.7
gem.add_development_dependency 'rspec-expectations', '~> 3.12.3'
gem.add_development_dependency 'rubocop-performance', '~> 1.17', '>= 1.17.1'
gem.add_development_dependency 'rubocop-rake', '~> 0.6.0'
# 2.21 requires Ruby 2.7
gem.add_development_dependency 'rubocop-rspec', '~> 2.20.0'
gem.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
gem.add_development_dependency 'rspec-expectations', '~> 3.13'
gem.add_development_dependency 'voxpupuli-rubocop', '2.6.0'

gem.required_ruby_version = '>= 2.7', ' < 4'
end
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml/edithelper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.find_editor
editor = editor.dup if editor.frozen? # values from ENV are frozen
editor.gsub!(/([^\\]|^)~/, '\1' + ENV.fetch('HOME', nil)) # replace ~ with home unless escaped
editor.gsub!(/(^|[^\\])"/, '\1') # remove unescaped quotes during processing
editor.gsub!(/\\ /, ' ') # unescape spaces since we quote paths
editor.gsub!('\\ ', ' ') # unescape spaces since we quote paths
pieces = editor.split(' ')
paths = # get possible paths, starting with longest
pieces.each_with_index.map do |_, x|
Expand Down
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml/encryptors/pkcs7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def self.create_keys
cert.not_before = Time.now
cert.not_after = if 1.size == 8 # 64bit
Time.now + (50 * 365 * 24 * 60 * 60)
else # 32bit
else # 32bit
Time.at(0x7fffffff)
end
cert.public_key = key.public_key
Expand Down
4 changes: 2 additions & 2 deletions lib/hiera/backend/eyaml/parser/encrypted_tokens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def to_encrypted(args = {})
case format
when :block
@cipher = @cipher.gsub(/\s/, '')
chevron = args[:use_chevron].nil? || args[:use_chevron] ? ">\n" : ''
chevron = (args[:use_chevron].nil? || args[:use_chevron]) ? ">\n" : ''
"#{label_string}#{chevron}" + @indentation + "ENC[#{@encryptor.tag},#{@cipher}]".scan(/.{1,60}/).join("\n" + @indentation)
when :string
ciphertext = @cipher.gsub(/[\n\r]/, '')
Expand All @@ -85,7 +85,7 @@ def to_decrypted(args = {})

case format
when :block
chevron = args[:use_chevron].nil? || args[:use_chevron] ? ">\n" : ''
chevron = (args[:use_chevron].nil? || args[:use_chevron]) ? ">\n" : ''
"#{label_string}#{chevron}" + indentation + "DEC#{index}::#{@encryptor.tag}[" + @plain_text + ']!'
when :string
"#{label_string}DEC#{index}::#{@encryptor.tag}[" + @plain_text + ']!'
Expand Down
4 changes: 2 additions & 2 deletions lib/hiera/backend/eyaml/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def self.options
def self.find
gem_version = Gem::Version.new(Gem::VERSION)
this_version = Gem::Version.create(Hiera::Backend::Eyaml::VERSION)
index = gem_version >= Gem::Version.new('1.8.0') ? Gem::Specification : Gem.source_index
index = (gem_version >= Gem::Version.new('1.8.0')) ? Gem::Specification : Gem.source_index

[index].flatten.each do |source|
specs = gem_version >= Gem::Version.new('1.6.0') ? source.latest_specs(true) : source.latest_specs
specs = (gem_version >= Gem::Version.new('1.6.0')) ? source.latest_specs(true) : source.latest_specs

specs.each do |spec|
spec = spec.to_spec if spec.respond_to?(:to_spec)
Expand Down
2 changes: 1 addition & 1 deletion lib/hiera/backend/eyaml/subcommands/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def self.preamble
This is eyaml edit mode. This text (lines starting with #{prefix} at the top of
the file) will be removed when you save and exit.
- To edit encrypted values, change the content of the DEC(<num>)::PKCS7[]!
block#{tags.size > 1 ? " (or #{tags.drop(1).collect { |tag| "DEC(<num>)::#{tag}[]!" }.join(' or ')})." : '.'}
block#{(tags.size > 1) ? " (or #{tags.drop(1).collect { |tag| "DEC(<num>)::#{tag}[]!" }.join(' or ')})." : '.'}
WARNING: DO NOT change the number in the parentheses.
- To add a new encrypted value copy and paste a new block from the
appropriate example below. Note that:
Expand Down