InWork/bulk_update

View on GitHub

Showing 10 of 10 total issues

Method get_updated_records has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def get_updated_records(args = {})
      model           =  args[:for] || self
      compare_table   =  args[:compare_with]
      keys            =  args[:on] || 'id'
      exclude         =  args[:exclude_fields] || []
Severity: Minor
Found in lib/bulk_update/active_record_inflections.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 bulk_insert has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def bulk_insert(columns, values, args = {})
      # Limit inserts
      max_records_per_insert = args[:max_records_per_insert] || 100
      table                  = args[:into] || table_name
      columns                = columns.clone
Severity: Minor
Found in lib/bulk_update/active_record_inflections.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 get_updated_records has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get_updated_records(args = {})
      model           =  args[:for] || self
      compare_table   =  args[:compare_with]
      keys            =  args[:on] || 'id'
      exclude         =  args[:exclude_fields] || []
Severity: Minor
Found in lib/bulk_update/active_record_inflections.rb - About 1 hr to fix

    Method get_deleted_records has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_deleted_records(args = {})
          model           = args[:for] || self
          compare_table   = args[:compare_with]
          keys            = args[:on] || 'id'
          exclude_virtual = args[:exclude_virtual].nil? ? false : args[:exclude_virtual]
    Severity: Minor
    Found in lib/bulk_update/active_record_inflections.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 bulk_insert has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def bulk_insert(columns, values, args = {})
          # Limit inserts
          max_records_per_insert = args[:max_records_per_insert] || 100
          table                  = args[:into] || table_name
          columns                = columns.clone
    Severity: Minor
    Found in lib/bulk_update/active_record_inflections.rb - About 1 hr to fix

      Method get_new_records has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_new_records(args = {})
            model         =  args[:for] || self
            compare_table =  args[:compare_with]
            keys          =  args[:on] || 'id'
            exclude       =  args[:exclude_fields] || []
      Severity: Minor
      Found in lib/bulk_update/active_record_inflections.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 get_deleted_records has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def get_deleted_records(args = {})
            model           = args[:for] || self
            compare_table   = args[:compare_with]
            keys            = args[:on] || 'id'
            exclude_virtual = args[:exclude_virtual].nil? ? false : args[:exclude_virtual]
      Severity: Minor
      Found in lib/bulk_update/active_record_inflections.rb - About 1 hr to fix

        Method get_new_records has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def get_new_records(args = {})
              model         =  args[:for] || self
              compare_table =  args[:compare_with]
              keys          =  args[:on] || 'id'
              exclude       =  args[:exclude_fields] || []
        Severity: Minor
        Found in lib/bulk_update/active_record_inflections.rb - About 1 hr to fix

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

              def bulk_update(columns, values, args = {})
                temp_table     = "#{table_name}_temp_table_#{$$}"
                key            = args[:key] || args[:keys] || 'id'
                condition      = args[:condition]
                exclude_fields = args[:exclude_fields]
          Severity: Minor
          Found in lib/bulk_update/active_record_inflections.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 insert_str has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def insert_str(element)
                if element.class == Fixnum || element.class == Float
                  element
                elsif element.class == NilClass
                  'NULL'
          Severity: Minor
          Found in lib/bulk_update/active_record_inflections.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