aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Nagy <gabriel.nagy@puppet.com>2021-10-01 14:50:02 +0300
committerGabriel Nagy <gabriel.nagy@puppet.com>2021-10-01 14:50:02 +0300
commited14bbd069d08be4aeb11e3bd723a1d401990ed0 (patch)
tree9a767e04e35b160a1b7b891353339cdfdebd7d75
parent725d4693895c6ec060b16428a918d4cecb85ae2f (diff)
downloadpuppet-hosts_core-ed14bbd069d08be4aeb11e3bd723a1d401990ed0.tar.gz
puppet-hosts_core-ed14bbd069d08be4aeb11e3bd723a1d401990ed0.tar.bz2
(MODULES-11197) Reenable some cops
-rw-r--r--.rubocop.yml24
-rw-r--r--.sync.yml18
-rw-r--r--lib/puppet/type/host.rb4
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