gabynaiman/timing

View on GitHub

Showing 152 of 152 total issues

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

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

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

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

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

          def _nt_month_name
            start_index = index
            if node_cache[:month_name].has_key?(index)
              cached = node_cache[:month_name][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 5 other locations - About 1 hr to fix
      lib/timing/natural_time_language.rb on lines 98..125
      lib/timing/natural_time_language.rb on lines 1171..1198
      lib/timing/natural_time_language.rb on lines 1249..1276
      lib/timing/natural_time_language.rb on lines 1405..1432
      lib/timing/natural_time_language.rb on lines 1895..1922

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

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

          def _nt_before_from
            start_index = index
            if node_cache[:before_from].has_key?(index)
              cached = node_cache[:before_from][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 5 other locations - About 1 hr to fix
      lib/timing/natural_time_language.rb on lines 98..125
      lib/timing/natural_time_language.rb on lines 1171..1198
      lib/timing/natural_time_language.rb on lines 1249..1276
      lib/timing/natural_time_language.rb on lines 1895..1922
      lib/timing/natural_time_language.rb on lines 2119..2146

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

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

          def _nt_day_name
            start_index = index
            if node_cache[:day_name].has_key?(index)
              cached = node_cache[:day_name][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 5 other locations - About 1 hr to fix
      lib/timing/natural_time_language.rb on lines 98..125
      lib/timing/natural_time_language.rb on lines 1171..1198
      lib/timing/natural_time_language.rb on lines 1249..1276
      lib/timing/natural_time_language.rb on lines 1405..1432
      lib/timing/natural_time_language.rb on lines 2119..2146

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

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

          def _nt_last_next
            start_index = index
            if node_cache[:last_next].has_key?(index)
              cached = node_cache[:last_next][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 5 other locations - About 1 hr to fix
      lib/timing/natural_time_language.rb on lines 98..125
      lib/timing/natural_time_language.rb on lines 1249..1276
      lib/timing/natural_time_language.rb on lines 1405..1432
      lib/timing/natural_time_language.rb on lines 1895..1922
      lib/timing/natural_time_language.rb on lines 2119..2146

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

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

          def _nt_zone_info
            start_index = index
            if node_cache[:zone_info].has_key?(index)
              cached = node_cache[:zone_info][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 5 other locations - About 1 hr to fix
      lib/timing/natural_time_language.rb on lines 1171..1198
      lib/timing/natural_time_language.rb on lines 1249..1276
      lib/timing/natural_time_language.rb on lines 1405..1432
      lib/timing/natural_time_language.rb on lines 1895..1922
      lib/timing/natural_time_language.rb on lines 2119..2146

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

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

          def _nt_beginning_end
            start_index = index
            if node_cache[:beginning_end].has_key?(index)
              cached = node_cache[:beginning_end][index]
              if cached
      Severity: Major
      Found in lib/timing/natural_time_language.rb and 5 other locations - About 1 hr to fix
      lib/timing/natural_time_language.rb on lines 98..125
      lib/timing/natural_time_language.rb on lines 1171..1198
      lib/timing/natural_time_language.rb on lines 1405..1432
      lib/timing/natural_time_language.rb on lines 1895..1922
      lib/timing/natural_time_language.rb on lines 2119..2146

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

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

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

        Method _nt_date_moment has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

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

                                        if r20
                                          s21, i21 = [], index
                                          loop do
                                            if has_terminal?('\G[\\d]', true, index)
                                              r22 = true
            Severity: Major
            Found in lib/timing/natural_time_language.rb and 2 other locations - About 1 hr to fix
            lib/timing/natural_time_language.rb on lines 2514..2538
            lib/timing/natural_time_language.rb on lines 2666..2690

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

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

                        if r9
                          s10, i10 = [], index
                          loop do
                            if has_terminal?('\G[\\d]', true, index)
                              r11 = true
            Severity: Major
            Found in lib/timing/natural_time_language.rb and 2 other locations - About 1 hr to fix
            lib/timing/natural_time_language.rb on lines 1025..1049
            lib/timing/natural_time_language.rb on lines 2514..2538

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

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

                      if r4
                        s6, i6 = [], index
                        loop do
                          if has_terminal?('\G[\\d]', true, index)
                            r7 = true
            Severity: Major
            Found in lib/timing/natural_time_language.rb and 2 other locations - About 1 hr to fix
            lib/timing/natural_time_language.rb on lines 1025..1049
            lib/timing/natural_time_language.rb on lines 2666..2690

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

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

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

              Method _nt_day_name has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _nt_day_name
                    start_index = index
                    if node_cache[:day_name].has_key?(index)
                      cached = node_cache[:day_name][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

              Method _nt_before_from has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _nt_before_from
                    start_index = index
                    if node_cache[:before_from].has_key?(index)
                      cached = node_cache[:before_from][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

              Method _nt_beginning_end has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _nt_beginning_end
                    start_index = index
                    if node_cache[:beginning_end].has_key?(index)
                      cached = node_cache[:beginning_end][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

              Method _nt_last_next has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _nt_last_next
                    start_index = index
                    if node_cache[:last_next].has_key?(index)
                      cached = node_cache[:last_next][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

              Method _nt_month_name has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _nt_month_name
                    start_index = index
                    if node_cache[:month_name].has_key?(index)
                      cached = node_cache[:month_name][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

              Severity
              Category
              Status
              Source
              Language