funkwerk/gherkin_lint

View on GitHub
lib/gherkin_lint/linter/same_tag_for_all_scenarios.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method lint_examples has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def lint_examples(file, feature)
      feature[:children].each do |scenario|
        tags = gather_same_tags_for_outline scenario
        next if tags.nil? || tags.empty?
        next unless scenario[:examples].length > 1
Severity: Minor
Found in lib/gherkin_lint/linter/same_tag_for_all_scenarios.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 gather_same_tags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def gather_same_tags(feature)
      result = nil
      feature[:children].each do |scenario|
        next if scenario[:type] == :Background
        return nil unless scenario.include? :tags
Severity: Minor
Found in lib/gherkin_lint/linter/same_tag_for_all_scenarios.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

Method lint_scenarios has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def lint_scenarios(file, feature)
      tags = gather_same_tags feature
      return if tags.nil?
      return if tags.empty?
      return unless feature[:children].length > 1
Severity: Minor
Found in lib/gherkin_lint/linter/same_tag_for_all_scenarios.rb - About 35 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 gather_same_tags_for_outline has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def gather_same_tags_for_outline(scenario)
      result = nil
      return result unless scenario.include? :examples
      scenario[:examples].each do |example|
        return nil unless example.include? :tags
Severity: Minor
Found in lib/gherkin_lint/linter/same_tag_for_all_scenarios.rb - About 35 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

There are no issues that match your filters.

Category
Status