r-cochran/cuke_sniffer

View on GitHub

Showing 18 of 26 total issues

File rule_config.rb has 478 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module CukeSniffer

  # Contains the rules and various scores used in evaluating objects
  module RuleConfig

Severity: Minor
Found in lib/cuke_sniffer/rule_config.rb - About 7 hrs to fix

    Method detect_nested_steps has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def detect_nested_steps
          multi_line_step_flag = false
          counter = 1
          @code.each do |line|
            regex = nil
    Severity: Minor
    Found in lib/cuke_sniffer/step_definition.rb - About 3 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

    Class CLI has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class CLI
        include CukeSniffer::Constants
        include CukeSniffer::RuleConfig
        include ROXML
    
    
    Severity: Minor
    Found in lib/cuke_sniffer/cli.rb - About 3 hrs to fix

      Method split_feature has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def split_feature(file_name, feature_lines)
            index = 0
            until index >= feature_lines.length or feature_lines[index].match /Feature:\s*(?<name>.*)/
              update_tag_list(feature_lines[index])
              index += 1
      Severity: Minor
      Found in lib/cuke_sniffer/feature.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 detect_nested_steps has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def detect_nested_steps
            multi_line_step_flag = false
            counter = 1
            @code.each do |line|
              regex = nil
      Severity: Minor
      Found in lib/cuke_sniffer/step_definition.rb - About 1 hr to fix

        Method output_junit_xml has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.output_junit_xml(cuke_sniffer, file_name = DEFAULT_OUTPUT_FILE_NAME)
              file_name = file_name + ".xml" unless file_name =~ /\.xml$/
              results = {}
              failures = 0
              suits={}
        Severity: Minor
        Found in lib/cuke_sniffer/formatter.rb - About 1 hr to fix

          Method output_junit_xml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.output_junit_xml(cuke_sniffer, file_name = DEFAULT_OUTPUT_FILE_NAME)
                file_name = file_name + ".xml" unless file_name =~ /\.xml$/
                results = {}
                failures = 0
                suits={}
          Severity: Minor
          Found in lib/cuke_sniffer/formatter.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

          Function changeRuleStatus has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                  changeRuleStatus: function(){
                      $(document).on("click", ".rule input[type='checkbox']", function(){
                          var enabled = $(this).is(":checked"),
                              $rule = $(this).closest(".rule"),
                              phrase = $rule.find("[data-phrase]").html(),
          Severity: Minor
          Found in lib/cuke_sniffer/js/cuke_sniffer.js - 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 split_feature has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def split_feature(file_name, feature_lines)
                index = 0
                until index >= feature_lines.length or feature_lines[index].match /Feature:\s*(?<name>.*)/
                  update_tag_list(feature_lines[index])
                  index += 1
          Severity: Minor
          Found in lib/cuke_sniffer/feature.rb - About 1 hr to fix

            Function changeRuleStatus has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    changeRuleStatus: function(){
                        $(document).on("click", ".rule input[type='checkbox']", function(){
                            var enabled = $(this).is(":checked"),
                                $rule = $(this).closest(".rule"),
                                phrase = $rule.find("[data-phrase]").html(),
            Severity: Minor
            Found in lib/cuke_sniffer/js/cuke_sniffer.js - About 1 hr to fix

              Method judge_object has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def judge_object(object, type)
                    @rules.each do |rule|
                      fail "No targets for rule: #{rule.phrase}" if rule.targets.nil? or rule.targets.empty?
                      next unless rule.targets.include? type and rule.enabled
                      if rule.reason.(object, rule) == true
              Severity: Minor
              Found in lib/cuke_sniffer/rules_evaluator.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 build_object_for_extension_from_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_object_for_extension_from_file(file_name, regex, cuke_sniffer_class)
                    file_lines = IO.readlines(file_name)
              
                    counter = 0
                    code = []
              Severity: Minor
              Found in lib/cuke_sniffer/cli.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 assess_rule_target_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.assess_rule_target_list(rule_target_list, type)
                    assessment_hash = initialize_assessment_hash(rule_target_list, type)
                    rule_target_list.each do |rule_target|
                      score = rule_target.score
                      assessment_hash[:total_score] += score
              Severity: Minor
              Found in lib/cuke_sniffer/summary_helper.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 extract_inline_tables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def extract_inline_tables(scenario_body)
                    index = 0
                    while index < scenario_body.size
                      if scenario_body[index] =~ /^\|.*\|/
                        start_index = index
              Severity: Minor
              Found in lib/cuke_sniffer/scenario.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 extract_steps_from_features has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.extract_steps_from_features(features)
                    steps = {}
                    features.each do |feature|
                      steps.merge! extract_scenario_steps(feature.background) unless feature.background.nil?
                      feature.scenarios.each do |scenario|
              Severity: Minor
              Found in lib/cuke_sniffer/cuke_sniffer_helper.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 catalog_possible_dead_steps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.catalog_possible_dead_steps(step_definitions, steps_with_expressions)
                    step_definitions.each do |step_definition|
                      next unless step_definition.calls.empty?
                      regex_as_string = step_definition.regex.to_s.gsub(/\(\?-mix:\^?/, "").gsub(/\$\)$/, "")
                      steps_with_expressions.each do |step_location, step_value|
              Severity: Minor
              Found in lib/cuke_sniffer/cuke_sniffer_helper.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 define_ranges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def define_ranges(scenario)
                    ranges = {}
                    index = 0
                    index += 1 until index >= scenario.length or scenario[index] =~ SCENARIO_TITLE_STYLES
                    ranges[:tags] = scenario[0...index]
              Severity: Minor
              Found in lib/cuke_sniffer/scenario.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 get_step_order has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_step_order
                    order = []
                    @steps.each do |line|
                      next if is_comment?(line)
                      match = line.match(STEP_REGEX)
              Severity: Minor
              Found in lib/cuke_sniffer/scenario.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