From ed14bbd069d08be4aeb11e3bd723a1d401990ed0 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Fri, 1 Oct 2021 14:50:02 +0300 Subject: (MODULES-11197) Reenable some cops --- .rubocop.yml | 24 +++++++----------------- .sync.yml | 18 ------------------ lib/puppet/type/host.rb | 4 ++-- 3 files changed, 9 insertions(+), 37 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index de02624..3a8c20a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -72,24 +72,8 @@ Style/TrailingCommaInArrayLiteral: Style/SymbolArray: Description: Using percent style obscures symbolic intent of array's contents. EnforcedStyle: brackets -Style/SignalException: - Enabled: false -Style/DoubleNegation: - Enabled: false -Style/MultipleComparison: - Enabled: false -Style/NumericPredicate: - Enabled: false Layout/HeredocIndentation: Enabled: false -Metrics/BlockNesting: - Enabled: false -Naming/AccessorMethodName: - Enabled: false -Naming/PredicateName: - Enabled: false -RSpec/VariableName: - Enabled: false RSpec/MessageSpies: EnforcedStyle: receive Style/Documentation: @@ -121,7 +105,7 @@ Performance/SortReverse: Performance/Squeeze: Enabled: true Performance/StringInclude: - Enabled: false + Enabled: true Performance/Sum: Enabled: true Style/CollectionMethods: @@ -258,6 +242,8 @@ Metrics/AbcSize: Enabled: false Metrics/BlockLength: Enabled: false +Metrics/BlockNesting: + Enabled: false Metrics/ClassLength: Enabled: false Metrics/CyclomaticComplexity: @@ -272,6 +258,8 @@ Metrics/PerceivedComplexity: Enabled: false Migration/DepartmentName: Enabled: false +Naming/AccessorMethodName: + Enabled: false Naming/BlockParameterName: Enabled: false Naming/HeredocDelimiterCase: @@ -444,6 +432,8 @@ Style/MultilineWhenThen: Enabled: false Style/NegatedUnless: Enabled: false +Style/NumericPredicate: + Enabled: false Style/OptionalBooleanParameter: Enabled: false Style/OrAssignment: diff --git a/.sync.yml b/.sync.yml index ee6e834..7df0056 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,27 +1,9 @@ .rubocop.yml: default_configs: - Style/SignalException: - Enabled: false - Style/DoubleNegation: - Enabled: false - Style/MultipleComparison: - Enabled: false - Style/NumericPredicate: - Enabled: false - Style/SignalException: - Enabled: false Layout/HeredocIndentation: Enabled: false Layout/LineLength: Enabled: false - Metrics/BlockNesting: - Enabled: false - Naming/AccessorMethodName: - Enabled: false - Naming/PredicateName: - Enabled: false - RSpec/VariableName: - Enabled: false Gemfile: optional: ":development": diff --git a/lib/puppet/type/host.rb b/lib/puppet/type/host.rb index 0e7a21c..7dd7de8 100644 --- a/lib/puppet/type/host.rb +++ b/lib/puppet/type/host.rb @@ -55,7 +55,7 @@ Puppet::Type.newtype(:host) do newproperty(:comment) do desc 'A comment that will be attached to the line with a # character.' validate do |value| - if value =~ %r{\n} || value =~ %r{\r} + if value.include?("\n") || value.include?("\r") raise Puppet::Error, _('Comment cannot include newline') end end @@ -85,7 +85,7 @@ Puppet::Type.newtype(:host) do raise Puppet::Error, _('Invalid host name') end end - if value =~ %r{\n} || value =~ %r{\r} + if value.include?("\n") || value.include?("\r") raise Puppet::Error, _('Hostname cannot include newline') end end -- cgit v1.2.3