Showing 15 of 26 total issues
Method bind_method
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bind_method(service_ref, controller, method_name, desc)
method_key = method_name.to_s.underscore.to_sym
controller_name = controller.name
service_ref.class_eval do
if desc.request_response?
Method call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def call(&block)
return yield if options.fetch(:ignore_methods, [])&.include?(request.method_name)
result = Gruf::Interceptors::Timer.time(&block)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method reset
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reset
VALID_CONFIG_KEYS.each do |k, v|
send(:"#{k}=", v)
end
self.server_binding_url = "#{::ENV.fetch('GRPC_SERVER_HOST',
Method call
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(&block)
return yield if options.fetch(:ignore_methods, [])&.include?(request.method_name)
result = Gruf::Interceptors::Timer.time(&block)
Method redact!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def redact!(parts = [], idx = 0, params = {}, redacted_string = 'REDACTED')
return unless parts.is_a?(Array) && params.is_a?(Hash)
return if idx >= parts.size || !params.key?(parts[idx])
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method execute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def execute(call_sig, req, metadata, opts = {}, &block)
Method call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call(request_method, params = {}, metadata = {}, opts = {}, &block)
Method call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call(request_method, params = {}, metadata = {}, opts = {}, &block)
Method formatter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def formatter
unless @formatter
fmt = options.fetch(:formatter, :plain)
@formatter = case fmt
when Symbol
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def call(request_method, params = {}, metadata = {}, opts = {}, &block)
request_method = request_method.to_sym
req = if params.respond_to?(:to_proto) || streaming_request?(request_method)
params
else
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method intercept!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def intercept!(&block)
return yield if @interceptors.none?
i = @interceptors.shift
return yield unless i
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method reset
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reset
VALID_CONFIG_KEYS.each do |k, v|
send(:"#{k}=", v)
end
self.server_binding_url = "#{::ENV.fetch('GRPC_SERVER_HOST',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method deserialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deserialize(exception)
if exception.respond_to?(:metadata)
key = exception.metadata.key?(@metadata_key.to_s) ? @metadata_key.to_s : @metadata_key.to_sym
return @deserializer_class.new(exception.metadata[key]).deserialize if exception.metadata.key?(key)
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call(method_key, &block)
Interceptors::Context.new(@interceptors).intercept! do
process_action(method_key, &block)
end
rescue GRPC::BadStatus
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method determine_loggers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def determine_loggers
if defined?(::Rails) && ::Rails.logger
self.logger = ::Rails.logger
else
require 'logger'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"