cequel/cequel

View on GitHub
lib/cequel/type.rb

Summary

Maintainability
A
25 mins
Test Coverage

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

      def cast(value)
        if value.is_a? Cassandra::Uuid then value
        elsif defined?(SimpleUUID::UUID) && value.is_a?(SimpleUUID::UUID)
          Cassandra::Uuid.new(value.to_i)
        elsif value.is_a?(::Integer) || value.is_a?(::String)
Severity: Minor
Found in lib/cequel/type.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

Freeze mutable objects assigned to constants.
Open

    BY_INTERNAL_NAME = {}
Severity: Minor
Found in lib/cequel/type.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Unnecessary utf-8 encoding comment.
Open

# -*- encoding : utf-8 -*-
Severity: Minor
Found in lib/cequel/type.rb by rubocop

Freeze mutable objects assigned to constants.
Open

    BY_CQL_NAME = {}
Severity: Minor
Found in lib/cequel/type.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Add an empty line after magic comments.
Open

require 'singleton'
Severity: Minor
Found in lib/cequel/type.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

There are no issues that match your filters.

Category
Status