diff --git a/Gemfile.lock b/Gemfile.lock index 65466bf..906cc04 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - betterlint (1.11.0) + betterlint (1.12.0) rubocop (~> 1.62.0) rubocop-graphql (~> 1.5.0) rubocop-performance (~> 1.21.0) diff --git a/betterlint.gemspec b/betterlint.gemspec index 4338506..fac3d6f 100644 --- a/betterlint.gemspec +++ b/betterlint.gemspec @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |s| s.name = "betterlint" - s.version = "1.11.0" + s.version = "1.12.0" s.authors = ["Development"] s.email = ["development@betterment.com"] s.summary = "Betterment rubocop configuration" diff --git a/config/default.yml b/config/default.yml index 0f26ab5..9374af3 100644 --- a/config/default.yml +++ b/config/default.yml @@ -143,6 +143,8 @@ Metrics/AbcSize: Exclude: - spec/**/* - webvalve/**/* + CountRepeatedAttributes: false + Max: 34 Metrics/BlockLength: Enabled: false diff --git a/lib/rubocop/cop/betterment/authorization_in_controller.rb b/lib/rubocop/cop/betterment/authorization_in_controller.rb index 2d2fb0a..804471b 100644 --- a/lib/rubocop/cop/betterment/authorization_in_controller.rb +++ b/lib/rubocop/cop/betterment/authorization_in_controller.rb @@ -51,7 +51,7 @@ def on_class(node) end end - def on_send(node) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity + def on_send(node) # rubocop:disable Metrics/PerceivedComplexity return if !model_new?(node) && !model_update?(node) node.arguments.each do |argument| @@ -88,7 +88,7 @@ def flag_literal_param_use(node) # Flags objects being created/updated with unsafe # params indirectly from params or through params.permit - def flag_indirect_param_use(node) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity + def flag_indirect_param_use(node) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity name = Utils::Parser.get_root_token(node) # extracted_params contains parameters used like: # def create diff --git a/lib/rubocop/cop/betterment/utils/parser.rb b/lib/rubocop/cop/betterment/utils/parser.rb index b0f5673..4b5a4f1 100644 --- a/lib/rubocop/cop/betterment/utils/parser.rb +++ b/lib/rubocop/cop/betterment/utils/parser.rb @@ -5,7 +5,7 @@ module Cop module Betterment module Utils module Parser - def self.get_root_token(node) # rubocop:disable Metrics/PerceivedComplexity, Metrics/AbcSize + def self.get_root_token(node) # rubocop:disable Metrics/PerceivedComplexity return nil unless node return get_root_token(node.receiver) if node.receiver @@ -33,7 +33,7 @@ def self.get_root_token(node) # rubocop:disable Metrics/PerceivedComplexity, Met name end - def self.get_return_values(node) # rubocop:disable Metrics/AbcSize + def self.get_return_values(node) return [] unless node return explicit_returns(node) + get_return_values(node.body) if node.def_type? return [node] if node.literal? || node.variable? @@ -84,7 +84,7 @@ def self.params_from_arguments(arguments) # rubocop:disable Metrics/PerceivedCom parameter_names end - def self.get_extracted_parameters(node, param_aliases: []) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + def self.get_extracted_parameters(node, param_aliases: []) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity return [] unless node.send_type? parameter_names = []