Showing 369 of 369 total issues
Class has too many lines. [110/100] Open
class WashoutBuilderController < ActionController::Base
protect_from_forgery
before_action :check_env_available
# Will show all api services if no name parameter is receiverd
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Block has too many lines. [100/25] Open
xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) {
xml.head {
xml.title "#{@document.service} interface description"
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Block has too many lines. [76/25] Open
xml.body {
xml.h1 "#{ @document.service} Soap WebService interface description"
xml.p{ |y| y << "Endpoint URI:"
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method wash_out
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def wash_out(controller_name, options={})
env_checker = WashoutBuilder::EnvChecker.new(Rails.application)
if env_checker.available_for_env?(Rails.env)
options = options.symbolize_keys if options.is_a?(Hash)
if @scope
- 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
Class Generator
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Generator
# class that is used to generate HTML documentation for a soap service
#
# @!attribute soap_actions
# @return [Hash] Hash that contains all the actions to which the web service responds to and information about them
Cyclomatic complexity for available_for_env? is too high. [7/6] Open
def available_for_env?(env_name)
if whitelist.present? || blacklist.present?
if whitelist.find{|a| blacklist.include?(a) }.blank?
if whitelist.include?('*') || (!valid_for_env?(blacklist, env_name) && valid_for_env?(whitelist, env_name))
return true
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Cyclomatic complexity for get_nested_complex_types is too high. [7/6] Open
def get_nested_complex_types(config, classes_defined)
classes_defined = [] if classes_defined.blank?
complex_class = find_complex_class_name(classes_defined)
real_class = find_class_from_string(complex_class)
if complex_class.present? && (real_class.blank? || (real_class.present? && !real_class.ancestors.include?( WashoutBuilder::Type.base_type_class)))
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Perceived complexity for available_for_env? is too high. [8/7] Open
def available_for_env?(env_name)
if whitelist.present? || blacklist.present?
if whitelist.find{|a| blacklist.include?(a) }.blank?
if whitelist.include?('*') || (!valid_for_env?(blacklist, env_name) && valid_for_env?(whitelist, env_name))
return true
- Read upRead up
- Exclude checks
This cop tries to produce a complexity score that's a measure of the
complexity the reader experiences when looking at a method. For that
reason it considers when
nodes as something that doesn't add as much
complexity as an if
or a &&
. Except if it's one of those special
case
/when
constructs where there's no expression after case
. Then
the cop treats it as an if
/elsif
/elsif
... and lets all the when
nodes count. In contrast to the CyclomaticComplexity cop, this cop
considers else
nodes as adding complexity.
Example:
def my_method # 1
if cond # 1
case var # 2 (0.8 + 4 * 0.2, rounded)
when 1 then func_one
when 2 then func_two
when 3 then func_three
when 4..10 then func_other
end
else # 1
do_something until a && b # 2
end # ===
end # 7 complexity points
Method all_services
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def all_services
@map_controllers = map_controllers { |hash| hash }
@map_controllers.blank? ? [] : @map_controllers.map do |hash|
controller_name = hash[:route].present? && hash[:route].respond_to?(:defaults) ? hash[:route].defaults[:controller] : nil
if controller_name.present?
- 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
Block has too many lines. [36/25] Open
xml.html( "xmlns" => "http://www.w3.org/1999/xhtml" ) {
xml.head {
xml.title "Available Services"
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method available_for_env?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def available_for_env?(env_name)
if whitelist.present? || blacklist.present?
if whitelist.find{|a| blacklist.include?(a) }.blank?
if whitelist.include?('*') || (!valid_for_env?(blacklist, env_name) && valid_for_env?(whitelist, env_name))
return true
- 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 create_element_type_html
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_element_type_html(pre, element, element_description)
element_description = element_description.blank? ? nil : element_description.fetch(element.name.to_s.downcase, '')
element.type = 'string' if element.type == 'text'
element.type = 'integer' if element.type == 'int'
if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
- 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 create_method_argument_complex_element
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_method_argument_complex_element(pre, param, use_spacer, spacer, complex_class)
Method create_method_argument_element
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_method_argument_element(pre, param, mlen)
spacer = ' '
complex_class = param.find_complex_class_name
use_spacer = mlen > 1 ? true : false
if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
- 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 map_controllers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def map_controllers(action = 'select')
res = @routes.send(action) do |hash|
if hash[:route].present? && route_can_generate_wsdl?(hash[:route])
yield hash if hash.present? && block_given?
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 get_nested_complex_types
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_nested_complex_types(config, classes_defined)
classes_defined = [] if classes_defined.blank?
complex_class = find_complex_class_name(classes_defined)
real_class = find_class_from_string(complex_class)
if complex_class.present? && (real_class.blank? || (real_class.present? && !real_class.ancestors.include?( WashoutBuilder::Type.base_type_class)))
- 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 get_class_ancestors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_class_ancestors(config, class_name, classes_defined)
ancestors = get_ancestors(class_name)
return if ancestors.blank?
base_param_class = WashoutBuilder::Type.base_param_class
return if base_param_class.blank?
- 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 create_return_type_list_html
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_return_type_list_html(xml, output)
if output.nil? || output[0].blank?
xml.span('class' => 'pre') { |sp| sp << 'void' }
else
complex_class = output[0].find_complex_class_name
- 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
Block has too many lines. [28/25] Open
xml.div("class" => "noprint") {
xml.h2 "Index "
@complex_types = @document.complex_types
@fault_types = @document.fault_types
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Method builder_soap_action
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def builder_soap_action(action, options = {})
current_action = soap_actions[action]
base_param_class = WashoutBuilder::Type.base_param_class
return if base_param_class.blank?
current_action[:builder_in] = base_param_class.parse_def(soap_config, options[:args])
- 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"