eprothro/cassie

View on GitHub

Showing 16 of 24 total issues

Class TableDefinition has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

  class TableDefinition

    #
    # C* Data Types. See http://www.datastax.com/documentation/cql/3.0/cql/cql_reference/cql_data_types_c.html
    #
Severity: Minor
Found in lib/cassie/schema/migration/dsl/table_definition.rb - About 3 hrs to fix

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

          def define_argument_accessor(name)
            unless Symbol === name
              raise ArgumentError, "A Symbol is required for the accessor methods for setting/getting a relation's value. #{name.class} (#{name}) given."
            end
    
    
    Severity: Minor
    Found in lib/cassie/statements/statement/mapping.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 fetch_in_batches has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_in_batches(opts={})
          opts[:batch_size] ||= 1000
    
          # spawn the new query as soon as the enumerable is created
          # rather than waiting until the firt iteration is executed.
    Severity: Minor
    Found in lib/cassie/statements/execution/batched_fetching.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def run
            build_options
            Cassie.logger.level = ::Logger::WARN unless options[:debug]
            Cassie.env = options[:environment] if options[:environment]
            Cassie::Tasks::IO.trace! if options[:trace]
    Severity: Minor
    Found in lib/cassie/tasks/task_runner.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 map has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def map(column_name, options={})
          key_type, value_type = options[:key_type], options[:value_type]
          [key_type, value_type].each_with_index do |type, index|
            if type.nil?
              raise Errors::MigrationDefinitionError, "A map must define a #{index = 0 ? 'key' : 'value'} type."
    Severity: Minor
    Found in lib/cassie/schema/migration/dsl/table_definition.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 statement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def statement
          if execution_info
            statement = execution_info.statement
            if statement.respond_to? :cql
              str = statement.cql.dup
    Severity: Minor
    Found in lib/cassie/statements/logging/execute_event.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(source, identifier, op_type, value_method, opts={})
    Severity: Minor
    Found in lib/cassie/statements/statement/relation.rb - About 35 mins to fix

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

              def record_version(number, description, uuid, executor, executed_at_utc)
      Severity: Minor
      Found in lib/cassie/schema/definition/dsl.rb - About 35 mins to fix

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

            def initialize(version_number, description=nil, id=nil, executor=nil, executed_at=nil)
        Severity: Minor
        Found in lib/cassie/schema/version.rb - About 35 mins to fix

          Method record_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def record_version(version, set_execution_metadata=true)
                time = Time.now
                version.id ||= Cassandra::TimeUuid::Generator.new.at(time)
          
                if set_execution_metadata
          Severity: Minor
          Found in lib/cassie/schema/versioning.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

          Method execution_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def execution_options
                {}.tap do |opts|
                  # @todo rework consistency module to be more
                  #      abstract implementation for all execution options
                  opts[:consistency] = consistency if consistency
          Severity: Minor
          Found in lib/cassie/statements/execution.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

          Method build_condition_and_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def build_condition_and_params
                condition_strings = []
                bindings = []
          
                conditions.each do |condition, opts|
          Severity: Minor
          Found in lib/cassie/statements/statement/conditions.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

          Method column_type_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def column_type_for(type, options={})
                cql_type = type if PASSTHROUGH_TYPES.include?(type)
                cql_type ||= TYPES_MAP[type]
                if PRECISION_MAP.keys.include?(type)
                  limit = options[:limit]
          Severity: Minor
          Found in lib/cassie/schema/migration/dsl/table_definition.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

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

                def print_statuses(versions)
                  # Note: if we end up using this elsewhere, move to Version::VersionList
                  # or something simliar, and have version collection methods return that
                  headings  = ['Number', 'Description', 'Status', 'Migration File']
                  title = "Environment: #{Cassie.env}"
          Severity: Minor
          Found in lib/cassie/tasks/schema/version_display.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

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

              def paging_state
                return nil unless paging_enabled?
                if previous_paging_state
                  bytes = previous_paging_state.bytes
                  raise 'Too many pages for Cassie testing harness!' if bytes[-1] >= 256
          Severity: Minor
          Found in lib/cassie/testing/fake/result.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

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

              def missing_versions_before(last_rollback)
                return [] unless last_rollback
          
                rollback_index = applied_versions.index(last_rollback)
          
          
          Severity: Minor
          Found in lib/cassie/schema/migrator.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