redbooth/departure

View on GitHub

Showing 4 of 4 total issues

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

  def self.load
    ActiveRecord::Migrator.instance_eval do
      class << self
        alias original_migrate migrate
      end
Severity: Minor
Found in lib/departure.rb - About 1 hr to fix

    Method new_column has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def new_column(field, default, cast_type, sql_type = nil, null = true, collation = '', extra = '') # rubocop:disable Metrics/ParameterLists, Metrics/LineLength
    Severity: Major
    Found in lib/active_record/connection_adapters/percona_adapter.rb - About 50 mins to fix

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

            def exec_insert(sql, name, binds, pk = nil, sequence_name = nil) # rubocop:disable Lint/UnusedMethodArgument, Metrics/LineLength
      Severity: Minor
      Found in lib/active_record/connection_adapters/percona_adapter.rb - About 35 mins to fix

        Method default_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def default_value
              match = if definition =~ /timestamp|datetime/i
                        /default '?(.+[^'])'?/i.match(definition)
                      else
                        /default '?(\w+)'?/i.match(definition)
        Severity: Minor
        Found in lib/lhm/column_with_sql.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