jgraichen/gurke

View on GitHub

Showing 15 of 15 total issues

Class Reporter has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Reporter
    # List of all callback methods as symbols.
    #
    CALLBACKS = %i[
      before_features
Severity: Minor
Found in lib/gurke/reporter.rb - About 2 hrs to fix

    Method after_step has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def after_step(result, scenario, *)
          return unless result.state == :failed
    
          io.print red 'E'
    
    
    Severity: Minor
    Found in lib/gurke/reporters/compact_reporter.rb - About 1 hr to fix

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

          def after_step(result, scenario, *)
            return unless result.state == :failed
      
            io.print red 'E'
      
      
      Severity: Minor
      Found in lib/gurke/reporters/compact_reporter.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 filter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def filter(options, files)
            list   = FeatureList.new
            filter = Filter.new options, files
      
            each do |feature|
      Severity: Minor
      Found in lib/gurke/feature_list.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 expand_files has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def expand_files(files, options)
            files = Dir[options[:pattern].to_s] if files.empty? && options[:pattern]
            files.each_with_object([]) do |input, memo|
              if File.directory? input
                Dir["#{input}/**/*"].each do |file_in_dir|
      Severity: Minor
      Found in lib/gurke/cli.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 format_exception has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def format_exception(err, backtrace: true, indent: 0)
            s = ::StringIO.new
            s << (' ' * indent) << err.class.to_s << ': ' << err.message.strip << "\n"
      
            if backtrace && err.respond_to?(:backtrace)
      Severity: Minor
      Found in lib/gurke/reporter.rb - About 55 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 after_features has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def after_features(features)
            scenarios = features.map(&:scenarios).flatten
      
            size    = scenarios.size
            passed  = scenarios.count(&:passed?)
      Severity: Minor
      Found in lib/gurke/reporters/default_reporter.rb - About 45 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

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

          def format_location(obj)
            file = obj.file.to_s
            line = obj.line.to_s
            cwd  = Pathname.new(Dir.getwd)
            path = Pathname.new(file).relative_path_from(cwd).to_s
      Severity: Minor
      Found in lib/gurke/reporters/default_reporter.rb and 1 other location - About 40 mins to fix
      lib/gurke/reporters/compact_reporter.rb on lines 119..126

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

      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

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

          def format_location(obj)
            file = obj.file.to_s
            line = obj.line.to_s
            cwd  = Pathname.new(Dir.getwd)
            path = Pathname.new(file).relative_path_from(cwd).to_s
      Severity: Minor
      Found in lib/gurke/reporters/compact_reporter.rb and 1 other location - About 40 mins to fix
      lib/gurke/reporters/default_reporter.rb on lines 149..156

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

      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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(feature, file, line, tags, raw)
      Severity: Minor
      Found in lib/gurke/scenario.rb - About 35 mins to fix

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

            %i[black red green yellow blue
               magenta cyan white default light_black
               light_red light_green light_yellow light_blue
               light_magenta light_cyan light_white].each do |color|
              define_method(color) {|str| io.tty? ? str.send(color) : str }
        Severity: Minor
        Found in lib/gurke/reporters/default_reporter.rb and 1 other location - About 30 mins to fix
        lib/gurke/reporters/compact_reporter.rb on lines 129..133

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

        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

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

            %i[black red green yellow blue
               magenta cyan white default light_black
               light_red light_green light_yellow light_blue
               light_magenta light_cyan light_white].each do |color|
              define_method(color) {|str| io.tty? ? str.send(color) : str }
        Severity: Minor
        Found in lib/gurke/reporters/compact_reporter.rb and 1 other location - About 30 mins to fix
        lib/gurke/reporters/default_reporter.rb on lines 159..163

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

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

            def run(runner, reporter)
              reporter.invoke :before_scenario, self
        
              _run(runner, reporter)
        
        
        Severity: Minor
        Found in lib/gurke/scenario.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

                    io.print '      '
                    io.print yellow(step.keyword)
                    io.print ' '
                    io.print step.name.gsub(/"(.*?)"/, cyan('\0'))
                    io.puts
        Severity: Minor
        Found in lib/gurke/reporters/compact_reporter.rb and 1 other location - About 25 mins to fix
        lib/gurke/reporters/compact_reporter.rb on lines 64..70

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

        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

                  io.print '    '
                  io.print yellow(step.keyword)
                  io.print ' '
                  io.print step.name.gsub(/"(.*?)"/, cyan('\0'))
                  io.puts
        Severity: Minor
        Found in lib/gurke/reporters/compact_reporter.rb and 1 other location - About 25 mins to fix
        lib/gurke/reporters/compact_reporter.rb on lines 53..59

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

        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