cucumber/cucumber-ruby-core

View on GitHub

Showing 4 of 4 total issues

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

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

            def subscribe_to(event_bus)
              event_bus.on(:test_case_finished) do |event|
                if event.test_case != @previous_test_case
                  @previous_test_case = event.test_case
                  event.result.describe_to test_cases
    Severity: Minor
    Found in lib/cucumber/core/report/summary.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