navinspm/clndr-rails

View on GitHub

Showing 5 of 7 total issues

Method view has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def view(args=nil)

    case @template
      when Clndr::Template::FULL
        css_class = 'full-clndr-template'
Severity: Minor
Found in lib/clndr-rails.rb - About 4 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 Clndr has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class Clndr

  autoload :Helpers, 'clndr-rails/helpers'
  autoload :Template, 'clndr-rails/templates'
  require 'clndr-rails/config'
Severity: Minor
Found in lib/clndr-rails.rb - About 2 hrs to fix

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

          def navigate_link(scope,name,jsmethod,*args,&block)
    Severity: Minor
    Found in lib/clndr-rails/helpers.rb - About 35 mins to fix

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

          def build_from_hash(hash, parameter,safety=false)
            if hash.length > 0
              "#{parameter}: {#{hash.map { |k, v| "#{k}:#{'\'' if safety}#{v}#{'\'' if safety}," }.join}},"
            end
          end
      Severity: Minor
      Found in lib/clndr-rails.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 build_events has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def build_events
          list_of_events=''
          @events.delete_if do |event|
            list_of_events +="{
                #{'date:\''+event.delete(:date)+'\',' unless event[:date].nil?}
      Severity: Minor
      Found in lib/clndr-rails.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