hackedteam/rcs-db

View on GitHub
lib/rcs-db/build.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method patch has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def patch(params)
    # skip the phase if not needed
    return if params.nil? or params[:core].nil?

    trace :debug, "Build: patching [#{params[:core]}] file"
Severity: Major
Found in lib/rcs-db/build.rb - About 2 hrs to fix

    Class Build has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Build
      include RCS::Tracer
    
      attr_reader :outputs
      attr_reader :scrambled
    Severity: Minor
    Found in lib/rcs-db/build.rb - About 2 hrs to fix

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

        def patch(params)
          # skip the phase if not needed
          return if params.nil? or params[:core].nil?
      
          trace :debug, "Build: patching [#{params[:core]}] file"
      Severity: Minor
      Found in lib/rcs-db/build.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 unpack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def unpack
          trace :debug, "Build: unpack: #{@core_filepath}"
      
          Zip::File.open(@core_filepath) do |z|
            z.each do |f|
      Severity: Minor
      Found in lib/rcs-db/build.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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def load(params)
          raise "Some cores were not loaded in the DB. Please check them." unless RCS::DB::Core.all_loaded?
      
          core = ::Core.where({name: @platform}).first
          raise "Core for #{@platform} not found" if core.nil?
      Severity: Minor
      Found in lib/rcs-db/build.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

      There are no issues that match your filters.

      Category
      Status