sshaw/itunes_store_transporter_web

View on GitHub
models/transporter_job.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class TransporterJob has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

class TransporterJob < ActiveRecord::Base
  include ITunes::Store::Transporter::Web

  STATES = [:queued, :running, :success, :failure]
  STATES.each do |s|
Severity: Minor
Found in models/transporter_job.rb - About 3 hrs to fix

    Method to_bool has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def to_bool(val)
        case val
          when String
        val == "true" || val == "1" ? true : false
          when Fixnum
    Severity: Minor
    Found in models/transporter_job.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 as_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def as_json(options = nil)
        return super if options
    
        json = super(:except => [:job_id, :target, :output_log_file])
        if json["options"]
    Severity: Minor
    Found in models/transporter_job.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