enkessler/cuke_linter

View on GitHub

Showing 17 of 27 total issues

Method generate_fake_linter_class has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_fake_linter_class(module_name: nil, class_name: nil, linter_name: nil, finds_problems: nil)
      class_name     ||= 'FakeLinter'
      linter_name    ||= 'Some Name'
      finds_problems ||= true

Severity: Minor
Found in testing/linter_factory.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 rule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def rule(model)
      return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)

      model_steps       = model.steps || []
      action_step_found = false

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 rule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def rule(model)
      return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)

      model_steps             = model.steps || []
      verification_step_found = false

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 combine_code_coverage_reports has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def combine_code_coverage_reports # rubocop:disable Metrics/AbcSize, Metrics/MethodLength - It'll get better when support for older versions of Ruby is dropped.
      all_results = Dir["#{ENV.fetch('CUKE_LINTER_REPORT_FOLDER')}/{rspec,cucumber}/part_*/coverage/.resultset.json"]

      # Never versions of SimpleCov make combining reports a lot easier
      if SimpleCov.respond_to?(:collate)
Severity: Minor
Found in testing/parallel_helper.rb - About 1 hr to fix

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

        def generate_fake_linter(name: 'FakeLinter', finds_problems: true)
          linter = Object.new
    
          linter.define_singleton_method('lint') do |model|
            location = if model.respond_to?(:source_line)
    Severity: Minor
    Found in testing/linter_factory.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 no_parameterized_steps? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def no_parameterized_steps?(feature_model)
          feature_model.tests.none? do |test|
            next false if test.is_a?(CukeModeler::Scenario)
    
            test_steps          = test.steps || []
    Severity: Minor
    Found in lib/cuke_linter/linters/test_should_use_background_linter.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(model)
          raise 'No linting rule provided!' unless @rule || respond_to?(:rule)
    
          problem_found = respond_to?(:rule) ? rule(model) : @rule.call(model)
    
    
    Severity: Minor
    Found in lib/cuke_linter/linters/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 rule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def rule(model)
          return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
    
          model_steps          = model.steps || []
          parent_feature_model = model.get_ancestor(:feature)
    Severity: Minor
    Found in lib/cuke_linter/linters/test_should_use_background_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 load_configuration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_configuration(config_file_path: nil, config: nil)
          # TODO: define what happens if both a configuration file and a configuration are
          # provided. Merge them or have direct config take precedence? Both?
    
          unless config || config_file_path
    Severity: Minor
    Found in lib/cuke_linter/configuration.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 configure_linters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def configure_linters(configuration, linters) # rubocop:disable Metrics/CyclomaticComplexity - Maybe I'll revisit this later
          common_config = configuration['AllLinters'] || {}
          to_delete     = []
    
          linters.each_pair do |name, linter|
    Severity: Minor
    Found in lib/cuke_linter/configuration.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 sort_locations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def sort_locations(locations)
          locations.sort do |a, b|
            file_name_1   = a.match(/(.*?)(?::\d+)?$/)[1]
            line_number_1 = a =~ /:\d+$/ ? a.match(/:(\d+)$/)[1].to_i : 0
            file_name_2   = b.match(/(.*?)(?::\d+)?$/)[1]
    Severity: Minor
    Found in lib/cuke_linter/formatters/pretty_formatter.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 rule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def rule(model)
          return false unless relevant_model?(model)
    
          @linted_model_class   = model.class
          @linted_tag_threshold = @tag_threshold || 5
    Severity: Minor
    Found in lib/cuke_linter/linters/element_with_too_many_tags_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 rule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def rule(model)
          return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
    
          model_steps      = model.steps || []
          background_steps = model.parent_model.has_background? ? model.parent_model.background.steps || [] : []
    Severity: Minor
    Found in lib/cuke_linter/linters/test_with_no_action_step_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 rule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def rule(model)
          return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
    
          @linted_step_count     = model.steps.nil? ? 0 : model.steps.count
          @linted_step_threshold = @step_threshold || 10
    Severity: Minor
    Found in lib/cuke_linter/linters/test_with_too_many_steps_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 rule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def rule(model)
          return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
    
          model_steps = model.steps || []
          return false unless model_steps.last
    Severity: Minor
    Found in lib/cuke_linter/linters/test_with_setup_step_as_final_step_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 rule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def rule(model)
          return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
    
          model_steps = model.steps || []
          return false unless model_steps.last
    Severity: Minor
    Found in lib/cuke_linter/linters/test_with_action_step_as_final_step_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 rule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def rule(model)
          return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
    
          model_steps      = model.steps || []
          background_steps = model.parent_model.has_background? ? model.parent_model.background.steps || [] : []
    Severity: Minor
    Found in lib/cuke_linter/linters/test_with_no_verification_step_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

    Severity
    Category
    Status
    Source
    Language