funkwerk/gherkin_lint

View on GitHub

Showing 31 of 35 total issues

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

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

    def lint
      features do |file, feature|
        name = feature.key?(:name) ? feature[:name].strip : ''
        next unless name.empty?
        references = [reference(file, feature)]
Severity: Minor
Found in lib/gherkin_lint/linter/missing_feature_name.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 filled_scenarios has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def filled_scenarios
      scenarios do |file, feature, scenario|
        next unless scenario.include? :steps
        next if scenario[:steps].empty?
        yield(file, feature, scenario)
Severity: Minor
Found in lib/gherkin_lint/linter.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 lint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def lint
      features do |file, feature|
        next unless feature.include? :name
        expected_feature_name = title_case file
        next if ignore_whitespaces(feature[:name]).casecmp(ignore_whitespaces(expected_feature_name)) == 0
Severity: Minor
Found in lib/gherkin_lint/linter/file_name_differs_feature_name.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 filter_tag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def filter_tag(data, tag)
      return data.reject { |item| tag?(item, tag) }.map { |item| filter_tag(item, tag) } if data.class == Array
      return {} if (data.class == Hash) && (data.include? :feature) && tag?(data[:feature], tag)
      return data unless data.respond_to? :each_pair
      result = {}
Severity: Minor
Found in lib/gherkin_lint/linter.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 line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def line(feature, scenario, step)
      line = feature.nil? ? nil : feature[:location][:line]
      line = scenario[:location][:line] unless scenario.nil?
      line = step[:location][:line] unless step.nil?
      line
Severity: Minor
Found in lib/gherkin_lint/linter.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 evaluate_members has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def evaluate_members(linter)
      @config.config[linter.class.name.split('::').last].each do |member, value|
        next if member.downcase.casecmp('enabled').zero?
        member = member.downcase.to_sym
        raise 'Member not found! Check the YAML' unless linter.respond_to? member
Severity: Minor
Found in lib/gherkin_lint.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 lint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def lint
      scenarios do |file, feature, scenario|
        next if scenario[:name].empty?
        references = [reference(file, feature, scenario)]
        description = 'Prefer to rely just on Given and When steps when name your scenario to keep it stable'
Severity: Minor
Found in lib/gherkin_lint/linter/bad_scenario_name.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 reference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reference(file, feature = nil, scenario = nil, step = nil)
      return file if feature.nil? || feature[:name].empty?
      result = "#{file} (#{line(feature, scenario, step)}): #{feature[:name]}"
      result += ".#{scenario[:name]}" unless scenario.nil? || scenario[:name].empty?
      result += " step: #{step[:text]}" unless step.nil?
Severity: Minor
Found in lib/gherkin_lint/linter.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 lint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def lint
      scenarios do |file, feature, scenario|
        next if match_pattern? tags(feature)
        next if match_pattern? tags(scenario)
        references = [reference(file, feature, scenario)]
Severity: Minor
Found in lib/gherkin_lint/linter/tag_constraint.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