mezuro/kalibro_processor

View on GitHub

Showing 6 of 16 total issues

Class RepositoriesController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class RepositoriesController < ApplicationController

  def branches
    scm_type = params[:scm_type]
    begin
Severity: Minor
Found in app/controllers/repositories_controller.rb - About 2 hrs to fix

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

        def self.task(context)
          # Only bother processing Tree metric configurations
          # Do nothing if there are none
          metric_configurations = extract_tree_metric_configurations(context)
          return if metric_configurations.empty?
    Severity: Minor
    Found in lib/processor/aggregator.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 metric_result_history_of has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def metric_result_history_of(module_name, metric_name)
        history = []
        self.processings.each do |processing|
          module_result = processing.module_results.select { |module_result| module_result.kalibro_module.long_name == module_name }.first
          unless module_result.nil?
    Severity: Minor
    Found in app/models/repository.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 task has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.task(context)
          all_module_results = context.processing.root_module_result.pre_order
          all_module_results.each do | module_result_child |
            numerator = 0
            denominator = 0
    Severity: Minor
    Found in lib/processor/interpreter.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.get(address, directory, branch)
          if Dir.exist?(directory) and is_svn?(directory)
            if get_repository_url(directory) != address
              FileUtils.remove_entry_secure(directory, force=true)
              checkout(address, directory)
    Severity: Minor
    Found in lib/downloaders/svn_downloader.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(num_runs: nil, measure_mode: nil, save_reports: true, rand_seed: nil)
          if num_runs.nil?
            num_runs = ENV.key?('PROFILE_NUM_RUNS') ? ENV['PROFILE_NUM_RUNS'].to_i : 1
          end
    
    
    Severity: Minor
    Found in performance/base.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