bogdanRada/washout_builder

View on GitHub

Showing 15 of 369 total issues

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
Severity: Minor
Found in lib/washout_builder.rb - About 2 hrs to fix

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
Severity: Minor
Found in lib/washout_builder/document/generator.rb - About 2 hrs to fix

    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?
    Severity: Minor
    Found in app/controllers/washout_builder/washout_builder_controller.rb - About 1 hr to fix

    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 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
    Severity: Minor
    Found in lib/washout_builder/env_checker.rb - About 1 hr to fix

    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)
    Severity: Minor
    Found in app/helpers/washout_builder_complex_type_helper.rb - About 55 mins to fix

    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)
    Severity: Minor
    Found in app/helpers/washout_builder_method_arguments_helper.rb - About 35 mins to fix

      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
      Severity: Minor
      Found in app/helpers/washout_builder_method_list_helper.rb - About 35 mins to fix

      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_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def create_method_argument_element(pre, param, mlen)
          spacer = '&nbsp;&nbsp;&nbsp;&nbsp;'
          complex_class = param.find_complex_class_name
          use_spacer = mlen > 1 ? true : false
          if WashoutBuilder::Type::BASIC_TYPES.include?(param.type)
      Severity: Minor
      Found in app/helpers/washout_builder_method_arguments_helper.rb - About 35 mins to fix

      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)))
      Severity: Minor
      Found in lib/washout_builder/document/complex_type.rb - About 35 mins to fix

      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
      Severity: Minor
      Found in app/controllers/washout_builder/washout_builder_controller.rb - About 35 mins to fix

      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?
      Severity: Minor
      Found in lib/washout_builder/document/complex_type.rb - About 35 mins to fix

      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 soap_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def soap_action(action, options = {})
              original_soap_action(action, options)
      
              if action.is_a?(Symbol)
                if soap_config.camelize_wsdl.to_s == 'lower'
      Severity: Minor
      Found in lib/washout_builder/soap.rb - About 25 mins to fix

      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_html_public_method_return_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def create_html_public_method_return_type(xml, pre, output)
          if !output.nil? && !output[0].blank?
            complex_class = output[0].find_complex_class_name
            if WashoutBuilder::Type::BASIC_TYPES.include?(output[0].type)
              xml.span('class' => 'blue') { |y| y << "#{output[0].type}" }
      Severity: Minor
      Found in app/helpers/washout_builder_method_return_type_helper.rb - About 25 mins to fix

      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 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])
      Severity: Minor
      Found in lib/washout_builder/soap.rb - About 25 mins to fix

      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 all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def all
            params[:name] = env_controller_path if env_controller_path.present?
            find_all_routes
            route_details = params[:name].present? ? controller_is_a_service?(params[:name]) : nil
            if route_details.present? && defined?(controller_class(params[:name]))
      Severity: Minor
      Found in app/controllers/washout_builder/washout_builder_controller.rb - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language