Showing 68 of 91 total issues
File bootstrap.js
has 1517 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* ===================================================
* bootstrap-transition.js v2.3.2
* http://getbootstrap.com/2.3.2/javascript.html#transitions
* ===================================================
* Copyright 2013 Twitter, Inc.
Method _apipie_define_validators
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def _apipie_define_validators(description)
# [re]define method only if validation is turned on
if description && (Apipie.configuration.validate == true ||
Apipie.configuration.validate == :implicitly ||
- 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 index
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def index
params[:version] ||= Apipie.configuration.default_version
get_format
- 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
File validator.rb
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Apipie
module Validator
# to create new validator, inherit from Apipie::Validator::BaseValidator
Class Application
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Application
# we need engine just for serving static assets
class Engine < Rails::Engine
initializer "static assets", :before => :build_middleware_stack do |app|
app.middleware.use ::Apipie::StaticDispatcher, "#{root}/app/public"
File dsl_definition.rb
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Apipie
# DSL is a module that provides #api, #error, #param, #returns.
module DSL
File writer.rb
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'set'
module Apipie
module Extractor
class Writer
File application.rb
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'apipie/static_dispatcher'
require 'apipie/routes_formatter'
require 'yaml'
require 'digest/sha1'
require 'json'
Method refine_params_description
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def refine_params_description(params_desc, recorded_params)
recorded_params.each do |key, value|
params_desc[key] ||= {}
param_desc = params_desc[key]
- 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 to_swagger
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def to_swagger
return if @param_descriptions.blank?
@param_descriptions.each do |param_description|
validate(param_description)
- 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 initialize
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def initialize(method_description, name, validator, desc_or_options = nil, options = {}, &block)
if desc_or_options.is_a?(Hash)
options = options.merge(desc_or_options)
elsif desc_or_options.is_a?(String)
- 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 returns
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def returns(pgroup_or_options, desc_or_options = nil, options = {}, &block) #:doc:
return unless Apipie.active_dsl?
if desc_or_options.is_a? Hash
- 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 MethodDescription
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class MethodDescription
attr_reader :full_description, :method, :resource, :apis, :examples, :see, :formats, :headers, :show
attr_accessor :metadata
def initialize(method, resource, dsl_data)
Class ParamDescription
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ParamDescription
attr_reader :method_description, :name, :desc, :allow_nil, :allow_blank, :validator, :options, :metadata, :show, :as, :validations, :response_only, :request_only
attr_reader :additional_properties, :is_array
attr_accessor :parent, :required
Class Writer
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Writer
class << self
def compressed
Apipie.configuration.compress_examples
end
Method index
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
params[:version] ||= Apipie.configuration.default_version
get_format
Method to_swagger
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_swagger
return if @param_descriptions.blank?
@param_descriptions.each do |param_description|
validate(param_description)
Method validate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def validate(value)
return false if !value.is_a? Hash
BaseValidator.raise_if_missing_params do |missing|
@hash_params&.each do |k, p|
- 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_resource_description
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_resource_description(resource, version = nil)
if resource.is_a?(String)
crumbs = resource.split('#')
if crumbs.size == 2
version = crumbs.first
- 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 initialize
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(method_description, name, validator, desc_or_options = nil, options = {}, &block)
if desc_or_options.is_a?(Hash)
options = options.merge(desc_or_options)
elsif desc_or_options.is_a?(String)