commit b697e513e08e0e54dbb709dd5c96474baee5be35
Author: Michael Moll <kvedulv@kvedulv.de>
Date:   Sat Jun 9 16:50:49 2018 +0200

    Refs #22058 - refresh rubocop config and apply autofixes

diff --git a/.rubocop.yml b/.rubocop.yml
index 6a25a8869..e26a9dd0b 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -5,8 +5,6 @@ inherit_from:
 AllCops:
   TargetRubyVersion: 2.3
   TargetRailsVersion: 5.1
-  Include:
-    - 'app/views/api/**/*.rabl'
   Exclude:
     - 'db/schema.rb'
     - 'node_modules/**/*'
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 1bb6d03ca..87d8e2014 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,12 +1,12 @@
 # This configuration was generated by
 # `rubocop --auto-gen-config --exclude-limit 0`
-# on 2018-04-01 14:49:00 +0200 using RuboCop version 0.54.0.
+# on 2018-06-09 16:44:26 +0200 using RuboCop version 0.54.0.
 # 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
 # versions of RuboCop, may require this file to be generated again.
 
-# Offense count: 624
+# Offense count: 635
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
 # SupportedHashRocketStyles: key, separator, table
@@ -15,7 +15,7 @@
 Layout/AlignHash:
   Enabled: false
 
-# Offense count: 609
+# Offense count: 622
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, IndentationWidth.
 # SupportedStyles: with_first_parameter, with_fixed_indentation
@@ -29,59 +29,59 @@ Layout/AlignParameters:
 Layout/CaseIndentation:
   Enabled: false
 
-# Offense count: 29
+# Offense count: 34
 # Cop supports --auto-correct.
 Layout/ClosingParenthesisIndentation:
   Enabled: false
 
-# Offense count: 44
+# Offense count: 55
 # Cop supports --auto-correct.
 # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
 Layout/ExtraSpacing:
   Enabled: false
 
-# Offense count: 31
+# Offense count: 30
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
 Layout/IndentHeredoc:
   Enabled: false
 
-# Offense count: 173
+# Offense count: 177
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: symmetrical, new_line, same_line
 Layout/MultilineHashBraceLayout:
   Enabled: false
 
-# Offense count: 68
+# Offense count: 72
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: symmetrical, new_line, same_line
 Layout/MultilineMethodCallBraceLayout:
   Enabled: false
 
-# Offense count: 83
+# Offense count: 89
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, IndentationWidth.
 # SupportedStyles: aligned, indented, indented_relative_to_receiver
 Layout/MultilineMethodCallIndentation:
   Enabled: false
 
-# Offense count: 68
+# Offense count: 71
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, IndentationWidth.
 # SupportedStyles: aligned, indented
 Layout/MultilineOperationIndentation:
   Enabled: false
 
-# Offense count: 902
+# Offense count: 941
 # Cop supports --auto-correct.
 # Configuration parameters: AllowForAlignment.
 Layout/SpaceAroundOperators:
   Enabled: false
 
-# Offense count: 94
+# Offense count: 95
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: space, no_space
@@ -89,7 +89,7 @@ Layout/SpaceAroundOperators:
 Layout/SpaceBeforeBlockBraces:
   Enabled: false
 
-# Offense count: 341
+# Offense count: 350
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
 # SupportedStyles: space, no_space, compact
@@ -97,7 +97,7 @@ Layout/SpaceBeforeBlockBraces:
 Layout/SpaceInsideArrayLiteralBrackets:
   Enabled: false
 
-# Offense count: 520
+# Offense count: 529
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
 # SupportedStyles: space, no_space
@@ -105,7 +105,7 @@ Layout/SpaceInsideArrayLiteralBrackets:
 Layout/SpaceInsideBlockBraces:
   Enabled: false
 
-# Offense count: 3412
+# Offense count: 3507
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
 # SupportedStyles: space, no_space, compact
@@ -113,11 +113,11 @@ Layout/SpaceInsideBlockBraces:
 Layout/SpaceInsideHashLiteralBraces:
   Enabled: false
 
-# Offense count: 39
+# Offense count: 43
 Lint/AmbiguousBlockAssociation:
   Enabled: false
 
-# Offense count: 121
+# Offense count: 122
 Lint/AmbiguousRegexpLiteral:
   Enabled: false
 
@@ -129,7 +129,7 @@ Lint/BooleanSymbol:
 Lint/DuplicateMethods:
   Enabled: false
 
-# Offense count: 13
+# Offense count: 14
 Lint/HandleExceptions:
   Enabled: false
 
@@ -137,7 +137,7 @@ Lint/HandleExceptions:
 Lint/NonLocalExitFromIterator:
   Enabled: false
 
-# Offense count: 21
+# Offense count: 23
 Lint/ParenthesesAsGroupedExpression:
   Enabled: false
 
@@ -145,13 +145,13 @@ Lint/ParenthesesAsGroupedExpression:
 Lint/ShadowingOuterLocalVariable:
   Enabled: false
 
-# Offense count: 96
+# Offense count: 102
 # Cop supports --auto-correct.
 # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
 Lint/UnusedBlockArgument:
   Enabled: false
 
-# Offense count: 112
+# Offense count: 113
 # Cop supports --auto-correct.
 # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
 Lint/UnusedMethodArgument:
@@ -166,16 +166,16 @@ Lint/UriEscapeUnescape:
 Lint/Void:
   Enabled: false
 
-# Offense count: 602
+# Offense count: 604
 Metrics/AbcSize:
   Max: 128
 
-# Offense count: 317
+# Offense count: 345
 # Configuration parameters: CountComments, ExcludedMethods.
 Metrics/BlockLength:
-  Max: 1336
+  Max: 1342
 
-# Offense count: 12
+# Offense count: 14
 # Configuration parameters: CountBlocks.
 Metrics/BlockNesting:
   Max: 6
@@ -183,19 +183,19 @@ Metrics/BlockNesting:
 # Offense count: 59
 # Configuration parameters: CountComments.
 Metrics/ClassLength:
-  Max: 755
+  Max: 746
 
-# Offense count: 153
+# Offense count: 150
 Metrics/CyclomaticComplexity:
   Max: 24
 
-# Offense count: 11026
+# Offense count: 11621
 # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
 # URISchemes: http, https
 Metrics/LineLength:
   Max: 385
 
-# Offense count: 508
+# Offense count: 522
 # Configuration parameters: CountComments.
 Metrics/MethodLength:
   Max: 176
@@ -210,11 +210,11 @@ Metrics/ModuleLength:
 Metrics/ParameterLists:
   Max: 7
 
-# Offense count: 126
+# Offense count: 125
 Metrics/PerceivedComplexity:
   Max: 25
 
-# Offense count: 40
+# Offense count: 42
 Naming/AccessorMethodName:
   Enabled: false
 
@@ -222,19 +222,19 @@ Naming/AccessorMethodName:
 Naming/BinaryOperatorParameterName:
   Enabled: false
 
-# Offense count: 22
+# Offense count: 20
 # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
 # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
 Naming/FileName:
   Enabled: false
 
-# Offense count: 24
+# Offense count: 29
 # Configuration parameters: Blacklist.
 # Blacklist: END, (?-mix:EO[A-Z]{1})
 Naming/HeredocDelimiterNaming:
   Enabled: false
 
-# Offense count: 20
+# Offense count: 21
 Naming/MemoizedInstanceVariableName:
   Enabled: false
 
@@ -253,13 +253,13 @@ Naming/MethodName:
 Naming/PredicateName:
   Enabled: false
 
-# Offense count: 145
+# Offense count: 150
 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
 # AllowedNames: io, id, to
 Naming/UncommunicativeMethodParamName:
   Enabled: false
 
-# Offense count: 40
+# Offense count: 46
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: snake_case, normalcase, non_integer
 Naming/VariableNumber:
@@ -277,14 +277,14 @@ Rails/CreateTableWithTimestamps:
 Rails/Date:
   Enabled: false
 
-# Offense count: 458
+# Offense count: 494
 # Cop supports --auto-correct.
 # Configuration parameters: Whitelist.
 # Whitelist: find_by_sql
 Rails/DynamicFindBy:
   Enabled: false
 
-# Offense count: 24
+# Offense count: 25
 Rails/FilePath:
   Enabled: false
 
@@ -294,13 +294,13 @@ Rails/FilePath:
 Rails/HasAndBelongsToMany:
   Enabled: false
 
-# Offense count: 50
+# Offense count: 49
 # Configuration parameters: Include.
 # Include: app/models/**/*.rb
 Rails/HasManyOrHasOneDependent:
   Enabled: false
 
-# Offense count: 72
+# Offense count: 73
 # Configuration parameters: Include.
 # Include: app/models/**/*.rb
 Rails/InverseOf:
@@ -318,7 +318,7 @@ Rails/LexicallyScopedActionFilter:
 Rails/Output:
   Enabled: false
 
-# Offense count: 101
+# Offense count: 103
 Rails/OutputSafety:
   Enabled: false
 
@@ -328,13 +328,13 @@ Rails/OutputSafety:
 Rails/ReversibleMigration:
   Enabled: false
 
-# Offense count: 350
+# Offense count: 359
 # Configuration parameters: Blacklist.
 # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
 Rails/SkipsModelValidations:
   Enabled: false
 
-# Offense count: 12
+# Offense count: 13
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: strict, flexible
 Rails/TimeZone:
@@ -351,14 +351,14 @@ Security/JSONLoad:
 Security/YAMLLoad:
   Enabled: false
 
-# Offense count: 520
+# Offense count: 533
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: braces, no_braces, context_dependent
 Style/BracesAroundHashParameters:
   Enabled: false
 
-# Offense count: 229
+# Offense count: 231
 # Cop supports --auto-correct.
 # Configuration parameters: AutoCorrect, EnforcedStyle.
 # SupportedStyles: nested, compact
@@ -380,7 +380,7 @@ Style/CommentAnnotation:
 Style/CommentedKeyword:
   Enabled: false
 
-# Offense count: 29
+# Offense count: 30
 Style/DoubleNegation:
   Enabled: false
 
@@ -391,7 +391,7 @@ Style/DoubleNegation:
 Style/EmptyMethod:
   Enabled: false
 
-# Offense count: 47
+# Offense count: 48
 # Cop supports --auto-correct.
 Style/ExpandPathArguments:
   Enabled: false
@@ -402,14 +402,14 @@ Style/ExpandPathArguments:
 Style/For:
   Enabled: false
 
-# Offense count: 148
+# Offense count: 152
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: format, sprintf, percent
 Style/FormatString:
   Enabled: false
 
-# Offense count: 378
+# Offense count: 379
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: annotated, template, unannotated
 Style/FormatStringToken:
@@ -429,7 +429,7 @@ Style/GuardClause:
 Style/IdenticalConditionalBranches:
   Enabled: false
 
-# Offense count: 14
+# Offense count: 15
 Style/IfInsideElse:
   Enabled: false
 
@@ -442,16 +442,16 @@ Style/IfUnlessModifierOfIfUnless:
 Style/LineEndConcatenation:
   Enabled: false
 
-# Offense count: 54
+# Offense count: 61
 # Cop supports --auto-correct.
 Style/MethodCallWithoutArgsParentheses:
   Enabled: false
 
-# Offense count: 6
+# Offense count: 5
 Style/MixinUsage:
   Enabled: false
 
-# Offense count: 45
+# Offense count: 37
 # Cop supports --auto-correct.
 Style/MultilineIfModifier:
   Enabled: false
@@ -460,12 +460,12 @@ Style/MultilineIfModifier:
 Style/MultipleComparison:
   Enabled: false
 
-# Offense count: 114
+# Offense count: 111
 # Cop supports --auto-correct.
 Style/MutableConstant:
   Enabled: false
 
-# Offense count: 21
+# Offense count: 23
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, MinBodyLength.
 # SupportedStyles: skip_modifier_ifs, always
@@ -479,13 +479,13 @@ Style/Next:
 Style/NumericLiteralPrefix:
   Enabled: false
 
-# Offense count: 36
+# Offense count: 48
 # Cop supports --auto-correct.
 # Configuration parameters: Strict.
 Style/NumericLiterals:
   MinDigits: 15
 
-# Offense count: 18
+# Offense count: 52
 # Cop supports --auto-correct.
 # Configuration parameters: AutoCorrect, EnforcedStyle.
 # SupportedStyles: predicate, comparison
@@ -497,19 +497,19 @@ Style/NumericPredicate:
 Style/ParallelAssignment:
   Enabled: false
 
-# Offense count: 30
+# Offense count: 28
 # Cop supports --auto-correct.
 # Configuration parameters: AllowSafeAssignment.
 Style/ParenthesesAroundCondition:
   Enabled: false
 
-# Offense count: 185
+# Offense count: 189
 # Cop supports --auto-correct.
 # Configuration parameters: PreferredDelimiters.
 Style/PercentLiteralDelimiters:
   Enabled: false
 
-# Offense count: 58
+# Offense count: 71
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: short, verbose
@@ -521,31 +521,31 @@ Style/PreferredHashMethods:
 Style/Proc:
   Enabled: false
 
-# Offense count: 54
+# Offense count: 53
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: compact, exploded
 Style/RaiseArgs:
   Enabled: false
 
-# Offense count: 648
+# Offense count: 684
 # Cop supports --auto-correct.
 Style/RedundantSelf:
   Enabled: false
 
-# Offense count: 56
+# Offense count: 59
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
 # SupportedStyles: slashes, percent_r, mixed
 Style/RegexpLiteral:
   Enabled: false
 
-# Offense count: 56
+# Offense count: 55
 # Cop supports --auto-correct.
 Style/RescueModifier:
   Enabled: false
 
-# Offense count: 174
+# Offense count: 176
 # Cop supports --auto-correct.
 # Configuration parameters: EnforcedStyle.
 # SupportedStyles: implicit, explicit
@@ -563,14 +563,14 @@ Style/SignalException:
 Style/StructInheritance:
   Enabled: false
 
-# Offense count: 797
+# Offense count: 816
 # Cop supports --auto-correct.
 # Configuration parameters: MinSize.
 # SupportedStyles: percent, brackets
 Style/SymbolArray:
   EnforcedStyle: brackets
 
-# Offense count: 85
+# Offense count: 92
 # Cop supports --auto-correct.
 # Configuration parameters: IgnoredMethods.
 # IgnoredMethods: respond_to, define_method
diff --git a/app/controllers/api/v2/autosign_controller.rb b/app/controllers/api/v2/autosign_controller.rb
index 8f4c2eafe..87114008b 100644
--- a/app/controllers/api/v2/autosign_controller.rb
+++ b/app/controllers/api/v2/autosign_controller.rb
@@ -41,7 +41,7 @@ module Api
       end
 
       def handle_proxy_error(exception)
-        render :status => 500, :json => { error: exception.message }
+        render :status => :internal_server_error, :json => { error: exception.message }
       end
     end
   end
diff --git a/app/models/auth_sources/auth_source_ldap.rb b/app/models/auth_sources/auth_source_ldap.rb
index a3913a5a0..7d5d660f7 100644
--- a/app/models/auth_sources/auth_source_ldap.rb
+++ b/app/models/auth_sources/auth_source_ldap.rb
@@ -236,7 +236,9 @@ class AuthSourceLdap < AuthSource
 
   def validate_ldap_filter
     Net::LDAP::Filter.construct(ldap_filter)
+  # rubocop:disable Lint/ShadowedException, Lint/UnneededCopDisableDirective
   rescue Net::LDAP::Error, Net::LDAP::LdapError, Net::LDAP::FilterSyntaxInvalidError => e
+    # rubocop:enable Lint/ShadowedException, Lint/UnneededCopDisableDirective
     message = _("invalid LDAP filter syntax")
     Foreman::Logging.exception(message, e)
     errors.add(:ldap_filter, message)
diff --git a/app/views/api/v2/trends/base.json.rabl b/app/views/api/v2/trends/base.json.rabl
index 23a0a87f4..8a6454ccb 100644
--- a/app/views/api/v2/trends/base.json.rabl
+++ b/app/views/api/v2/trends/base.json.rabl
@@ -1,4 +1,4 @@
 object @trend
 
 attributes :id, :trendable_type, :trendable_id, :fact_name, :type, :name
-attribute to_label: :label
\ No newline at end of file
+attribute to_label: :label
diff --git a/lib/tasks/exception.rake b/lib/tasks/exception.rake
index 0325eae52..e0201f49f 100644
--- a/lib/tasks/exception.rake
+++ b/lib/tasks/exception.rake
@@ -1,4 +1,3 @@
-
 desc 'Exception utilities'
 namespace :exception do
   desc 'List all error codes'
diff --git a/lib/tasks/seed.rake b/lib/tasks/seed.rake
index 1a7b7064e..dd70b4aa8 100644
--- a/lib/tasks/seed.rake
+++ b/lib/tasks/seed.rake
@@ -1,4 +1,3 @@
-
 namespace :seed do
   desc 'Generate various forgeries. This should not be used in production'
   task :forgeries => %w[forgeries:all]
