sandric/disqus_rails

View on GitHub

Showing 5 of 8 total issues

Method acts_as_disquser has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

      def acts_as_disquser(attributes={})

        define_method :disqus_params do
          data = {}

Severity: Minor
Found in lib/disqus_rails/active_record/acts_as_disquser.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

Method acts_as_disquser has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def acts_as_disquser(attributes={})

        define_method :disqus_params do
          data = {}

Severity: Minor
Found in lib/disqus_rails/active_record/acts_as_disquser.rb - About 1 hr to fix

    Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(attributes={})
          attributes.each do |attr_name, attr_value|
            if attr_name == "identifiers"
              unless attr_value.empty?
                instance_variable_set("@disqusable_id".to_sym, attr_value[0])
    Severity: Minor
    Found in lib/disqus_rails/thread.rb - About 45 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 disqus_init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def disqus_init(attributes={})
          if attributes.has_key?(:short_name)
            DisqusRails.const_set('SHORT_NAME', attributes[:short_name])
          else
            attributes[:short_name] = DisqusRails::SHORT_NAME
    Severity: Minor
    Found in lib/disqus_rails/helpers.rb - About 45 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 update_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_attributes(attributes={})
          attributes.each do |attr_name, attr_value|
            if attr_name == "identifiers"
              unless attr_value.empty?
                @disqusable_id = attr_value[0]
    Severity: Minor
    Found in lib/disqus_rails/thread.rb - About 45 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