jalkoby/squasher

View on GitHub

Showing 9 of 9 total issues

Method dbconfig has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def dbconfig
      return @dbconfig if defined?(@dbconfig)
      return @dbconfig = nil unless File.exist?(dbconfig_file)

      @dbconfig = nil
Severity: Minor
Found in lib/squasher/config.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 set has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def set(key, value)
      if key == :engine
        base = value.nil? ? @root_path : File.expand_path(value, @root_path)
        list = Dir.glob(File.join(base, '**', '*', 'config', 'application.rb'))
        case list.size
Severity: Minor
Found in lib/squasher/config.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 under_squash_env has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def under_squash_env
      config.stub_dbconfig do
        if Squasher.config.set?(:reuse)
          Squasher.tell(:db_reuse)
        else
Severity: Minor
Found in lib/squasher/worker.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 dbconfig has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def dbconfig
      return @dbconfig if defined?(@dbconfig)
      return @dbconfig = nil unless File.exist?(dbconfig_file)

      @dbconfig = nil
Severity: Minor
Found in lib/squasher/config.rb - About 1 hr to fix

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

        def stub_dbconfig
          return unless dbconfig?
    
          list = [dbconfig_file, *schema_files]
          list.each do |file|
    Severity: Minor
    Found in lib/squasher/config.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 stream_schema has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def stream_schema(stream)
          inside_schema = false
    
          stream.each_line do |raw_line|
            if inside_schema
    Severity: Minor
    Found in lib/squasher/render.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 process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def process
          check!
    
          result = under_squash_env do
            if Squasher.config.set?(:dry)
    Severity: Minor
    Found in lib/squasher/worker.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 stream_structure has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def stream_structure(stream)
          yield 'execute %q{'
          skip_mode = false
          ignored_table = ['ar_internal_metadata', 'schema_migrations']
          stream.each_line do |line|
    Severity: Minor
    Found in lib/squasher/render.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 check! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def check!
          Squasher.error(:migration_folder_missing) unless config.migrations_folders?
          Squasher.error(:dbconfig_invalid) unless config.dbconfig?
    
          if config.multi_db_format == 'rails'
    Severity: Minor
    Found in lib/squasher/worker.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