gabynaiman/timing

View on GitHub

Showing 152 of 152 total issues

Avoid deeply nested control flow statements.
Open

              if r5
                r0 = r5
              else
                if has_terminal?('fri', false, index)
                  r6 = instantiate_node(DayName,input, index...(index + 3))
Severity: Major
Found in lib/timing/natural_time_language.rb - About 45 mins to fix

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

        def >(other)
          raise ArgumentError, "Invalid argument #{other}" unless other.is_a?(HourMinutesSeconds)
    
          (hour > other.hour) ||
          (hour == other.hour && minutes > other.minutes) ||
    Severity: Minor
    Found in lib/timing/hour_minutes_seconds.rb and 1 other location - About 45 mins to fix
    lib/timing/hour_minutes_seconds.rb on lines 41..47

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

    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

    Avoid deeply nested control flow statements.
    Open

                  if has_terminal?('may', false, index)
                    r5 = instantiate_node(MonthName,input, index...(index + 3))
                    @index += 3
                  else
                    terminal_parse_failure('may')
    Severity: Major
    Found in lib/timing/natural_time_language.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if r5
                      r0 = r5
                    else
                      if has_terminal?('jun', false, index)
                        r6 = instantiate_node(MonthName,input, index...(index + 3))
      Severity: Major
      Found in lib/timing/natural_time_language.rb - About 45 mins to fix

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

            def <(other)
              raise ArgumentError, "Invalid argument #{other}" unless other.is_a?(HourMinutesSeconds)
        
              (hour < other.hour) ||
              (hour == other.hour && minutes < other.minutes) ||
        Severity: Minor
        Found in lib/timing/hour_minutes_seconds.rb and 1 other location - About 45 mins to fix
        lib/timing/hour_minutes_seconds.rb on lines 33..39

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

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

            def <(other)
              raise ArgumentError, "Invalid argument #{other}" unless other.is_a?(HourMinutesSeconds)
        
              (hour < other.hour) ||
              (hour == other.hour && minutes < other.minutes) ||
        Severity: Minor
        Found in lib/timing/hour_minutes_seconds.rb - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method > has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def >(other)
              raise ArgumentError, "Invalid argument #{other}" unless other.is_a?(HourMinutesSeconds)
        
              (hour > other.hour) ||
              (hour == other.hour && minutes > other.minutes) ||
        Severity: Minor
        Found in lib/timing/hour_minutes_seconds.rb - About 25 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            class SecondInterval < Treetop::Runtime::SyntaxNode
              def time_ago(time, number)
                time - Interval.seconds(number)
              end
        
        
        Severity: Minor
        Found in lib/timing/natural_time_language_interpreters.rb and 1 other location - About 15 mins to fix
        lib/timing/natural_time_language_interpreters.rb on lines 190..204

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

        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

            class DayInterval < Treetop::Runtime::SyntaxNode
              def time_ago(time, number)
                time - Interval.days(number)
              end
        
        
        Severity: Minor
        Found in lib/timing/natural_time_language_interpreters.rb and 2 other locations - About 15 mins to fix
        lib/timing/natural_time_language_interpreters.rb on lines 208..222
        lib/timing/natural_time_language_interpreters.rb on lines 244..258

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

        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

            class HourInterval < Treetop::Runtime::SyntaxNode
              def time_ago(time, number)
                time - Interval.hours(number)
              end
        
        
        Severity: Minor
        Found in lib/timing/natural_time_language_interpreters.rb and 2 other locations - About 15 mins to fix
        lib/timing/natural_time_language_interpreters.rb on lines 226..240
        lib/timing/natural_time_language_interpreters.rb on lines 244..258

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

        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

            class WeekInterval < Treetop::Runtime::SyntaxNode
              def time_ago(time, number)
                time - Interval.weeks(number)
              end
        
        
        Severity: Minor
        Found in lib/timing/natural_time_language_interpreters.rb and 2 other locations - About 15 mins to fix
        lib/timing/natural_time_language_interpreters.rb on lines 208..222
        lib/timing/natural_time_language_interpreters.rb on lines 226..240

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

        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

            class MinuteInterval < Treetop::Runtime::SyntaxNode
              def time_ago(time, number)
                time - Interval.minutes(number)
              end
        
        
        Severity: Minor
        Found in lib/timing/natural_time_language_interpreters.rb and 1 other location - About 15 mins to fix
        lib/timing/natural_time_language_interpreters.rb on lines 172..186

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

        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

        Severity
        Category
        Status
        Source
        Language