Myoldmopar/decent_ci

View on GitHub
lib/resultsprocessor.rb

Summary

Maintainability
F
4 days
Test Coverage

Method process_ctest_results has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

  def process_ctest_results(src_dir, build_dir, test_dir)
    unless File.directory?(test_dir)
      $logger.error("Error: test_dir #{test_dir} does not exist, cannot parse test results")
      return nil, []
    end
Severity: Minor
Found in lib/resultsprocessor.rb - About 1 day 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 process_cmake_results has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

  def process_cmake_results(src_dir, build_dir, stderr, cmake_exit_code, is_package)
    results = []

    file = nil
    line = nil
Severity: Minor
Found in lib/resultsprocessor.rb - About 7 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

File resultsprocessor.rb has 341 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'active_support/all'
require 'find'

require_relative 'codemessage'
require_relative 'testresult'
Severity: Minor
Found in lib/resultsprocessor.rb - About 4 hrs to fix

    Method process_ctest_results has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def process_ctest_results(src_dir, build_dir, test_dir)
        unless File.directory?(test_dir)
          $logger.error("Error: test_dir #{test_dir} does not exist, cannot parse test results")
          return nil, []
        end
    Severity: Major
    Found in lib/resultsprocessor.rb - About 3 hrs to fix

      Method parse_msvc_line has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse_msvc_line(src_dir, build_dir, line)
          return nil if line.nil?
      
          /(?<filename>.+)\((?<line_number>[0-9]+)\): (?<message_type>.+?) (?<message_code>\S+): (?<message>.*) \[.*\]?/ =~ line
          pattern_found = !filename.nil? && !message_type.nil?
      Severity: Minor
      Found in lib/resultsprocessor.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 process_cmake_results has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def process_cmake_results(src_dir, build_dir, stderr, cmake_exit_code, is_package)
          results = []
      
          file = nil
          line = nil
      Severity: Major
      Found in lib/resultsprocessor.rb - About 2 hrs to fix

        Method process_lcov_results has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def process_lcov_results(out)
            # Overall coverage rate:
            #  lines......: 67.9% (173188 of 255018 lines)
            #  functions..: 83.8% (6228 of 7433 functions)
        
        
        Severity: Minor
        Found in lib/resultsprocessor.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 parse_msvc_line has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def parse_msvc_line(src_dir, build_dir, line)
            return nil if line.nil?
        
            /(?<filename>.+)\((?<line_number>[0-9]+)\): (?<message_type>.+?) (?<message_code>\S+): (?<message>.*) \[.*\]?/ =~ line
            pattern_found = !filename.nil? && !message_type.nil?
        Severity: Minor
        Found in lib/resultsprocessor.rb - About 1 hr to fix

          Method process_gcc_results has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def process_gcc_results(src_path, build_path, stderr, gcc_exit_code)
              results = []
              linker_msg = nil
          
              stderr.encode('UTF-8', :invalid => :replace).split("\n").each do |line|
          Severity: Minor
          Found in lib/resultsprocessor.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 parse_gcc_line has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def parse_gcc_line(src_path, build_path, line)
              # 'Something.cc:32:4: multiple definition of variable'
              /(?<filename>.*):(?<line_number>[0-9]+):(?<column_number>[0-9]+): (?<message_type>.+?): (?<message>.*)/ =~ line
              pattern_found = !filename.nil? && !message_type.nil?
              message_is_error = !(%w[info note].include? message_type)
          Severity: Minor
          Found in lib/resultsprocessor.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 process_cmake_results has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def process_cmake_results(src_dir, build_dir, stderr, cmake_exit_code, is_package)
          Severity: Minor
          Found in lib/resultsprocessor.rb - About 35 mins to fix

            Method process_python_results has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def process_python_results(src_dir, build_dir, stdout, stderr, python_exit_code)
            Severity: Minor
            Found in lib/resultsprocessor.rb - About 35 mins to fix

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

                def parse_error_messages(src_dir, build_dir, output)
                  results = []
                  output.encode('UTF-8', :invalid => :replace).split("\n").each do |l|
                    msg = parse_gcc_line(src_dir, build_dir, l)
                    msg = parse_msvc_line(src_dir, build_dir, l) if msg.nil?
              Severity: Minor
              Found in lib/resultsprocessor.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 process_python_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def process_python_results(src_dir, build_dir, stdout, stderr, python_exit_code)
                  results = []
                  stdout.encode('UTF-8', :invalid => :replace).split("\n").each do |err|
                    msg = parse_python_or_latex_line(src_dir, build_dir, err)
                    results << msg unless msg.nil?
              Severity: Minor
              Found in lib/resultsprocessor.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 relative_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def relative_path(path, src_dir, build_dir)
                  Pathname.new("#{src_dir}/#{path}").realpath.relative_path_from(Pathname.new(this_src_dir).realdirpath)
                rescue
                  begin
                    Pathname.new("#{build_dir}/#{path}").realpath.relative_path_from(Pathname.new(this_src_dir).realdirpath)
              Severity: Minor
              Found in lib/resultsprocessor.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 parse_python_or_latex_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Wontfix

                def parse_python_or_latex_line(src_dir, build_dir, line)
                  line_number = nil
                  # Since we are just doing line-by-line parsing, it really limits what we can get, but we'll try our best anyway
                  if line.include? 'LaTeX Error'
                    # ! LaTeX Error: Environment itemize undefined.
              Severity: Minor
              Found in lib/resultsprocessor.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

              There are no issues that match your filters.

              Category
              Status