gabynaiman/timing

View on GitHub

Showing 152 of 152 total issues

Method _nt_beginning_end_interval has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _nt_beginning_end_interval
      start_index = index
      if node_cache[:beginning_end_interval].has_key?(index)
        cached = node_cache[:beginning_end_interval][index]
        if cached
Severity: Minor
Found in lib/timing/natural_time_language.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 _nt_end_of has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _nt_end_of
      start_index = index
      if node_cache[:end_of].has_key?(index)
        cached = node_cache[:end_of][index]
        if cached
Severity: Minor
Found in lib/timing/natural_time_language.rb - About 2 hrs to fix

    Method _nt_beginning_of has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def _nt_beginning_of
          start_index = index
          if node_cache[:beginning_of].has_key?(index)
            cached = node_cache[:beginning_of][index]
            if cached
    Severity: Minor
    Found in lib/timing/natural_time_language.rb - About 2 hrs to fix

      Method _nt_year_month_day has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _nt_year_month_day
            start_index = index
            if node_cache[:year_month_day].has_key?(index)
              cached = node_cache[:year_month_day][index]
              if cached
      Severity: Minor
      Found in lib/timing/natural_time_language.rb - About 1 hr to fix

        Method _nt_interval has 49 lines of code (exceeds 25 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 1 hr to fix

          Method _nt_integer has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def _nt_integer
                start_index = index
                if node_cache[:integer].has_key?(index)
                  cached = node_cache[:integer][index]
                  if cached
          Severity: Minor
          Found in lib/timing/natural_time_language.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

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

              def _nt_zone_name
                start_index = index
                if node_cache[:zone_name].has_key?(index)
                  cached = node_cache[:zone_name][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 1459..1480

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_last
                start_index = index
                if node_cache[:last].has_key?(index)
                  cached = node_cache[:last][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 1459..1480
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_from
                start_index = index
                if node_cache[:from].has_key?(index)
                  cached = node_cache[:from][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_today
                start_index = index
                if node_cache[:today].has_key?(index)
                  cached = node_cache[:today][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 1459..1480
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_yesterday
                start_index = index
                if node_cache[:yesterday].has_key?(index)
                  cached = node_cache[:yesterday][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 1459..1480
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_now
                start_index = index
                if node_cache[:now].has_key?(index)
                  cached = node_cache[:now][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 1459..1480
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_tomorrow
                start_index = index
                if node_cache[:tomorrow].has_key?(index)
                  cached = node_cache[:tomorrow][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 1459..1480
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_next
                start_index = index
                if node_cache[:next].has_key?(index)
                  cached = node_cache[:next][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1435..1456
          lib/timing/natural_time_language.rb on lines 1459..1480
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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 9 locations. Consider refactoring.
          Open

              def _nt_before
                start_index = index
                if node_cache[:before].has_key?(index)
                  cached = node_cache[:before][index]
                  if cached
          Severity: Major
          Found in lib/timing/natural_time_language.rb and 8 other locations - About 1 hr to fix
          lib/timing/natural_time_language.rb on lines 1075..1096
          lib/timing/natural_time_language.rb on lines 1099..1120
          lib/timing/natural_time_language.rb on lines 1123..1144
          lib/timing/natural_time_language.rb on lines 1147..1168
          lib/timing/natural_time_language.rb on lines 1201..1222
          lib/timing/natural_time_language.rb on lines 1225..1246
          lib/timing/natural_time_language.rb on lines 1459..1480
          lib/timing/natural_time_language.rb on lines 2555..2576

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

          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_interval has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def _nt_day_interval
                start_index = index
                if node_cache[:day_interval].has_key?(index)
                  cached = node_cache[:day_interval][index]
                  if cached
          Severity: Minor
          Found in lib/timing/natural_time_language.rb - About 1 hr to fix

            Method _nt_week_interval has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def _nt_week_interval
                  start_index = index
                  if node_cache[:week_interval].has_key?(index)
                    cached = node_cache[:week_interval][index]
                    if cached
            Severity: Minor
            Found in lib/timing/natural_time_language.rb - About 1 hr to fix

              Method _nt_hour_interval has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def _nt_hour_interval
                    start_index = index
                    if node_cache[:hour_interval].has_key?(index)
                      cached = node_cache[:hour_interval][index]
                      if cached
              Severity: Minor
              Found in lib/timing/natural_time_language.rb - About 1 hr to fix

                Method _nt_month_interval has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def _nt_month_interval
                      start_index = index
                      if node_cache[:month_interval].has_key?(index)
                        cached = node_cache[:month_interval][index]
                        if cached
                Severity: Minor
                Found in lib/timing/natural_time_language.rb - About 1 hr to fix

                  Method _nt_second_interval has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def _nt_second_interval
                        start_index = index
                        if node_cache[:second_interval].has_key?(index)
                          cached = node_cache[:second_interval][index]
                          if cached
                  Severity: Minor
                  Found in lib/timing/natural_time_language.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language