eprothro/cassie

View on GitHub

Showing 24 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          def define_max_accessors(key)
            attr_accessor :max_cursor
    
            define_method :max_cursor_enabled? do
              !max_cursor.nil?
    Severity: Minor
    Found in lib/cassie/statements/statement/pagination/cursors.rb and 1 other location - About 45 mins to fix
    lib/cassie/statements/statement/pagination/cursors.rb on lines 69..85

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          def define_since_accessors(key)
            attr_accessor :since_cursor
    
            define_method :since_cursor_enabled? do
              !since_cursor.nil?
    Severity: Minor
    Found in lib/cassie/statements/statement/pagination/cursors.rb and 1 other location - About 45 mins to fix
    lib/cassie/statements/statement/pagination/cursors.rb on lines 49..65

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 41.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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(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 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(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 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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              module ClassMethods
                def inherited(subclass)
                  subclass.limit = limit if defined?(@limit)
                  super
                end
          Severity: Minor
          Found in lib/cassie/statements/statement/limiting.rb and 1 other location - About 35 mins to fix
          lib/cassie/statements/execution/consistency.rb on lines 18..33

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 34.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              module ClassMethods
                def inherited(subclass)
                  subclass.consistency = consistency if defined?(@consistency)
                  super
                end
          Severity: Minor
          Found in lib/cassie/statements/execution/consistency.rb and 1 other location - About 35 mins to fix
          lib/cassie/statements/statement/limiting.rb on lines 22..37

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 34.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

          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

          Severity
          Category
          Status
          Source
          Language