moebooru/moebooru

View on GitHub

Showing 371 of 8,248 total issues

File prototype.js has 4971 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*  Prototype JavaScript framework, version 1.7
 *  (c) 2005-2010 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
Severity: Major
Found in lib/assets/javascripts/prototype/prototype.js - About 2 wks to fix

    Method format_change has a Cognitive Complexity of 127 (exceeds 5 allowed). Consider refactoring.
    Open

      def format_change(_history, change, options, table_options)
        html = ""
    
        classes = []
        if !table_options[:never_obsolete][change.column_name.to_sym] && change.is_obsolete?
    Severity: Minor
    Found in app/helpers/history_helper.rb - About 2 days 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 effects.js has 1014 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // script.aculo.us effects.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
    
    // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    // Contributors:
    //  Justin Palmer (http://encytemedia.com/)
    Severity: Major
    Found in lib/assets/javascripts/prototype/effects.js - About 2 days to fix

      Method parse_query has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_query(query, options = {})
            q = Hash.new { |h, k| h[k] = [] }
      
            scan_query(query).each do |token|
              if token =~ /^([qse])$/
      Severity: Minor
      Found in app/models/tag/parse_methods.rb - About 1 day 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 generate_sql has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
      Open

          def generate_sql(q, options = {})
            if q.is_a?(Hash)
              original_query = options[:original_query]
            else
              original_query = q
      Severity: Minor
      Found in app/models/post/sql_methods.rb - About 1 day 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 controls.js has 804 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // script.aculo.us controls.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
      
      // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
      //           (c) 2005-2010 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
      //           (c) 2005-2010 Jon Tirsen (http://www.tirsen.com)
      Severity: Major
      Found in lib/assets/javascripts/prototype/controls.js - About 1 day to fix

        File dragdrop.js has 786 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // script.aculo.us dragdrop.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
        
        // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
        //
        // script.aculo.us is freely distributable under the terms of an MIT-style license.
        Severity: Major
        Found in lib/assets/javascripts/prototype/dragdrop.js - About 1 day to fix

          Method commit_tags has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
          Open

            def commit_tags
              return if new_tags.nil?
          
              if old_tags
                # If someone else committed changes to this post before we did,
          Severity: Minor
          Found in app/models/post/tag_methods.rb - About 1 day 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 post_controller.rb has 663 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class PostController < ApplicationController
            layout "default"
            helper :avatar
          
            before_action :member_only, :only => [:create, :destroy, :delete, :flag, :revert_tags, :activate, :update_batch, :vote]
          Severity: Major
          Found in app/controllers/post_controller.rb - About 1 day to fix

            Method similar_images has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
            Open

              def similar_images(options = {})
                errors = {}
            
                local_service = CONFIG["local_image_service"]
            
            
            Severity: Minor
            Found in lib/similar_images.rb - About 1 day 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 generate_sql has 259 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def generate_sql(q, options = {})
                  if q.is_a?(Hash)
                    original_query = options[:original_query]
                  else
                    original_query = q
            Severity: Major
            Found in app/models/post/sql_methods.rb - About 1 day to fix

              Method similar has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
              Open

                def similar
                  @params = params
                  unless params[:file].is_a?(ActionDispatch::Http::UploadedFile) then params.delete(:file) end
                  if params[:url].blank? then params.delete(:url) end
                  if params[:id].blank? then params.delete(:id) end
              Severity: Minor
              Found in app/controllers/post_controller.rb - About 1 day 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 user.rb has 549 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class User < ApplicationRecord
                has_many :user_logs
                has_many :post_votes
                attr_accessor :current_email
              
              
              Severity: Major
              Found in app/models/user.rb - About 1 day to fix

                File unittest.js has 524 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // script.aculo.us unittest.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
                
                // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
                //           (c) 2005-2010 Jon Tirsen (http://www.tirsen.com)
                //           (c) 2005-2010 Michael Schuerig (http://www.schuerig.de/michael/)
                Severity: Major
                Found in lib/assets/javascripts/prototype/unittest.js - About 1 day to fix

                  Function Enumerable has 209 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var Enumerable = (function() {
                    function each(iterator, context) {
                      var index = 0;
                      try {
                        this._each(function(value) {
                  Severity: Major
                  Found in lib/assets/javascripts/prototype/prototype.js - About 1 day to fix

                    Class User has 58 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class User < ApplicationRecord
                      has_many :user_logs
                      has_many :post_votes
                      attr_accessor :current_email
                    
                    
                    Severity: Major
                    Found in app/models/user.rb - About 1 day to fix

                      Method http_get_streaming has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def http_get_streaming(source, options = {}, &_block)
                          max_size = options[:max_size] || CONFIG["max_image_size"]
                          max_size = nil if max_size == 0 # unlimited
                      
                          # Decode data: URLs.
                      Severity: Minor
                      Found in lib/danbooru.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

                      Method similar has 184 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def similar
                          @params = params
                          unless params[:file].is_a?(ActionDispatch::Http::UploadedFile) then params.delete(:file) end
                          if params[:url].blank? then params.delete(:url) end
                          if params[:id].blank? then params.delete(:id) end
                      Severity: Major
                      Found in app/controllers/post_controller.rb - About 7 hrs to fix

                        Method format_change has 179 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def format_change(_history, change, options, table_options)
                            html = ""
                        
                            classes = []
                            if !table_options[:never_obsolete][change.column_name.to_sym] && change.is_obsolete?
                        Severity: Major
                        Found in app/helpers/history_helper.rb - About 7 hrs to fix

                          Method format_changes has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def format_changes(history, options = {})
                              changes = history.history_changes
                          
                              # Group the changes by class and field.
                              change_groups = {}
                          Severity: Minor
                          Found in app/helpers/history_helper.rb - About 6 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

                          Severity
                          Category
                          Status
                          Source
                          Language