Skip to content

Commit

Permalink
Regenerate Rubocop's todo & make it happy
Browse files Browse the repository at this point in the history
  • Loading branch information
stejskalleos committed Jan 21, 2025
1 parent 91b9e2b commit fd64b8a
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 71 deletions.
40 changes: 16 additions & 24 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-10-04 07:15:50 UTC using RuboCop version 1.23.0.
# on 2025-01-21 09:43:55 UTC using RuboCop version 1.23.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
Expand Down Expand Up @@ -264,7 +264,7 @@ Layout/SpaceAfterNot:
Exclude:
- 'app/lib/facter_utils.rb'

# Offense count: 11
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
# SupportedStylesForExponentOperator: space, no_space
Expand Down Expand Up @@ -327,7 +327,7 @@ Layout/SpaceInsideBlockBraces:
- 'test/functional/api/v2/discovery_rules_controller_test.rb'
- 'test/test_helper_discovery.rb'

# Offense count: 200
# Offense count: 198
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
Expand All @@ -345,15 +345,13 @@ Layout/SpaceInsideParens:
- 'app/helpers/discovered_hosts_helper.rb'
- 'test/unit/discovery_rule_test.rb'

# Offense count: 3
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: final_newline, final_blank_line
Layout/TrailingEmptyLines:
Exclude:
- 'app/services/foreman_discovery/fact_to_category_resolver.rb'
- 'db/migrate/20141126165451_add_discovery_id_to_subnet.rb'
- 'locale/action_names.rb'

# Offense count: 4
# Cop supports --auto-correct.
Expand Down Expand Up @@ -437,7 +435,7 @@ Lint/SendWithMixinArgument:
Exclude:
- 'lib/foreman_discovery/engine.rb'

# Offense count: 6
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Expand Down Expand Up @@ -471,11 +469,11 @@ Lint/UselessMethodDefinition:
Metrics/AbcSize:
Max: 78

# Offense count: 20
# Offense count: 21
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# IgnoredMethods: refine
Metrics/BlockLength:
Max: 433
Max: 257

# Offense count: 11
# Configuration parameters: CountComments, CountAsOne.
Expand All @@ -497,7 +495,7 @@ Metrics/MethodLength:
Metrics/ParameterLists:
MaxOptionalParameters: 4

# Offense count: 5
# Offense count: 4
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 23
Expand Down Expand Up @@ -549,10 +547,9 @@ Minitest/RefuteNil:
Exclude:
- 'test/functional/api/v2/discovery_rules_controller_test.rb'

# Offense count: 4
# Offense count: 3
Naming/AccessorMethodName:
Exclude:
- 'app/controllers/discovered_hosts_controller.rb'
- 'app/controllers/discovery_rules_controller.rb'
- 'app/services/foreman_discovery/host_converter.rb'
- 'test/test_helper_discovery.rb'
Expand Down Expand Up @@ -793,8 +790,6 @@ Style/ClassAndModuleChildren:
- 'app/services/foreman_discovery/node_api/power_service.rb'
- 'test/functional/api/v2/discovered_hosts_controller_test.rb'
- 'test/functional/api/v2/discovery_rules_controller_test.rb'
- 'app/controllers/concerns/foreman/controller/parameters/discovered_host.rb'
- 'app/controllers/concerns/foreman/controller/parameters/discovery_rule.rb'

# Offense count: 2
# Cop supports --auto-correct.
Expand All @@ -812,15 +807,14 @@ Style/ColonMethodCall:
- 'app/services/foreman_discovery/fact_parser.rb'
- 'test/functional/api/v2/discovered_hosts_controller_test.rb'

# Offense count: 7
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment:
Exclude:
- 'app/helpers/discovery_rules_helper.rb'
- 'app/models/host/discovered.rb'
- 'lib/foreman_discovery.rake'
- 'test/functional/discovered_hosts_controller_test.rb'
- 'test/unit/discovered_extensions_test.rb'

Expand Down Expand Up @@ -853,7 +847,7 @@ Style/FormatStringToken:
- 'app/services/foreman_discovery/fact_parser.rb'
- 'app/services/foreman_discovery/node_api/node_resource.rb'

# Offense count: 106
# Offense count: 107
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Expand Down Expand Up @@ -901,7 +895,7 @@ Style/HashEachMethods:
- 'app/services/foreman_discovery/import_hooks/discovery_attribute.rb'
- 'app/services/foreman_discovery/lldp_neighbors.rb'

# Offense count: 1080
# Offense count: 1075
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
Expand Down Expand Up @@ -1052,11 +1046,10 @@ Style/RedundantBegin:
- 'test/unit/discovery_attribute_set_test.rb'
- 'test/unit/host_discovered_test.rb'

# Offense count: 2
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantCondition:
Exclude:
- 'app/controllers/discovered_hosts_controller.rb'
- 'extra/discover-host'

# Offense count: 1
Expand Down Expand Up @@ -1097,14 +1090,13 @@ Style/RedundantSelf:
- 'app/models/nic/managed_extensions.rb'
- 'app/services/foreman_discovery/lldp_neighbors.rb'

# Offense count: 5
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'config/routes.rb'
- 'test/functional/discovery_rules_controller_test.rb'
- 'test/unit/managed_extensions_test.rb'

# Offense count: 4
Expand Down Expand Up @@ -1161,7 +1153,7 @@ Style/StringConcatenation:
- 'test/factories/discovery_host_related.rb'
- 'test/unit/discovery_rule_test.rb'

# Offense count: 1000
# Offense count: 984
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Expand Down Expand Up @@ -1249,7 +1241,7 @@ Style/ZeroLengthPredicate:
- 'app/services/foreman_discovery/fact_parser.rb'
- 'db/migrate/20150331132115_remove_old_permissions.rb'

# Offense count: 153
# Offense count: 152
# Cop supports --auto-correct.
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
module Foreman::Controller::Parameters::DiscoveredHost
extend ActiveSupport::Concern
include Foreman::Controller::Parameters::Host
if defined?(ForemanPuppet)
include ForemanPuppet::Extensions::ParametersHost
end
module Foreman
module Controller
module Parameters
module DiscoveredHost
extend ActiveSupport::Concern
include Foreman::Controller::Parameters::Host
if defined?(ForemanPuppet)
include ForemanPuppet::Extensions::ParametersHost
end

class_methods do
def discovered_host_params_filter
Foreman::ParameterFilter.new(::Host::Discovered).tap do |filter|
filter.permit :discovery_rule_id
class_methods do
def discovered_host_params_filter
Foreman::ParameterFilter.new(::Host::Discovered).tap do |filter|
filter.permit :discovery_rule_id

add_host_base_params_filter(filter)
add_host_common_params_filter(filter)
add_host_puppet_params_filter(filter) if defined?(ForemanPuppet)
end
end
end
add_host_base_params_filter(filter)
add_host_common_params_filter(filter)
add_host_puppet_params_filter(filter) if defined?(ForemanPuppet)
end
end
end

def discovered_host_params
filtered_params = self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
end
def discovered_host_params
filtered_params = self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
end

def discovered_host_params_host
filtered_params = self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context, :host)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
end
def discovered_host_params_host
filtered_params = self.class.discovered_host_params_filter.filter_params(params, parameter_filter_context, :host)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
end

def managed_host_params_host
filtered_params = self.class.host_params_filter.filter_params(params, parameter_filter_context, :host)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
end
def managed_host_params_host
filtered_params = self.class.host_params_filter.filter_params(params, parameter_filter_context, :host)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
end

def managed_host_params
filtered_params = self.class.host_params_filter.filter_params(params, parameter_filter_context)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
def managed_host_params
filtered_params = self.class.host_params_filter.filter_params(params, parameter_filter_context)
process_deprecated_puppet_params!(filtered_params) if defined?(ForemanPuppet)
filtered_params
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
module Foreman::Controller::Parameters::DiscoveryRule
extend ActiveSupport::Concern
include Foreman::Controller::Parameters::Taxonomix
module Foreman
module Controller
module Parameters
module DiscoveryRule
extend ActiveSupport::Concern
include Foreman::Controller::Parameters::Taxonomix

class_methods do
def discovery_rule_params_filter
Foreman::ParameterFilter.new(::DiscoveryRule).tap do |filter|
filter.permit :name, :search, :hostname, :priority, :enabled, :hostgroup, :hostgroup_id, :max_count
add_taxonomix_params_filter(filter)
class_methods do
def discovery_rule_params_filter
Foreman::ParameterFilter.new(::DiscoveryRule).tap do |filter|
filter.permit :name, :search, :hostname, :priority, :enabled, :hostgroup, :hostgroup_id, :max_count
add_taxonomix_params_filter(filter)
end
end
end

def discovery_rule_params
self.class.discovery_rule_params_filter.filter_params(params, parameter_filter_context)
end
end
end
end

def discovery_rule_params
self.class.discovery_rule_params_filter.filter_params(params, parameter_filter_context)
end
end

0 comments on commit fd64b8a

Please sign in to comment.