martsoft/image_thread

View on GitHub

Showing 5 of 5 total issues

Method has_image_thread has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

      def has_image_thread(field, opt = {})
        field_id            = [field, 'id'].join('_')
        before_save_method  = ['append_images', field].join('_')

        # Options
Severity: Minor
Found in lib/image_thread/model_methods.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

File uploader.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//= require image_thread/jquery/ui/jquery.ui.widget
//= require image_thread/load-image
//= require image_thread/jquery/jquery.fileupload
//= require image_thread/jquery/jquery.fileupload-process
//= require image_thread/jquery/jquery.fileupload-image
Severity: Minor
Found in app/assets/javascripts/image_thread/uploader.js - About 3 hrs to fix

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

          def has_image_thread(field, opt = {})
            field_id            = [field, 'id'].join('_')
            before_save_method  = ['append_images', field].join('_')
    
            # Options
    Severity: Major
    Found in lib/image_thread/model_methods.rb - About 2 hrs to fix

      Function fail has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  fail: function (e, data) {
                      if (e.isDefaultPrevented()) {
                          return false;
                      }
                      var that = $(this).data('blueimp-fileupload') ||
      Severity: Minor
      Found in app/assets/javascripts/image_thread/uploader.js - About 1 hr to fix

        Function add has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    add: function (e, data) {
                        if (e.isDefaultPrevented()) {
                            return false;
                        }
        
        
        Severity: Minor
        Found in app/assets/javascripts/image_thread/uploader.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language