otwcode/otwarchive

View on GitHub

Showing 1,205 of 1,205 total issues

Function Callbacks has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

jQuery.Callbacks = function( options ) {

    // Convert options from String-formatted to Object-formatted if needed
    // (we check in cache first)
    options = typeof options === "string" ?
Severity: Major
Found in public/javascripts/jquery.js - About 5 hrs to fix

    File comment.rb has 377 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Consider simplifying this complex logical expression.
      Open

                  if ( event.pageX == null && original.clientX != null ) {
                      eventDoc = event.target.ownerDocument || document;
                      doc = eventDoc.documentElement;
                      body = eventDoc.body;
      
      
      Severity: Critical
      Found in public/javascripts/jquery.js - About 5 hrs to fix

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

          def update
            new_collections = []
            unapproved_collections = []
            errors = []
            bookmark_params[:collection_names]&.split(",")&.map(&:strip)&.uniq&.each do |collection_name|
        Severity: Minor
        Found in app/controllers/bookmarks_controller.rb - About 4 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 show has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

          def show
            @tag_groups = @work.tag_groups
            if params[:view_adult]
              cookies[:view_adult] = "true"
            elsif @work.adult? && !see_adult?
        Severity: Minor
        Found in app/controllers/chapters_controller.rb - About 4 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 delayed_generate has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.delayed_generate(collection_id)
            collection = Collection.find(collection_id)
        
            if collection.challenge.assignments_sent_at.present?
              # If assignments have been sent, we don't want to delete everything and
        Severity: Minor
        Found in app/models/challenge_assignment.rb - About 4 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 show has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

          def show
            # don't bother collecting tags unless the user gets to see them
            if @tag_set.visible || @tag_set.user_is_moderator?(current_user)
        
              # we use this to collect up fandom parents for characters and relationships
        Severity: Minor
        Found in app/controllers/owned_tag_sets_controller.rb - About 4 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 clean_css_code has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

          def clean_css_code(css_code, options = {})
            return "" if !css_code.match(/\w/) # only spaces of various kinds
            clean_css = ""
            parser = CssParser::Parser.new
            parser.add_block!(css_code)
        Severity: Minor
        Found in lib/css_cleaner.rb - About 4 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 challenge_assignment.rb has 360 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class ChallengeAssignment < ApplicationRecord
          # We use "-1" to represent all the requested items matching
          ALL = -1
        
          belongs_to :collection
        Severity: Minor
        Found in app/models/challenge_assignment.rb - About 4 hrs to fix

          File application_controller.rb has 360 lines of code (exceeds 250 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 4 hrs to fix

            Function support has 115 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            jQuery.support = (function() {
            
                var support, all, a, select, opt, input, fragment, eventName, isSupported, i,
                    div = document.createElement("div");
            
            
            Severity: Major
            Found in public/javascripts/jquery.js - About 4 hrs to fix

              Method load_site_css has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.load_site_css
                  Skin.skin_dir_entries(Skin.site_skins_dir, /^\d+\.\d+$/).each do |version|
                    version_dir = "#{Skin.site_skins_dir + version}/"
                    if File.directory?(version_dir)
                      # let's load up the file
              Severity: Minor
              Found in app/models/skin.rb - About 4 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 Pseud has 35 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Pseud < ApplicationRecord
                include Searchable
                include WorksOwner
                include Justifiable
              
              
              Severity: Minor
              Found in app/models/pseud.rb - About 4 hrs to fix

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

                      error: function(xhr, textStatus, errorThrown) {
                        flashContainer.empty();
                        flashContainer.addClass('error notice');
                        try {
                          jQuery.parseJSON(xhr.responseText);
                Severity: Major
                Found in public/javascripts/application.js and 1 other location - About 4 hrs to fix
                public/javascripts/application.js on lines 496..508

                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 125.

                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

                                pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
                Severity: Major
                Found in public/javascripts/jquery-ui.js and 1 other location - About 4 hrs to fix
                public/javascripts/jquery-ui.js on lines 6307..6307

                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 125.

                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

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

                      error: function(xhr, textStatus, errorThrown) {
                        flashContainer.empty();
                        flashContainer.addClass('error notice');
                        try {
                          jQuery.parseJSON(xhr.responseText);
                Severity: Major
                Found in public/javascripts/application.js and 1 other location - About 4 hrs to fix
                public/javascripts/application.js on lines 540..552

                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 125.

                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

                                pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
                Severity: Major
                Found in public/javascripts/jquery-ui.js and 1 other location - About 4 hrs to fix
                public/javascripts/jquery-ui.js on lines 6304..6304

                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 125.

                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

                Method notify_parent_comment_owner has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                    def notify_parent_comment_owner
                      if self.reply_comment? && !self.unreviewed?
                        parent_comment = self.commentable
                        parent_comment_owner = parent_comment.comment_owner # will be nil if not a user, including if an admin
                
                
                Severity: Minor
                Found in app/models/comment.rb - About 4 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 index has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index
                    if params[:user_id] && (@user = User.find_by(login: params[:user_id]))
                      if current_user == @user
                        @challenge_signups = @user.challenge_signups.order_by_date
                        render action: :index and return
                Severity: Minor
                Found in app/controllers/challenge_signups_controller.rb - About 4 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 rails.js has 346 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                (function($, undefined) {
                
                /**
                 * Unobtrusive scripting adapter for jQuery
                 * https://github.com/rails/jquery-ujs
                Severity: Minor
                Found in public/javascripts/rails.js - About 4 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language