cequel/cequel

View on GitHub
lib/cequel/metal/row.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

      def self.from_result_row(result_row)
        if result_row
          new.tap do |row|
            result_row.each_pair do |name, value|
              if name =~ /^(ttl|writetime)\((.+)\)$/
Severity: Minor
Found in lib/cequel/metal/row.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

Use alias instead of alias_method in a class body.
Open

      alias_method :timestamp, :writetime
Severity: Minor
Found in lib/cequel/metal/row.rb by rubocop

This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

Example: EnforcedStyle: prefer_alias (default)

# bad
alias_method :bar, :foo
alias :bar :foo

# good
alias bar foo

Example: EnforcedStyle: preferaliasmethod

# bad
alias :bar :foo
alias bar foo

# good
alias_method :bar, :foo

Add an empty line after magic comments.
Open

module Cequel
Severity: Minor
Found in lib/cequel/metal/row.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

Unnecessary utf-8 encoding comment.
Open

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

There are no issues that match your filters.

Category
Status