gabynaiman/timing

View on GitHub

Showing 152 of 152 total issues

Method _nt_day_month_name_year has 73 lines of code (exceeds 25 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: Major
Found in lib/timing/natural_time_language.rb - About 2 hrs to fix

    Method _nt_before_from_moment has 72 lines of code (exceeds 25 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: Major
    Found in lib/timing/natural_time_language.rb - About 2 hrs to fix

      File natural_time_language_interpreters.rb has 283 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Timing
        module NaturalTimeLanguage
      
          class << self
      
      
      Severity: Minor
      Found in lib/timing/natural_time_language_interpreters.rb - About 2 hrs to fix

        Method _nt_expression has 69 lines of code (exceeds 25 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: Major
        Found in lib/timing/natural_time_language.rb - About 2 hrs to fix

          Method _nt_named_moment has a Cognitive Complexity of 20 (exceeds 5 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 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

          Class TimeInZone has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class TimeInZone
          
              extend Forwardable
          
              REGEXP = /[+-]\d\d:?\d\d$/
          Severity: Minor
          Found in lib/timing/time_in_zone.rb - About 2 hrs to fix

            Method _nt_last_next_day_name has 66 lines of code (exceeds 25 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: Major
            Found in lib/timing/natural_time_language.rb - About 2 hrs to fix

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

                      if r2
                        r4 = _nt_month_name
                        s0 << r4
                        if r4
                          s5, i5 = [], index
              Severity: Major
              Found in lib/timing/natural_time_language.rb and 1 other location - About 2 hrs to fix
              lib/timing/natural_time_language.rb on lines 46..80

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

              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

                    if r1
                      r3 = _nt_moment
                      s0 << r3
                      if r3
                        s4, i4 = [], index
              Severity: Major
              Found in lib/timing/natural_time_language.rb and 1 other location - About 2 hrs to fix
              lib/timing/natural_time_language.rb on lines 385..419

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

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

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

                Method _nt_moment_at_time has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Similar blocks of code found in 2 locations. 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: Major
                  Found in lib/timing/natural_time_language.rb and 1 other location - About 2 hrs to fix
                  lib/timing/natural_time_language.rb on lines 128..170

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

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

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

                  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_week_interval has a Cognitive Complexity of 17 (exceeds 5 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 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_day_interval has a Cognitive Complexity of 17 (exceeds 5 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 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_minute_interval has a Cognitive Complexity of 17 (exceeds 5 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 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_hour_interval has a Cognitive Complexity of 17 (exceeds 5 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 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_month_interval has a Cognitive Complexity of 17 (exceeds 5 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 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_year_interval has a Cognitive Complexity of 17 (exceeds 5 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 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_second_interval has a Cognitive Complexity of 17 (exceeds 5 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 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

                  Severity
                  Category
                  Status
                  Source
                  Language