sshaw/itunes_store_transporter_web

View on GitHub

Showing 19 of 23 total issues

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 prompt_for_config has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def prompt_for_config
      unless $config[:db_driver]
        puts "Select your database: "
        $supported_drivers.each_with_index { |dep, i| puts "#{i + 1}: #{dep.name}" }
    
    
    Severity: Minor
    Found in install.rb - About 3 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

    Function fileBrowser has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $.fn.fileBrowser = function(o, handler) {
            if( !o ) var o = {};
            if( o.root == undefined ) o.root = '';
            if( o.script == undefined ) o.script = 'browse';
            if( o.title == undefined ) o.title = 'Select a File';
    Severity: Major
    Found in public/javascripts/jqueryFileTree.js - About 3 hrs to fix

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

                def current_search_query(accounts)
                  terms = []
      
                  [:priority, :state, :target, :type].each do |name|
                    next if params[name].blank?
      Severity: Minor
      Found in app/helpers/jobs_helper.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 find has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

        def find(path, options)
          files = []
      
          Dir.foreach(path) do |name|
            next if name =~ %r|\A\.\.?|
      Severity: Minor
      Found in lib/fs_util.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 install has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def install
        puts "Installing..."
      
        db_driver = $config[:db_driver] || $default_driver
        db_config = {
      Severity: Minor
      Found in install.rb - About 1 hr to fix

        Function bindTree has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    var bindTree = function(t) {
                        $(t).find('LI A').bind('click', function() {
                            var count = ($(this).data('clickcount') || 0) + 1;
        
                            if(count == 1) {
        Severity: Minor
        Found in public/javascripts/jqueryFileTree.js - About 1 hr to fix

          Method current_search_query has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def current_search_query(accounts)
                      terms = []
          
                      [:priority, :state, :target, :type].each do |name|
                        next if params[name].blank?
          Severity: Minor
          Found in app/helpers/jobs_helper.rb - About 1 hr to fix

            Method install has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def install
              puts "Installing..."
            
              db_driver = $config[:db_driver] || $default_driver
              db_config = {
            Severity: Minor
            Found in install.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 sort_by has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                      def sort_by(column)
                        current_column, current_dir = params[:order].to_s.split(":")
            
                        dir  = current_dir == "asc" ? "desc" : "asc"
                        link = link_to(column.titleize, current_path(params.merge(:order => "#{column}:#{dir}")))
            Severity: Minor
            Found in app/helpers/jobs_helper.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 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

            Consider simplifying this complex logical expression.
            Open

                  if (element.data('remote') == true) {
                    e.preventDefault(); e.stopped = true;
                    JSAdapter.sendRequest(element, {
                      verb: element.data('method') || element.attr('method') || 'post',
                      url: element.attr('action'),
            Severity: Major
            Found in public/javascripts/jquery-ujs.js - About 40 mins to fix

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

                        def account_options(accounts)
                          options = []
              
                          Array(accounts).sort_by { |u| u.username }.group_by(&:username).each do |_, users|
                            users.each do |u|
              Severity: Minor
              Found in app/helpers/jobs_helper.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 format_option_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                        def format_option_value(name, value)
                          if name == :rate && value.present?
                            number_with_delimiter(value) << " Kbps"
                          elsif name == :password
                            "*" * 8
              Severity: Minor
              Found in app/helpers/jobs_helper.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 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

              Method ls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def ls(path, options = {})
                  roots = options[:root] ? Array(options[:root]) : root_directory
                  return roots if path.to_s.empty?
              
                  # Make sure path starts with one of the roots, checking the longest one first.
              Severity: Minor
              Found in lib/fs_util.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 marshal_dump has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def marshal_dump
                  options = super.dup.except(:account_id, :execute)
              
              
                  if @account
              Severity: Minor
              Found in app/forms/forms.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 check_package has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def check_package
                      if batch == "1" && !package.end_with?(".itmsp")
                        errors[:package] << 'does not contain any ".itmsp" directories' unless contains_packages?(package)
                      elsif !package.end_with?(".itmsp")
                        errors[:package] << 'must end with ".itmsp"'
              Severity: Minor
              Found in lib/options.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 file_browser_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def file_browser_field(name, options = {})
                  prompt = options.delete(:prompt) || "Select #{name.to_s.titleize}"
              
                  value = object.send(name)
                  options[:value] = File.basename(value) if value
              Severity: Minor
              Found in lib/transporter_form_builder.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