diff --git a/.rubocop.yml b/.rubocop.yml index 9047799..69bd7a8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,6 +3,7 @@ AllCops: - 'vendor/**/*' - 'spec/fixtures/**/*' TargetRubyVersion: 2.5 + NewCops: enable Style/CommentedKeyword: Enabled: false diff --git a/Gemfile b/Gemfile index e1fad19..b86639c 100644 --- a/Gemfile +++ b/Gemfile @@ -3,13 +3,13 @@ # vim:ft=ruby source 'https://rubygems.org' -# rubocop:disable ConditionalAssignment +# rubocop:disable Style/ConditionalAssignment if ENV.key?('PUPPET_VERSION') puppetversion = ENV['PUPPET_VERSION'].to_s else - puppetversion = ['>= 5', '< 6'] + puppetversion = ['>= 6', '< 7'] end -# rubocop:enable ConditionalAssignment +# rubocop:enable Style/ConditionalAssignment group :production do gem 'os', '~> 1.1' @@ -24,7 +24,7 @@ group :development, :unit_tests do gem 'metadata-json-lint', '~> 2.4' gem 'puppetlabs_spec_helper', '~> 2.15' gem 'rspec-puppet', '~> 2.6' - gem 'rubocop', '~> 0.79' + gem 'rubocop', '~> 0.86' gem 'tty-command', '~> 0.6' gem 'tty-file', '~> 0.9' gem 'tty-prompt', '~> 0.21' diff --git a/Gemfile.lock b/Gemfile.lock index b0f056f..31e3bbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,14 +4,16 @@ GEM CFPropertyList (2.3.6) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - ast (2.4.0) + ast (2.4.1) colored2 (3.1.2) + concurrent-ruby (1.1.6) cri (2.15.10) - diff-lcs (1.3) + deep_merge (1.2.1) + diff-lcs (1.4.4) equatable (0.6.1) - facter (2.5.7) - facter (2.5.7-universal-darwin) - CFPropertyList (~> 2.2) + facter (4.0.29) + hocon (~> 1.3) + thor (>= 1.0.1, < 2.0) faraday (0.17.3) multipart-post (>= 1.2, < 3) faraday_middleware (0.14.0) @@ -25,7 +27,8 @@ GEM gettext (>= 3.0.2, < 3.3.0) locale hiera (3.6.0) - jaro_winkler (1.5.4) + hocon (1.3.1) + httpclient (2.8.3) json (2.3.1) json-schema (2.8.1) addressable (>= 2.4) @@ -40,27 +43,37 @@ GEM multipart-post (2.1.1) necromancer (0.5.1) os (1.1.0) - parallel (1.19.1) - parser (2.7.0.1) - ast (~> 2.4.0) - pastel (0.7.3) + parallel (1.19.2) + parser (2.7.1.4) + ast (~> 2.4.1) + pastel (0.7.4) equatable (~> 0.6) tty-color (~> 0.5) pathspec (0.2.1) public_suffix (4.0.5) - puppet (5.5.20) - facter (> 2.0.1, < 4) - fast_gettext (~> 1.1.2) + puppet (6.16.0) + concurrent-ruby (~> 1.0) + deep_merge (~> 1.0) + facter (> 2.0.1, < 5) + fast_gettext (~> 1.1) hiera (>= 3.2.1, < 4) + httpclient (~> 2.8) locale (~> 2.1) multi_json (~> 1.10) - puppet (5.5.20-universal-darwin) + puppet-resource_api (~> 1.5) + semantic_puppet (~> 1.0) + puppet (6.16.0-universal-darwin) CFPropertyList (~> 2.2) - facter (> 2.0.1, < 4) - fast_gettext (~> 1.1.2) + concurrent-ruby (~> 1.0) + deep_merge (~> 1.0) + facter (> 2.0.1, < 5) + fast_gettext (~> 1.1) hiera (>= 3.2.1, < 4) + httpclient (~> 2.8) locale (~> 2.1) multi_json (~> 1.10) + puppet-resource_api (~> 1.5) + semantic_puppet (~> 1.0) puppet-lint (2.4.2) puppet-lint-absolute_classname-check (2.0.0) puppet-lint (>= 1.0, < 3.0) @@ -82,7 +95,9 @@ GEM puppet-lint (>= 2.1, < 3.0) puppet-lint-variable_contains_upcase (1.2.0) puppet-lint (>= 1.0, < 3.0) - puppet-syntax (3.0.1) + puppet-resource_api (1.8.13) + hocon (>= 1.0) + puppet-syntax (3.1.0) puppet (>= 5) rake puppet_forge (2.3.4) @@ -108,6 +123,8 @@ GEM puppet_forge (~> 2.3.0) rainbow (3.0.0) rake (13.0.1) + regexp_parser (1.7.1) + rexml (3.2.4) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -123,18 +140,23 @@ GEM rspec-puppet (2.7.8) rspec rspec-support (3.9.3) - rubocop (0.79.0) - jaro_winkler (~> 1.5.1) + rubocop (0.86.0) parallel (~> 1.10) parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.7) + rexml + rubocop-ast (>= 0.0.3, < 1.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-ast (0.1.0) + parser (>= 2.7.0.1) ruby-progressbar (1.10.1) rugged (1.0.1) semantic_puppet (1.0.2) spdx-licenses (1.2.0) text (1.3.1) + thor (1.0.1) trollop (2.9.10) tty-color (0.5.1) tty-command (0.9.0) @@ -152,8 +174,8 @@ GEM tty-cursor (~> 0.7) tty-screen (~> 0.7) wisper (~> 2.0.0) - tty-screen (0.7.1) - unicode-display_width (1.6.0) + tty-screen (0.8.0) + unicode-display_width (1.7.0) wisper (2.0.1) xmlrpc (0.3.0) yamllint (0.0.9) @@ -168,7 +190,7 @@ DEPENDENCIES json (>= 2.0.2) metadata-json-lint (~> 2.4) os (~> 1.1) - puppet (>= 5, < 6) + puppet (>= 6, < 7) puppet-lint (~> 2.3) puppet-lint-absolute_classname-check (~> 2.0) puppet-lint-absolute_template_path (~> 1.0) @@ -183,7 +205,7 @@ DEPENDENCIES puppetlabs_spec_helper (~> 2.15) r10k (~> 3.5) rspec-puppet (~> 2.6) - rubocop (~> 0.79) + rubocop (~> 0.86) rugged (~> 1.0) tty-command (~> 0.6) tty-file (~> 0.9) @@ -192,4 +214,4 @@ DEPENDENCIES yamllint (~> 0.0.9) BUNDLED WITH - 2.0.2 + 2.1.2 diff --git a/Rakefile b/Rakefile index 0910ef1..2c0be51 100644 --- a/Rakefile +++ b/Rakefile @@ -14,13 +14,8 @@ exclude_paths = [ 'spec/**/*' ] -RuboCop::RakeTask.new(:rubocop) do |task| - # task.patterns = ['lib/**/*.rb'] - # only show the files with failures - # task.formatters = ['files'] - # don't abort rake on failure - # task.fail_on_error = false -end +# https://docs.rubocop.org/rubocop/0.86/integration_with_other_tools.html#rake-integration +RuboCop::RakeTask.new PuppetLint::RakeTask.new :lint do |config| config.fail_on_warnings = true @@ -37,9 +32,9 @@ task :validate do end Dir['bin/**/*.rb', 'spec/**/*.rb'].each do |ruby_file| - # rubocop:disable RegexpLiteral + # rubocop:disable Style/RegexpLiteral sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ - # rubocop:enable RegexpLiteral + # rubocop:enable Style/RegexpLiteral end Dir['puppet/site/*/templates/**/*.erb'].each do |template| sh "erb -P -x -T '-' #{template} | ruby -c" diff --git a/link/nix/zshrc b/link/nix/zshrc index 28c746a..f46e340 100644 --- a/link/nix/zshrc +++ b/link/nix/zshrc @@ -143,6 +143,9 @@ if [[ `uname` == 'Darwin' ]]; then # use homebrew's ruby [ -d /usr/local/opt/ruby/bin ] && export PATH=/usr/local/opt/ruby/bin:$PATH + # hide ruby 2.7's extra output + export RUBYOPT='-W:no-deprecated -W:no-experimental' + # add gems to path GEMBIN="$(gem environment gemdir)/bin" export PATH=$PATH:$GEMBIN diff --git a/puppet/production/Puppetfile b/puppet/production/Puppetfile index b4de430..304f284 100644 --- a/puppet/production/Puppetfile +++ b/puppet/production/Puppetfile @@ -1,11 +1,8 @@ # frozen_string_literal: true forge 'http://forge.puppetlabs.com' - -# rubocop:disable Metrics/LineLength # The next line translates to '../../vendor/puppet_modules' aka ~/.dotfiles/vendor/puppet_modules moduledir "#{File.dirname(File.dirname(File.dirname(__FILE__)))}/vendor/puppet_modules" -# rubocop:enable Metrics/LineLength mod 'puppetlabs-apt', '7.3.0' mod 'puppetlabs-stdlib', '4.25.1' diff --git a/puppet/production/site/custom_libs/lib/facter/os_release.rb b/puppet/production/site/custom_libs/lib/facter/os_release.rb index 3d9f94f..4e5678d 100644 --- a/puppet/production/site/custom_libs/lib/facter/os_release.rb +++ b/puppet/production/site/custom_libs/lib/facter/os_release.rb @@ -13,7 +13,7 @@ Facter.add(:os_release) do line_data = line.split('=') key = line_data[0].downcase - value = line_data[1].strip.gsub(/(^\")|(\"$)/, '') + value = line_data[1].strip.gsub(/(^")|("$)/, '') os_release_hash[key] = value end end