funkwerk/gherkin_lint

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

Summary

Maintainability
B
5 hrs
Test Coverage

Method expanded_steps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def expanded_steps(feature)
      feature[:children].each do |scenario|
        next unless scenario[:type] != :Background
        next unless scenario.include? :steps
        next if scenario[:steps].empty?
Severity: Minor
Found in lib/gherkin_lint/linter/use_background.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_givens has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def gather_givens(feature)
      return unless feature.include? :children
      has_non_given_step = false
      feature[:children].each do |scenario|
        next unless scenario.include? :steps
Severity: Minor
Found in lib/gherkin_lint/linter/use_background.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 lint has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def lint
      features do |file, feature|
        next if scenarios_with_steps(feature) <= 1
        givens = gather_givens feature
        next if givens.nil?
Severity: Minor
Found in lib/gherkin_lint/linter/use_background.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 scenarios_with_steps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def scenarios_with_steps(feature)
      scenarios = 0
      return 0 unless feature.key? :children
      feature[:children].each do |scenario|
        next unless scenario.include? :steps
Severity: Minor
Found in lib/gherkin_lint/linter/use_background.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

There are no issues that match your filters.

Category
Status