dwaynemac/logical_model

View on GitHub

Showing 10 of 12 total issues

Method define_association_methods has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

        def define_association_methods(association,attr_class)

          # Accessor
          # return empty array or @association variable for each association
          define_method association do
Severity: Minor
Found in lib/logical_model/associations/has_many_keys.rb - About 3 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 LogicalModel has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class LogicalModel
  module RESTActions

    def self.included(base)
      base.send(:include, InstanceMethods)
Severity: Minor
Found in lib/logical_model/rest_actions.rb - About 2 hrs to fix

    File rest_actions.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class LogicalModel
      module RESTActions
    
        def self.included(base)
          base.send(:include, InstanceMethods)
    Severity: Minor
    Found in lib/logical_model/rest_actions.rb - About 2 hrs to fix

      Method define_association_methods has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def define_association_methods(association,attr_class)
      
                # Accessor
                # return empty array or @association variable for each association
                define_method association do
      Severity: Minor
      Found in lib/logical_model/associations/has_many_keys.rb - About 1 hr to fix

        Method belongs_to has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                def belongs_to(key, options = {})
                  attr_accessor "#{key}_id"
                  attr_class = get_attr_class(key, options)
        
                  @belongs_to_keys ||= {}
        Severity: Minor
        Found in lib/logical_model/associations/belongs_to.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 belongs_to has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def belongs_to(key, options = {})
                  attr_accessor "#{key}_id"
                  attr_class = get_attr_class(key, options)
        
                  @belongs_to_keys ||= {}
        Severity: Minor
        Found in lib/logical_model/associations/belongs_to.rb - About 1 hr to fix

          Method _create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def _create(params = {})
                  unless params[:ignore_validation]
                    return false unless valid?
                  end
          
          
          Severity: Minor
          Found in lib/logical_model/rest_actions.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 async_paginate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def async_paginate(options={})
                  options[:page] ||= 1
                  options[:per_page] ||= 20
          
                  options = self.merge_key(options)
          Severity: Minor
          Found in lib/logical_model/rest_actions.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 logger has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def logger
                  unless @logger
                    @logger = Logger.new(self.log_path || "log/logical_model.log")
                    if defined?(Rails)
                      @logger.level = Rails.logger.level
          Severity: Minor
          Found in lib/logical_model/safe_log.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 encoded? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def encoded?(hash)
              return false if hash.empty?
              if hash.keys.size > 1
                keys = hash.keys.map{|i| i.to_i if i.respond_to?(:to_i)}.sort
                keys == hash.keys.size.times.to_a
          Severity: Minor
          Found in lib/typhoeus_fix/array_decoder.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