Apipie/apipie-rails

View on GitHub

Showing 68 of 91 total issues

Method render_from_cache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def render_from_cache
      path = Apipie.configuration.doc_base_url.dup
      path << "/" << params[:version] if params[:version].present?
      path << "/" << params[:resource] if params[:resource].present?
      path << "/" << params[:method] if params[:method].present?
Severity: Minor
Found in app/controllers/apipie/apipies_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 analyze_functional_test has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def analyze_functional_test(test_context)
        request, response = test_context.request, test_context.response
        @verb = request.request_method.to_sym
        @path = request.path
        @params = request.request_parameters
Severity: Minor
Found in lib/apipie/extractor/recorder.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 is_required? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def is_required?
      if @options.key?(:required)
        if (@options[:required] == true) || (@options[:required] == false)
          @options[:required]
        else
Severity: Minor
Found in lib/apipie/param_description.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 define_method_description has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def define_method_description(controller, method_name, dsl_data)
      return if ignored?(controller, method_name)
      ret_method_description = nil

      versions = dsl_data[:api_versions] || []
Severity: Minor
Found in lib/apipie/application.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 ignore_call? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def ignore_call?(record)
        return true unless record[:controller]
        return true if @ignored.include?(record[:controller].name)
        return true if @ignored.include?("#{Apipie.get_resource_id(record[:controller].name)}##{record[:action]}")
        return true unless @api_controllers_paths.include?(controller_full_path(record[:controller]))
Severity: Minor
Found in lib/apipie/extractor/collector.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 print_validation_errors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.print_validation_errors(validation_errors, schema, response, error_object = nil)
    Rails.logger.warn(validation_errors.to_s)
    if Rails.env.test?
      puts "schema validation errors:"
      validation_errors.each { |e| puts "--> #{e.to_s}" }
Severity: Minor
Found in lib/apipie/rspec/response_validation_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 define_resource_description has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def define_resource_description(controller, version, dsl_data = nil)
      return if ignored?(controller)

      resource_id = get_resource_id(controller)
      resource_description = @resource_descriptions[version][resource_id]
Severity: Minor
Found in lib/apipie/application.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 ordered_call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def ordered_call(call)
        call = call.stringify_keys
        ordered_call = OrderedHash.new
        %w[title verb path versions query request_data response_data code show_in_doc recorded].each do |k|
          next unless call.key?(k)
Severity: Minor
Found in lib/apipie/extractor/writer.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