funkwerk/gherkin_lint

View on GitHub

Showing 31 of 35 total issues

Class Linter has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Linter
    attr_reader :issues

    def self.descendants
      ObjectSpace.each_object(::Class).select { |klass| klass < self }
Severity: Minor
Found in lib/gherkin_lint/linter.rb - About 2 hrs to fix

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

        def lint
          scenarios do |file, feature, scenario|
            next unless scenario.key? :examples
            next unless scenario[:examples].length > 1
            scenario[:examples].each do |example|
    Severity: Minor
    Found in lib/gherkin_lint/linter/missing_example_name.rb - About 2 hrs 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 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def lint
          scenarios do |file, feature, scenario|
            next unless scenario[:type] == :ScenarioOutline
    
            next unless scenario.key? :examples
    Severity: Minor
    Found in lib/gherkin_lint/linter/avoid_outline_for_single_example.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 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def lint
          scenarios do |file, feature, scenario|
            next unless scenario.key? :examples
            scenario[:examples].each do |example|
              next unless example.key? :tableHeader
    Severity: Minor
    Found in lib/gherkin_lint/linter/unused_variable.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_scenarios has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def gather_scenarios(file, feature)
          scenarios = []
          return scenarios unless feature.include? :children
          feature[:children].each do |scenario|
            next unless scenario[:type] == :Scenario
    Severity: Minor
    Found in lib/gherkin_lint/linter/use_outline.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 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 used? has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def used?(variable, scenario)
          variable = "<#{variable}>"
          return false unless scenario.key? :steps
          scenario[:steps].each do |step|
            return true if step[:text].include? variable
    Severity: Minor
    Found in lib/gherkin_lint/linter/unused_variable.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_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 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 check_similarity has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_similarity(scenarios)
          scenarios.product(scenarios) do |lhs, rhs|
            next if lhs == rhs
            next if lhs[:reference] > rhs[:reference]
            similarity = determine_similarity(lhs[:text], rhs[:text])
    Severity: Minor
    Found in lib/gherkin_lint/linter/use_outline.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

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

        def lint
          backgrounds do |file, feature, background|
            next unless background.key? :steps
            invalid_steps = background[:steps].select { |step| step[:keyword] == 'When ' || step[:keyword] == 'Then ' }
            next if invalid_steps.empty?
    Severity: Minor
    Found in lib/gherkin_lint/linter/background_does_more_than_setup.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 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

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

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

        def elements
          @files.each do |file, content|
            feature = content[:feature]
            next if feature.nil?
            next unless feature.key? :children
    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 suppress_tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def suppress_tags(data, tags)
          return data.map { |item| suppress_tags(item, tags) } if data.class == Array
          return data unless data.class == Hash
          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 lint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def lint
          references_by_name = Hash.new []
          scenarios do |file, feature, scenario|
            next unless scenario.key? :name
            scenario_name = "#{feature[:name]}.#{scenario[:name]}"
    Severity: Minor
    Found in lib/gherkin_lint/linter/unique_scenario_names.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

    Severity
    Category
    Status
    Source
    Language