cucumber/cucumber-ruby-core

View on GitHub

Showing 14 of 14 total issues

File ast_builder.rb has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'cucumber/core/ast'
require 'cucumber/core/platform'

module Cucumber
  module Core
Severity: Minor
Found in lib/cucumber/core/gherkin/ast_builder.rb - About 4 hrs to fix

    Method new has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.new(*attributes, &block)
            attributes << :receiver
    
            result = Class.new do
              attr_reader(*attributes)
    Severity: Minor
    Found in lib/cucumber/core/filter.rb - About 1 hr to fix

      Method store_and_extract_limits has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def store_and_extract_limits(tags_with_negation_and_limits, negated)
            tags_with_negation = []
            tags_with_negation_and_limits.each do |tag_with_negation_and_limit|
              tag_with_negation, limit = tag_with_negation_and_limit.split(':')
              tags_with_negation << tag_with_negation
      Severity: Minor
      Found in lib/cucumber/core/gherkin/tag_expression.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 initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def initialize(language, location, comments, tags, keyword, name, description, feature_elements)
      Severity: Major
      Found in lib/cucumber/core/ast/feature.rb - About 1 hr to fix

        Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def initialize(location, comments, tags, keyword, name, description, header, example_rows)
        Severity: Major
        Found in lib/cucumber/core/ast/examples_table.rb - About 1 hr to fix

          Method initialize has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def initialize(location, comments, tags, keyword, name, description, steps, examples)
          Severity: Major
          Found in lib/cucumber/core/ast/scenario_outline.rb - About 1 hr to fix

            Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def initialize(location, comments, tags, keyword, name, description, steps)
            Severity: Major
            Found in lib/cucumber/core/ast/scenario.rb - About 50 mins to fix

              Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def initialize(outline_step, language, location, comments, keyword, text, multiline_arg)
              Severity: Major
              Found in lib/cucumber/core/ast/step.rb - About 50 mins to fix

                Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def initialize(language, location, comments, keyword, text, multiline_arg)
                Severity: Minor
                Found in lib/cucumber/core/ast/outline_step.rb - About 45 mins to fix

                  Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def initialize(location, comments, keyword, name, description, raw_steps)
                  Severity: Minor
                  Found in lib/cucumber/core/ast/background.rb - About 45 mins to fix

                    Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def initialize(language, location, comments, keyword, text, multiline_arg)
                    Severity: Minor
                    Found in lib/cucumber/core/ast/step.rb - About 45 mins to fix

                      Method build_row has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                def build_row(row_cells, number, location, language, comments)
                      Severity: Minor
                      Found in lib/cucumber/core/ast/examples_table.rb - About 35 mins to fix

                        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                  def initialize(data, number, location, language, comments)
                        Severity: Minor
                        Found in lib/cucumber/core/ast/examples_table.rb - About 35 mins to fix

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

                                def validate_handler_and_event_id!(handler, event_id)
                                  raise ArgumentError, "Please pass either an object or a handler block" unless handler
                                  raise ArgumentError, "Please use a symbol for the event_id" unless event_id.is_a?(Symbol)
                                  raise ArgumentError, "Event ID #{event_id} is not recognised. Try one of these:\n#{event_types.keys.join("\n")}" unless is_registered_id?(event_id)
                                end
                          Severity: Minor
                          Found in lib/cucumber/core/event_bus.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

                          Severity
                          Category
                          Status
                          Source
                          Language