From 54db10d91bb5da04f8f4fb9d66138aba9e5e38a4 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Tue, 17 Aug 2021 09:46:58 -0700 Subject: (maint) Fix rubocop errors Took the safest route and disabled cops either globally in .rubocop.yml for just for specific cases in lib/ --- .rubocop.yml | 16 +++++++++++++--- lib/puppet/provider/cron/crontab.rb | 2 +- lib/puppet/provider/cron/filetype.rb | 2 +- lib/puppet/type/cron.rb | 2 +- spec/lib/puppet_spec/files.rb | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index d3ec06c..03b1242 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,7 +20,7 @@ AllCops: - "**/Guardfile" Layout/LineLength: Description: People have wide screens, use them. - Max: 200 + Enabled: false RSpec/BeforeAfterAll: Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing. @@ -71,8 +71,6 @@ Style/TrailingCommaInArrayLiteral: Style/SymbolArray: Description: Using percent style obscures symbolic intent of array's contents. EnforcedStyle: brackets -Metrics/LineLength: - Max: 260 RSpec/NamedSubject: Enabled: false RSpec/MessageSpies: @@ -137,6 +135,8 @@ Layout/EmptyLineAfterGuardClause: Enabled: false Layout/EmptyLinesAroundArguments: Enabled: false +Layout/EmptyLinesAroundBlockBody: + Enabled: false Layout/EmptyLinesAroundAttributeAccessor: Enabled: false Layout/EndOfLine: @@ -285,6 +285,8 @@ Performance/DeleteSuffix: Enabled: false Performance/InefficientHashSearch: Enabled: false +Performance/RegexpMatch: + Enabled: false Performance/UnfreezeString: Enabled: false Performance/UriDefaultParser: @@ -315,6 +317,8 @@ RSpec/ExampleLength: Enabled: false RSpec/ExampleWithoutDescription: Enabled: false +RSpec/ExampleWording: + Enabled: false RSpec/ExpectChange: Enabled: false RSpec/ExpectInHook: @@ -363,6 +367,8 @@ RSpec/SharedExamples: Enabled: false RSpec/StubbedMock: Enabled: false +RSpec/SubjectStub: + Enabled: false RSpec/UnspecifiedException: Enabled: false RSpec/VariableDefinition: @@ -457,12 +463,16 @@ Style/RedundantRegexpCharacterClass: Enabled: false Style/RedundantRegexpEscape: Enabled: false +Style/RedundantReturn: + Enabled: false Style/RedundantSelfAssignment: Enabled: false Style/RedundantSort: Enabled: false Style/RescueStandardError: Enabled: false +Style/SafeNavigation: + Enabled: false Style/SingleArgumentDig: Enabled: false Style/SlicingWithRange: diff --git a/lib/puppet/provider/cron/crontab.rb b/lib/puppet/provider/cron/crontab.rb index 9144725..12ad7f1 100644 --- a/lib/puppet/provider/cron/crontab.rb +++ b/lib/puppet/provider/cron/crontab.rb @@ -207,7 +207,7 @@ Puppet::Type.type(:cron).provide(:crontab, parent: Puppet::Provider::ParsedFile, envs << record[:line] record[:skip] = true end - when :blank # rubocop: disable Lint/EmptyWhen + when :blank # nothing else if name diff --git a/lib/puppet/provider/cron/filetype.rb b/lib/puppet/provider/cron/filetype.rb index c381afa..153285d 100644 --- a/lib/puppet/provider/cron/filetype.rb +++ b/lib/puppet/provider/cron/filetype.rb @@ -26,7 +26,7 @@ class Puppet::Provider::Cron # implementation in the future. This way, we can refactor all three of # our cron file types into a common crontab file type. newfiletype(:crontab) do - def initialize(user) + def initialize(user) # rubocop:disable Lint/MissingSuper self.path = user end diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb index a536410..37188b4 100644 --- a/lib/puppet/type/cron.rb +++ b/lib/puppet/type/cron.rb @@ -118,7 +118,7 @@ Puppet::Type.newtype(:cron) do end end - def is_to_s(value = @is) # rubocop: disable Style/PredicateName + def is_to_s(value = @is) # rubocop: disable Naming/PredicateName if value if value.is_a?(Array) && (name == :command || value[0].is_a?(Symbol)) value = value[0] diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb index af0e936..7a43100 100644 --- a/spec/lib/puppet_spec/files.rb +++ b/spec/lib/puppet_spec/files.rb @@ -12,7 +12,7 @@ module PuppetSpec::Files begin allow(Dir).to receive(:entries).and_call_original FileUtils.rm_rf path, secure: true - rescue Errno::ENOENT # rubocop:disable Lint/HandleExceptions + rescue Errno::ENOENT # nothing to do end end -- cgit v1.2.3