openjaf/cenit

View on GitHub
lib/cenit/core_ext.rb

Summary

Maintainability
D
2 days
Test Coverage

File core_ext.rb has 411 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Module
  class << self

    def demongoize(object)
      object.to_s.constantize
Severity: Minor
Found in lib/cenit/core_ext.rb - About 5 hrs to fix

    Method to_method_name has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def to_method_name(taken = nil)
        str = sym2word
        {
          '-' => 'minus',
          '.' => 'dot'
    Severity: Minor
    Found in lib/cenit/core_ext.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 plain_query has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def plain_query(namespace_or_opts = nil)
        namespace =
          if (options = namespace_or_opts).is_a?(Hash)
            namespace_or_opts[:namespace]
          else
    Severity: Minor
    Found in lib/cenit/core_ext.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 to_method_name has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def to_method_name(taken = nil)
        str = sym2word
        {
          '-' => 'minus',
          '.' => 'dot'
    Severity: Minor
    Found in lib/cenit/core_ext.rb - About 1 hr to fix

      Method each_deep_pair has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def each_deep_pair(&block)
          each_pair do |key, value|
            if yield(self, key, value)
              case value
                when Hash
      Severity: Minor
      Found in lib/cenit/core_ext.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 difference has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def difference(other)
          hash = {}
          other.each do |other_key, other_value|
            unless has_key?(other_key)
              hash[other_key] = other_value
      Severity: Minor
      Found in lib/cenit/core_ext.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 to_time_span has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def to_time_span(metric = :s)
          v = self.abs.to_i
          str = ''
          h = {
            ms: 1000,
      Severity: Minor
      Found in lib/cenit/core_ext.rb - About 1 hr to fix

        Method to_time_span has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def to_time_span(metric = :s)
            v = self.abs.to_i
            str = ''
            h = {
              ms: 1000,
        Severity: Minor
        Found in lib/cenit/core_ext.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 do_encode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def do_encode(zip, entries, entry_prefix = nil)
            entries.each do |name, data|
              entry_name = entry_prefix ? "#{entry_prefix}/#{name}" : name
              if data.is_a?(Hash)
                do_encode(zip, data, entry_name)
        Severity: Minor
        Found in lib/cenit/core_ext.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

        There are no issues that match your filters.

        Category
        Status