Apipie/apipie-rails

View on GitHub
lib/apipie/dsl_definition.rb

Summary

Maintainability
D
2 days
Test Coverage

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 ||
Severity: Minor
Found in lib/apipie/dsl_definition.rb - About 1 day 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

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

Severity: Minor
Found in lib/apipie/dsl_definition.rb - About 5 hrs to fix

    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
    Severity: Minor
    Found in lib/apipie/dsl_definition.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

    Method _apipie_define_validators has 41 lines of code (exceeds 25 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 ||
    Severity: Minor
    Found in lib/apipie/dsl_definition.rb - About 1 hr to fix

      Method returns has 30 lines of code (exceeds 25 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
      Severity: Minor
      Found in lib/apipie/dsl_definition.rb - About 1 hr to fix

        Method property has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def property(param_name, validator, desc_or_options = nil, options = {}, &block) #:doc:
        Severity: Minor
        Found in lib/apipie/dsl_definition.rb - About 35 mins to fix

          Method param has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def param(param_name, validator, desc_or_options = nil, options = {}, &block) #:doc:
          Severity: Minor
          Found in lib/apipie/dsl_definition.rb - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status