otwcode/otwarchive

View on GitHub

Showing 1,204 of 1,204 total issues

Class Collection has 52 methods (exceeds 20 allowed). Consider refactoring.
Open

class Collection < ApplicationRecord
  include Filterable
  include WorksOwner

  has_attached_file :icon,
Severity: Major
Found in app/models/collection.rb - About 7 hrs to fix

    Class CommentsController has 51 methods (exceeds 20 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 7 hrs to fix

      Method mass_update has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
      Open

        def mass_update
          params[:page] = '1' if params[:page].blank?
          params[:sort_column] = 'name' unless valid_sort_column(params[:sort_column], 'tag')
          params[:sort_direction] = 'ASC' unless valid_sort_direction(params[:sort_direction])
          options = { show: params[:show], page: params[:page], sort_column: params[:sort_column], sort_direction: params[:sort_direction], status: params[:status] }
      Severity: Minor
      Found in app/controllers/tags_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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if (nodeName === "input") {
                  target.disabled = true;
                  inst.trigger.filter("button").
                      each(function() { this.disabled = true; }).end().
                      filter("img").css({opacity: "0.5", cursor: "default"});
      Severity: Major
      Found in public/javascripts/jquery-ui.js and 1 other location - About 7 hrs to fix
      public/javascripts/jquery-ui.js on lines 3395..3405

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if (nodeName === "input") {
                  target.disabled = false;
                  inst.trigger.filter("button").
                      each(function() { this.disabled = false; }).end().
                      filter("img").css({opacity: "1.0", cursor: ""});
      Severity: Major
      Found in public/javascripts/jquery-ui.js and 1 other location - About 7 hrs to fix
      public/javascripts/jquery-ui.js on lines 3423..3433

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          _out: function(event) {
      
              var draggable = $.ui.ddmanager.current;
      
              // Bail if draggable and droppable are same element
      Severity: Major
      Found in public/javascripts/jquery-ui.js and 1 other location - About 7 hrs to fix
      public/javascripts/jquery-ui.js on lines 6835..6851

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 175.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Class ApplicationController has 50 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class ApplicationController < ActionController::Base
        include Pundit::Authorization
        protect_from_forgery with: :exception, prepend: true
        rescue_from ActionController::InvalidAuthenticityToken, with: :display_auth_error
      
      
      Severity: Minor
      Found in app/controllers/application_controller.rb - About 7 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            _over: function(event) {
        
                var draggable = $.ui.ddmanager.current;
        
                // Bail if draggable and droppable are same element
        Severity: Major
        Found in public/javascripts/jquery-ui.js and 1 other location - About 7 hrs to fix
        public/javascripts/jquery-ui.js on lines 6853..6869

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 175.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        File application_helper.rb has 457 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ApplicationHelper
          include HtmlCleaner
        
          # TODO: Official recommendation from Rails indicates we should switch to
          # unobtrusive JavaScript instead of using anything like `link_to_function`
        Severity: Minor
        Found in app/helpers/application_helper.rb - About 7 hrs to fix

          Class Skin has 49 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Skin < ApplicationRecord
            include HtmlCleaner
            include CssCleaner
            include SkinCacheHelper
            include SkinWizard
          Severity: Minor
          Found in app/models/skin.rb - About 6 hrs to fix

            Function _generateHTML has 169 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _generateHTML: function(inst) {
                    var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
                        controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
                        monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
                        selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
            Severity: Major
            Found in public/javascripts/jquery-ui.js - About 6 hrs to fix

              Method index has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  if @bookmarkable
                    access_denied unless is_admin? || @bookmarkable.visible?
                    @bookmarks = @bookmarkable.bookmarks.is_public.order_by_created_at.paginate(page: params[:page], per_page: ArchiveConfig.ITEMS_PER_PAGE)
                  else
              Severity: Minor
              Found in app/controllers/bookmarks_controller.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

              Class Comment has 47 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Comment < ApplicationRecord
                include HtmlCleaner
                include AfterCommitEverywhere
              
                belongs_to :pseud
              Severity: Minor
              Found in app/models/comment.rb - About 6 hrs to fix

                Class WorkQuery has 47 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class WorkQuery < Query
                  include TaggableQuery
                
                  def klass
                    'Work'
                Severity: Minor
                Found in app/models/search/work_query.rb - About 6 hrs to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
                                      this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
                                  } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
                                      this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
                                  }
                  Severity: Major
                  Found in public/javascripts/jquery-ui.js and 1 other location - About 6 hrs to fix
                  public/javascripts/jquery-ui.js on lines 12211..12215

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 165.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                                  if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
                                      this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
                                  } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
                                      this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
                                  }
                  Severity: Major
                  Found in public/javascripts/jquery-ui.js and 1 other location - About 6 hrs to fix
                  public/javascripts/jquery-ui.js on lines 12217..12221

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 165.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  File user.rb has 437 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        _getRelativeOffset: function() {
                    
                            if(this.cssPosition === "relative") {
                                var p = this.currentItem.position();
                                return {
                    Severity: Major
                    Found in public/javascripts/jquery-ui.js and 1 other location - About 6 hrs to fix
                    public/javascripts/jquery-ui.js on lines 6163..6175

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 163.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        _getRelativeOffset: function() {
                    
                            if(this.cssPosition === "relative") {
                                var p = this.element.position();
                                return {
                    Severity: Major
                    Found in public/javascripts/jquery-ui.js and 1 other location - About 6 hrs to fix
                    public/javascripts/jquery-ui.js on lines 12857..12869

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 163.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                    case 39: if (event.ctrlKey || event.metaKey) {
                                                $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
                                            }
                                            handled = event.ctrlKey || event.metaKey;
                                            // +1 day on ctrl or command +right
                    Severity: Major
                    Found in public/javascripts/jquery-ui.js and 1 other location - About 6 hrs to fix
                    public/javascripts/jquery-ui.js on lines 3616..3627

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 160.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language