otwcode/otwarchive

View on GitHub

Showing 854 of 1,204 total issues

File jquery-ui.js has 11613 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! jQuery UI - v1.10.0 - 2013-01-17
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
* Copyright (c) 2013 jQuery Foundation and other contributors Licensed MIT */

Severity: Major
Found in public/javascripts/jquery-ui.js - About 1 mo to fix

    File jquery.js has 6540 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * jQuery JavaScript Library v1.9.0
     * http://jquery.com/
     *
     * Includes Sizzle.js
    Severity: Major
    Found in public/javascripts/jquery.js - About 2 wks to fix

      Function TokenList has 568 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      $.TokenList = function (input, url_or_data, settings) {
          //
          // Initialization
          //
      
      
      Severity: Major
      Found in public/javascripts/jquery.tokeninput.js - About 2 days to fix

        Class Work has 110 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Work < ApplicationRecord
          include Filterable
          include CreationNotifier
          include Collectible
          include Bookmarkable
        Severity: Major
        Found in app/models/work.rb - About 2 days to fix

          File work.rb has 848 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class Work < ApplicationRecord
            include Filterable
            include CreationNotifier
            include Collectible
            include Bookmarkable
          Severity: Major
          Found in app/models/work.rb - About 2 days to fix

            File tag.rb has 836 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "unicode_utils/casefold"
            
            class Tag < ApplicationRecord
              include Searchable
              include StringCleaner
            Severity: Major
            Found in app/models/tag.rb - About 2 days to fix

              Class Tag has 103 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Tag < ApplicationRecord
                include Searchable
                include StringCleaner
                include WorksOwner
                include Wrangleable
              Severity: Major
              Found in app/models/tag.rb - About 1 day to fix

                File works_controller.rb has 788 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class WorksController < ApplicationController
                  # only registered users and NOT admin should be able to create new works
                  before_action :load_collection
                  before_action :load_owner, only: [:index]
                  before_action :users_only, except: [:index, :show, :navigate, :search, :collected, :edit_tags, :update_tags, :drafts, :share]
                Severity: Major
                Found in app/controllers/works_controller.rb - About 1 day to fix

                  Method update has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      authorize Skin, :index?
                  
                      flash[:notice] = []
                      modified_skin_titles = []
                  Severity: Minor
                  Found in app/controllers/admin/skins_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 jquery.tokeninput.js has 722 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /*
                   * jQuery Plugin: Tokenizing Autocomplete Text Entry
                   * Version 1.4.2
                   *
                   * Copyright (c) 2009 James Smith (http://loopj.com)
                  Severity: Major
                  Found in public/javascripts/jquery.tokeninput.js - About 1 day to fix

                    File story_parser.rb has 705 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class StoryParser
                      require 'timeout'
                      require 'nokogiri'
                      require 'mechanize'
                      require 'open-uri'
                    Severity: Major
                    Found in app/models/story_parser.rb - About 1 day to fix

                      Method autocomplete_lookup has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def autocomplete_lookup(options = {})
                            options.reverse_merge!({search_param: "", autocomplete_prefix: "", sort: "down"})
                            search_param = options[:search_param]
                            autocomplete_prefix = options[:autocomplete_prefix]
                            if REDIS_AUTOCOMPLETE.exists(autocomplete_cache_key(autocomplete_prefix, search_param))
                      Severity: Minor
                      Found in lib/autocomplete_source.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

                      Function ao3modal has 268 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          window.ao3modal = (function($) {
                      
                              var _loading = false,
                                  _bgDiv = $('<div>', {'id': 'modal-bg'}).addClass('modal-closer'),
                                  _loadingDiv = $('<div>').addClass('loading'),
                      Severity: Major
                      Found in public/javascripts/ao3modal.js - About 1 day to fix

                        Function ajax has 237 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            ajax: function( url, options ) {
                        
                                // If url is an object, simulate pre-1.5 signature
                                if ( typeof url === "object" ) {
                                    options = url;
                        Severity: Major
                        Found in public/javascripts/jquery.js - About 1 day to fix

                          File comments_controller.rb has 560 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class CommentsController < ApplicationController
                            skip_before_action :store_location, except: [:show, :index, :new]
                            before_action :load_commentable,
                                          only: [:index, :new, :create, :edit, :update, :show_comments,
                                                 :hide_comments, :add_comment_reply,
                          Severity: Major
                          Found in app/controllers/comments_controller.rb - About 1 day to fix

                            Function setDocument has 232 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            setDocument = Sizzle.setDocument = function( node ) {
                                var doc = node ? node.ownerDocument || node : preferredDoc;
                            
                                // If no document and documentElement is available, return
                                if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
                            Severity: Major
                            Found in public/javascripts/jquery.js - About 1 day to fix

                              File livevalidation_standalone.js has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              // LiveValidation 1.3 (standalone version)
                              // Copyright (c) 2007-2008 Alec Hill (www.livevalidation.com)
                              // LiveValidation is licensed under the terms of the MIT License
                              
                              /*********************************************** LiveValidation class ***********************************/
                              Severity: Minor
                              Found in public/javascripts/livevalidation_standalone.js - About 7 hrs to fix

                                Function _create has 191 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    _create: function() {
                                        // Some browsers only repeat keydown events, not keypress events,
                                        // so we use the suppressKeyPress flag to determine if we've already
                                        // handled the keydown event. #7269
                                        // Unfortunately the code for & in keypress is the same as the up arrow,
                                Severity: Major
                                Found in public/javascripts/jquery-ui.js - About 7 hrs to fix

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

                                  class User < ApplicationRecord
                                    audited redacted: [:encrypted_password, :password_salt]
                                    include WorksOwner
                                    include PasswordResetsLimitable
                                    include UserLoggable
                                  Severity: Major
                                  Found in app/models/user.rb - About 7 hrs to fix

                                    Method create has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      def create
                                        unless params[:collection_names]
                                          flash[:error] = ts("What collections did you want to add?")
                                          redirect_to(request.env["HTTP_REFERER"] || root_path) and return
                                        end
                                    Severity: Minor
                                    Found in app/controllers/collection_items_controller.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language