gabynaiman/timing

View on GitHub

Showing 152 of 152 total issues

Method _nt_timestamp has a Cognitive Complexity of 370 (exceeds 5 allowed). Consider refactoring.
Open

    def _nt_timestamp
      start_index = index
      if node_cache[:timestamp].has_key?(index)
        cached = node_cache[:timestamp][index]
        if cached
Severity: Minor
Found in lib/timing/natural_time_language.rb - About 1 wk 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

File natural_time_language.rb has 2589 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Timing
  module NaturalTimeLanguage
    include Treetop::Runtime

    def root
Severity: Major
Found in lib/timing/natural_time_language.rb - About 1 wk to fix

    Method _nt_short_month_name has a Cognitive Complexity of 186 (exceeds 5 allowed). Consider refactoring.
    Open

        def _nt_short_month_name
          start_index = index
          if node_cache[:short_month_name].has_key?(index)
            cached = node_cache[:short_month_name][index]
            if cached
    Severity: Minor
    Found in lib/timing/natural_time_language.rb - About 3 days 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 _nt_long_month_name has a Cognitive Complexity of 186 (exceeds 5 allowed). Consider refactoring.
    Open

        def _nt_long_month_name
          start_index = index
          if node_cache[:long_month_name].has_key?(index)
            cached = node_cache[:long_month_name][index]
            if cached
    Severity: Minor
    Found in lib/timing/natural_time_language.rb - About 3 days 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 _nt_hour_minute_second has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
    Open

        def _nt_hour_minute_second
          start_index = index
          if node_cache[:hour_minute_second].has_key?(index)
            cached = node_cache[:hour_minute_second][index]
            if cached
    Severity: Minor
    Found in lib/timing/natural_time_language.rb - About 2 days 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 _nt_long_month_name
          start_index = index
          if node_cache[:long_month_name].has_key?(index)
            cached = node_cache[:long_month_name][index]
            if cached
    Severity: Major
    Found in lib/timing/natural_time_language.rb and 1 other location - About 1 day to fix
    lib/timing/natural_time_language.rb on lines 2301..2450

    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 400.

    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 _nt_short_month_name
          start_index = index
          if node_cache[:short_month_name].has_key?(index)
            cached = node_cache[:short_month_name][index]
            if cached
    Severity: Major
    Found in lib/timing/natural_time_language.rb and 1 other location - About 1 day to fix
    lib/timing/natural_time_language.rb on lines 2149..2298

    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 400.

    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 _nt_long_day_name has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

        def _nt_long_day_name
          start_index = index
          if node_cache[:long_day_name].has_key?(index)
            cached = node_cache[:long_day_name][index]
            if cached
    Severity: Minor
    Found in lib/timing/natural_time_language.rb - About 1 day 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 _nt_short_day_name has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

        def _nt_short_day_name
          start_index = index
          if node_cache[:short_day_name].has_key?(index)
            cached = node_cache[:short_day_name][index]
            if cached
    Severity: Minor
    Found in lib/timing/natural_time_language.rb - About 1 day 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 _nt_timestamp has 254 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def _nt_timestamp
          start_index = index
          if node_cache[:timestamp].has_key?(index)
            cached = node_cache[:timestamp][index]
            if cached
    Severity: Major
    Found in lib/timing/natural_time_language.rb - About 1 day to fix

      Method _nt_zone_offset has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

          def _nt_zone_offset
            start_index = index
            if node_cache[:zone_offset].has_key?(index)
              cached = node_cache[:zone_offset][index]
              if cached
      Severity: Minor
      Found in lib/timing/natural_time_language.rb - About 1 day 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 _nt_short_day_name
            start_index = index
            if node_cache[:short_day_name].has_key?(index)
              cached = node_cache[:short_day_name][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 1 other location - About 7 hrs to fix
      lib/timing/natural_time_language.rb on lines 1925..2019

      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 255.

      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 _nt_long_day_name
            start_index = index
            if node_cache[:long_day_name].has_key?(index)
              cached = node_cache[:long_day_name][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 1 other location - About 7 hrs to fix
      lib/timing/natural_time_language.rb on lines 2022..2116

      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 255.

      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 _nt_day_month_name_year has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          def _nt_day_month_name_year
            start_index = index
            if node_cache[:day_month_name_year].has_key?(index)
              cached = node_cache[:day_month_name_year][index]
              if cached
      Severity: Minor
      Found in lib/timing/natural_time_language.rb - About 7 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 _nt_before_from_moment has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          def _nt_before_from_moment
            start_index = index
            if node_cache[:before_from_moment].has_key?(index)
              cached = node_cache[:before_from_moment][index]
              if cached
      Severity: Minor
      Found in lib/timing/natural_time_language.rb - About 7 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 _nt_last_next_day_name has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          def _nt_last_next_day_name
            start_index = index
            if node_cache[:last_next_day_name].has_key?(index)
              cached = node_cache[:last_next_day_name][index]
              if cached
      Severity: Minor
      Found in lib/timing/natural_time_language.rb - About 6 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 _nt_hour_minute_second has 158 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _nt_hour_minute_second
            start_index = index
            if node_cache[:hour_minute_second].has_key?(index)
              cached = node_cache[:hour_minute_second][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb - About 6 hrs to fix

        Method _nt_expression has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            def _nt_expression
              start_index = index
              if node_cache[:expression].has_key?(index)
                cached = node_cache[:expression][index]
                if cached
        Severity: Minor
        Found in lib/timing/natural_time_language.rb - About 6 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 _nt_interval has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            def _nt_interval
              start_index = index
              if node_cache[:interval].has_key?(index)
                cached = node_cache[:interval][index]
                if cached
        Severity: Minor
        Found in lib/timing/natural_time_language.rb - About 6 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 _nt_short_month_name has 146 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def _nt_short_month_name
              start_index = index
              if node_cache[:short_month_name].has_key?(index)
                cached = node_cache[:short_month_name][index]
                if cached
        Severity: Major
        Found in lib/timing/natural_time_language.rb - About 5 hrs to fix
          Severity
          Category
          Status
          Source
          Language