From 665b06098bebbe36eba5dd1d67c0341980a24803 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Sat, 26 Aug 2023 07:39:21 +0200 Subject: [PATCH] added some unsafe rubocop fixes --- .rubocop_todo.yml | 25 ++++++++++++------- Gemfile | 2 ++ Rakefile | 2 ++ puppet-ghostbuster.gemspec | 2 ++ spec/fixtures/modules/foo/lib/facter/bar.rb | 2 ++ spec/fixtures/modules/foo/lib/facter/baz.rb | 2 ++ spec/fixtures/modules/foo/lib/facter/foo.rb | 2 ++ spec/fixtures/modules/foo/lib/facter/multi.rb | 2 ++ spec/fixtures/modules/foo/lib/facter/quux.rb | 2 ++ .../foo/lib/puppet/parser/functions/bar.rb | 10 ++++++-- .../foo/lib/puppet/parser/functions/baz.rb | 10 ++++++-- .../foo/lib/puppet/parser/functions/foo.rb | 10 ++++++-- .../foo/lib/puppet/parser/functions/quux.rb | 10 ++++++-- .../modules/foo/lib/puppet/type/bar.rb | 2 ++ .../modules/foo/lib/puppet/type/foo.rb | 2 ++ .../plugins/ghostbuster_classes_spec.rb | 2 ++ .../plugins/ghostbuster_defines_spec.rb | 2 ++ .../plugins/ghostbuster_facts_spec.rb | 2 ++ .../plugins/ghostbuster_files_spec.rb | 2 ++ .../plugins/ghostbuster_functions_spec.rb | 2 ++ .../plugins/ghostbuster_hiera_files_spec.rb | 2 ++ .../plugins/ghostbuster_templates_spec.rb | 2 ++ .../plugins/ghostbuster_types_spec.rb | 2 ++ 23 files changed, 84 insertions(+), 17 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 31723d3..5f4d343 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-08-23 17:58:31 UTC using RuboCop version 1.54.2. +# on 2023-08-26 05:38:06 UTC using RuboCop version 1.54.2. # 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 @@ -77,7 +77,7 @@ RSpec/RepeatedDescription: Exclude: - 'spec/puppet-lint/plugins/ghostbuster_facts_spec.rb' -# Offense count: 13 +# Offense count: 9 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: nested, compact @@ -91,13 +91,9 @@ Style/ClassAndModuleChildren: - 'lib/puppet-lint/plugins/check_ghostbuster_hiera_files.rb' - 'lib/puppet-lint/plugins/check_ghostbuster_templates.rb' - 'lib/puppet-lint/plugins/check_ghostbuster_types.rb' - - 'spec/fixtures/modules/foo/lib/puppet/parser/functions/bar.rb' - - 'spec/fixtures/modules/foo/lib/puppet/parser/functions/baz.rb' - - 'spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb' - - 'spec/fixtures/modules/foo/lib/puppet/parser/functions/quux.rb' - 'spec/spec_helper.rb' -# Offense count: 3 +# Offense count: 5 Style/ClassVars: Exclude: - 'lib/puppet-ghostbuster/puppetdb.rb' @@ -118,12 +114,23 @@ Style/Documentation: - 'lib/puppet-lint/plugins/check_ghostbuster_templates.rb' - 'lib/puppet-lint/plugins/check_ghostbuster_types.rb' -# Offense count: 33 +# Offense count: 11 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: - Enabled: false + Exclude: + - 'lib/puppet-ghostbuster/puppetdb.rb' + - 'lib/puppet-ghostbuster/version.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_classes.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_defines.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_facts.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_files.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_functions.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_hiera_files.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_templates.rb' + - 'lib/puppet-lint/plugins/check_ghostbuster_types.rb' + - 'spec/spec_helper.rb' # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). diff --git a/Gemfile b/Gemfile index b9ddab0..a669e4c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source ENV['GEM_SOURCE'] || 'https://rubygems.org' gemspec diff --git a/Rakefile b/Rakefile index 60a342a..4cda023 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) diff --git a/puppet-ghostbuster.gemspec b/puppet-ghostbuster.gemspec index 03e0bbd..59a36ed 100644 --- a/puppet-ghostbuster.gemspec +++ b/puppet-ghostbuster.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + $LOAD_PATH.unshift File.expand_path('lib', __dir__) require 'puppet-ghostbuster/version' diff --git a/spec/fixtures/modules/foo/lib/facter/bar.rb b/spec/fixtures/modules/foo/lib/facter/bar.rb index b1b0f96..10e5a8e 100644 --- a/spec/fixtures/modules/foo/lib/facter/bar.rb +++ b/spec/fixtures/modules/foo/lib/facter/bar.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Fact used in manifest Facter.add('bar') do setcode do diff --git a/spec/fixtures/modules/foo/lib/facter/baz.rb b/spec/fixtures/modules/foo/lib/facter/baz.rb index 23f63df..d5c44fb 100644 --- a/spec/fixtures/modules/foo/lib/facter/baz.rb +++ b/spec/fixtures/modules/foo/lib/facter/baz.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Fact used in template Facter.add('baz') do setcode do diff --git a/spec/fixtures/modules/foo/lib/facter/foo.rb b/spec/fixtures/modules/foo/lib/facter/foo.rb index a58426c..59a1c1b 100644 --- a/spec/fixtures/modules/foo/lib/facter/foo.rb +++ b/spec/fixtures/modules/foo/lib/facter/foo.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Fact used in a string Facter.add('foo') do setcode do diff --git a/spec/fixtures/modules/foo/lib/facter/multi.rb b/spec/fixtures/modules/foo/lib/facter/multi.rb index d5324ad..2276d7d 100644 --- a/spec/fixtures/modules/foo/lib/facter/multi.rb +++ b/spec/fixtures/modules/foo/lib/facter/multi.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Unused facts Facter.add('multi1') do setcode do diff --git a/spec/fixtures/modules/foo/lib/facter/quux.rb b/spec/fixtures/modules/foo/lib/facter/quux.rb index a824b86..2d63b3f 100644 --- a/spec/fixtures/modules/foo/lib/facter/quux.rb +++ b/spec/fixtures/modules/foo/lib/facter/quux.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Fact used in inline_template Facter.add('quux') do setcode do diff --git a/spec/fixtures/modules/foo/lib/puppet/parser/functions/bar.rb b/spec/fixtures/modules/foo/lib/puppet/parser/functions/bar.rb index e0308cd..9eafa65 100644 --- a/spec/fixtures/modules/foo/lib/puppet/parser/functions/bar.rb +++ b/spec/fixtures/modules/foo/lib/puppet/parser/functions/bar.rb @@ -1,4 +1,10 @@ -module Puppet::Parser::Functions - newfunction(:bar, type: :rvalue) do |arguments| +# frozen_string_literal: true + +module Puppet + module Parser + module Functions + newfunction(:bar, type: :rvalue) do |arguments| + end + end end end diff --git a/spec/fixtures/modules/foo/lib/puppet/parser/functions/baz.rb b/spec/fixtures/modules/foo/lib/puppet/parser/functions/baz.rb index dcf4856..8f48373 100644 --- a/spec/fixtures/modules/foo/lib/puppet/parser/functions/baz.rb +++ b/spec/fixtures/modules/foo/lib/puppet/parser/functions/baz.rb @@ -1,4 +1,10 @@ -module Puppet::Parser::Functions - newfunction(:baz, type: :rvalue) do |arguments| +# frozen_string_literal: true + +module Puppet + module Parser + module Functions + newfunction(:baz, type: :rvalue) do |arguments| + end + end end end diff --git a/spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb b/spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb index fc2d132..a42c730 100644 --- a/spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb +++ b/spec/fixtures/modules/foo/lib/puppet/parser/functions/foo.rb @@ -1,4 +1,10 @@ -module Puppet::Parser::Functions - newfunction(:foo, type: :rvalue) do |arguments| +# frozen_string_literal: true + +module Puppet + module Parser + module Functions + newfunction(:foo, type: :rvalue) do |arguments| + end + end end end diff --git a/spec/fixtures/modules/foo/lib/puppet/parser/functions/quux.rb b/spec/fixtures/modules/foo/lib/puppet/parser/functions/quux.rb index 1f84c4d..068a77d 100644 --- a/spec/fixtures/modules/foo/lib/puppet/parser/functions/quux.rb +++ b/spec/fixtures/modules/foo/lib/puppet/parser/functions/quux.rb @@ -1,4 +1,10 @@ -module Puppet::Parser::Functions - newfunction(:quux, type: :rvalue) do |arguments| +# frozen_string_literal: true + +module Puppet + module Parser + module Functions + newfunction(:quux, type: :rvalue) do |arguments| + end + end end end diff --git a/spec/fixtures/modules/foo/lib/puppet/type/bar.rb b/spec/fixtures/modules/foo/lib/puppet/type/bar.rb index 850dd29..2c8753b 100644 --- a/spec/fixtures/modules/foo/lib/puppet/type/bar.rb +++ b/spec/fixtures/modules/foo/lib/puppet/type/bar.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + Puppet::Type.newtype(:bar) do end diff --git a/spec/fixtures/modules/foo/lib/puppet/type/foo.rb b/spec/fixtures/modules/foo/lib/puppet/type/foo.rb index 81eb2c4..7bf210c 100644 --- a/spec/fixtures/modules/foo/lib/puppet/type/foo.rb +++ b/spec/fixtures/modules/foo/lib/puppet/type/foo.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + Puppet::Type.newtype(:foo) do end diff --git a/spec/puppet-lint/plugins/ghostbuster_classes_spec.rb b/spec/puppet-lint/plugins/ghostbuster_classes_spec.rb index e35d18a..4952949 100644 --- a/spec/puppet-lint/plugins/ghostbuster_classes_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_classes_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ghostbuster_classes' do diff --git a/spec/puppet-lint/plugins/ghostbuster_defines_spec.rb b/spec/puppet-lint/plugins/ghostbuster_defines_spec.rb index 097b5e0..68b7683 100644 --- a/spec/puppet-lint/plugins/ghostbuster_defines_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_defines_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ghostbuster_defines' do diff --git a/spec/puppet-lint/plugins/ghostbuster_facts_spec.rb b/spec/puppet-lint/plugins/ghostbuster_facts_spec.rb index 47f94e4..0356fdc 100644 --- a/spec/puppet-lint/plugins/ghostbuster_facts_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_facts_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ghostbuster_facts' do diff --git a/spec/puppet-lint/plugins/ghostbuster_files_spec.rb b/spec/puppet-lint/plugins/ghostbuster_files_spec.rb index d6a5ce3..280772d 100644 --- a/spec/puppet-lint/plugins/ghostbuster_files_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_files_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ghostbuster_files' do diff --git a/spec/puppet-lint/plugins/ghostbuster_functions_spec.rb b/spec/puppet-lint/plugins/ghostbuster_functions_spec.rb index 5b06182..30786ad 100644 --- a/spec/puppet-lint/plugins/ghostbuster_functions_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_functions_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ghostbuster_functions' do diff --git a/spec/puppet-lint/plugins/ghostbuster_hiera_files_spec.rb b/spec/puppet-lint/plugins/ghostbuster_hiera_files_spec.rb index d310eec..9b5031e 100644 --- a/spec/puppet-lint/plugins/ghostbuster_hiera_files_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_hiera_files_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' ENV['HIERA_YAML_PATH'] = './spec/fixtures/hiera.yaml' diff --git a/spec/puppet-lint/plugins/ghostbuster_templates_spec.rb b/spec/puppet-lint/plugins/ghostbuster_templates_spec.rb index 4794fea..04871f5 100644 --- a/spec/puppet-lint/plugins/ghostbuster_templates_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_templates_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ghostbuster_templates' do diff --git a/spec/puppet-lint/plugins/ghostbuster_types_spec.rb b/spec/puppet-lint/plugins/ghostbuster_types_spec.rb index cfb6495..6acbcdb 100644 --- a/spec/puppet-lint/plugins/ghostbuster_types_spec.rb +++ b/spec/puppet-lint/plugins/ghostbuster_types_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'ghostbuster_types' do