gabynaiman/active_git

View on GitHub

Showing 6 of 6 total issues

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

    def delete(synchronizer)
      synchronizer.define_job do
        instance = model.find_by_id(model_id)
        if instance
          model.git_included_associations.each do |a|
Severity: Minor
Found in lib/active_git/events/db_event.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 git_versioned has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def git_versioned(options={})

        @options = options.merge root: false

        def git_options
Severity: Minor
Found in lib/active_git/active_record_extension.rb - About 1 hr to fix

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

        def self.instances(model, json)
          list = [from_json(model, json)]
          attributes = json.is_a?(Hash) ? json : JSON.parse(json)
          attributes.each do |attr, value|
            if model.reflections.has_key?(attr.to_sym)
    Severity: Minor
    Found in lib/active_git/model_parser.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 from_json has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.from_json(model, json)
          record = model.new
          attributes = json.is_a?(Hash) ? json : JSON.parse(json)
          attributes.each do |attr, value|
            if model.column_names.include?(attr.to_s)
    Severity: Minor
    Found in lib/active_git/model_parser.rb - About 55 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 merge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def merge(commit)
          ActiveGit.configuration.logger.info "[ActiveGit] Merge Init"
    
          last_log = (log || []).first
          diffs = diff_reverse commit unless last_log
    Severity: Minor
    Found in lib/active_git/commands.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def run
          if bulk_inserts.any?
            define_job do
              bulk_inserts.each do |model, records|
                records.each_slice(ActiveGit.configuration.sync_batch_size) do |batch_records|
    Severity: Minor
    Found in lib/active_git/synchronizer.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

    Severity
    Category
    Status
    Source
    Language