Myoldmopar/decent_ci

View on GitHub
lib/potentialbuild.rb

Summary

Maintainability
F
1 wk
Test Coverage

Method post_results has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
Open

  def post_results(compiler, pending)
    @dateprefix = DateTime.now.utc.strftime('%F') if @dateprefix.nil?

    test_results_data = []

Severity: Minor
Found in lib/potentialbuild.rb - About 2 days 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 potentialbuild.rb has 798 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'octokit'
require 'json'
require 'open3'
require 'pathname'
require 'active_support/core_ext/hash'
Severity: Major
Found in lib/potentialbuild.rb - About 1 day to fix

    Method post_results has 334 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def post_results(compiler, pending)
        @dateprefix = DateTime.now.utc.strftime('%F') if @dateprefix.nil?
    
        test_results_data = []
    
    
    Severity: Major
    Found in lib/potentialbuild.rb - About 1 day to fix

      Method parse_callgrind has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse_callgrind(build_dir, file)
          object_files = {}
          source_files = {}
          functions = {}
          props = {}
      Severity: Minor
      Found in lib/potentialbuild.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

      Class PotentialBuild has 37 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class PotentialBuild
        include CMake
        include Configuration
        include ResultsProcessor
        include Lcov
      Severity: Minor
      Found in lib/potentialbuild.rb - About 4 hrs to fix

        Method parse_callgrind has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def parse_callgrind(build_dir, file)
            object_files = {}
            source_files = {}
            functions = {}
            props = {}
        Severity: Major
        Found in lib/potentialbuild.rb - About 3 hrs to fix

          Method initialize has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def initialize(client, token, repository, tag_name, commit_sha, branch_name, author, release_url, release_assets, # rubocop:disable Metrics/ParameterLists
                           pull_id, pr_base_repository, pr_base_ref)
              @client = client
              @config = load_configuration(repository, (tag_name.nil? ? commit_sha : tag_name), !release_url.nil?)
              @config.repository_name = github_query(@client) { @client.repo(repository).name }
          Severity: Minor
          Found in lib/potentialbuild.rb - About 1 hr to fix

            Method initialize has 12 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def initialize(client, token, repository, tag_name, commit_sha, branch_name, author, release_url, release_assets, # rubocop:disable Metrics/ParameterLists
                             pull_id, pr_base_repository, pr_base_ref)
            Severity: Major
            Found in lib/potentialbuild.rb - About 1 hr to fix

              Method try_to_repost_asset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Wontfix

                def try_to_repost_asset(response, asset_name)
                  asset_url = nil
              
                  if !response.nil? && response.state == 'new'
                    $logger.error("Error uploading asset #{response.url}")
              Severity: Minor
              Found in lib/potentialbuild.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 get_short_form has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_short_form(str)
                  return nil if str.nil?
              
                  if str.length <= 10 && str =~ /[a-zA-Z]/
                    str
              Severity: Minor
              Found in lib/potentialbuild.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(client, token, repository, tag_name, commit_sha, branch_name, author, release_url, release_assets, # rubocop:disable Metrics/ParameterLists
                               pull_id, pr_base_repository, pr_base_ref)
                  @client = client
                  @config = load_configuration(repository, (tag_name.nil? ? commit_sha : tag_name), !release_url.nil?)
                  @config.repository_name = github_query(@client) { @client.repo(repository).name }
              Severity: Minor
              Found in lib/potentialbuild.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