MiniDigger/Hangar

View on GitHub

Showing 518 of 518 total issues

File bootstrap.js has 1595 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Bootstrap v3.3.5 (http://getbootstrap.com)
 * Copyright 2011-2016 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */
Severity: Major
Found in ore/public/bootstrap/js/bootstrap.js - About 4 days to fix

    File diff_match_patch_uncompressed.js has 1457 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Diff Match and Patch
     * Copyright 2018 The diff-match-patch Authors.
     * https://github.com/google/diff-match-patch
     *

      File Versions.scala has 708 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      package controllers.project
      
      import java.nio.file.Files._
      import java.nio.file.{Files, StandardCopyOption}
      import java.time.Instant
      Severity: Major
      Found in ore/app/controllers/project/Versions.scala - About 1 day to fix

        File ApiV2Controller.scala has 635 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package controllers.apiv2
        
        import scala.language.higherKinds
        
        import java.nio.file.Path
        Severity: Major
        Found in apiV2/app/controllers/apiv2/ApiV2Controller.scala - About 1 day to fix

          Function loadVersions has 221 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function loadVersions(increment, scrollTop) {
              var versionList = $('.version-table');
          
              var offset = (page + increment - 1) * VERSIONS_PER_PAGE;
              var url = 'projects/' + PLUGIN_ID + '/versions' + '?offset=' + offset;
          Severity: Major
          Found in ore/public/javascripts/versionList.js - About 1 day to fix

            Function patch_apply has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            diff_match_patch.prototype.patch_apply = function(patches, text) {
              if (patches.length == 0) {
                return [text, []];
              }
            
            

            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 diff_bisect_ has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
            Open

            diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
              // Cache the text lengths to prevent multiple calls.
              var text1_length = text1.length;
              var text2_length = text2.length;
              var max_d = Math.ceil((text1_length + text2_length) / 2);

            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 Projects.scala has 499 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            package controllers.project
            
            import java.nio.file.{Files, Path}
            import java.security.MessageDigest
            import java.util.Base64
            Severity: Minor
            Found in ore/app/controllers/project/Projects.scala - About 1 day to fix

              Function diff_cleanupMerge has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
                // Add a dummy entry at the end.
                diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ''));
                var pointer = 0;
                var count_delete = 0;

              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 patch_splitMax has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.patch_splitMax = function(patches) {
                var patch_size = this.Match_MaxBits;
                for (var x = 0; x < patches.length; x++) {
                  if (patches[x].length1 <= patch_size) {
                    continue;

              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

                implicit def versionIsHideable[F[_], G[_]](
                    implicit service: ModelService[F],
                    F: Monad[F],
                    par: Parallel[F, G]
                ): Hideable.Aux[F, Version, VersionVisibilityChange, VersionVisibilityChangeTable] = new Hideable[F, Version] {
              Severity: Major
              Found in models/src/main/scala/ore/models/project/Version.scala and 1 other location - About 6 hrs to fix
              models/src/main/scala/ore/models/project/Project.scala on lines 131..188

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

              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

                implicit def projectHideable[F[_], G[_]](
                    implicit service: ModelService[F],
                    F: Monad[F],
                    parallel: Parallel[F, G]
                ): Hideable.Aux[F, Project, ProjectVisibilityChange, ProjectVisibilityChangeTable] = new Hideable[F, Project] {
              Severity: Major
              Found in models/src/main/scala/ore/models/project/Project.scala and 1 other location - About 6 hrs to fix
              models/src/main/scala/ore/models/project/Version.scala on lines 126..175

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

              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

              Function diff_cleanupSemanticLossless has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
                /**
                 * Given two strings, compute a score representing whether the internal
                 * boundary falls on logical boundaries.
                 * Scores range from 6 (best) to 0 (worst).

              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

                  $('.btn-review-approve').click(function() {
                      toggleSpinner($(this).find('[data-fa-i2svg]').toggleClass('fa-thumbs-up'));
                      $.ajax({
                          type: 'post',
                          url: '/' + versionPath + '/reviews/approve',
              Severity: Major
              Found in ore/public/javascripts/review.js and 1 other location - About 5 hrs to fix
              ore/public/javascripts/review.js on lines 68..83

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

              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

                  $('.btn-review-approve-partial').click(function() {
                      toggleSpinner($(this).find('[data-fa-i2svg]').toggleClass('fa-thumbs-up'));
                      $.ajax({
                          type: 'post',
                          url: '/' + versionPath + '/reviews/approve',
              Severity: Major
              Found in ore/public/javascripts/review.js and 1 other location - About 5 hrs to fix
              ore/public/javascripts/review.js on lines 51..66

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

              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

              Function match_bitap_ has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {
                if (pattern.length > this.Match_MaxBits) {
                  throw new Error('Pattern too long for this browser.');
                }
              
              

              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

                function Plugin(option) {
                  return this.each(function () {
                    var $this   = $(this)
                    var data    = $this.data('bs.popover')
                    var options = typeof option == 'object' && option
              Severity: Major
              Found in ore/public/bootstrap/js/bootstrap.js and 1 other location - About 5 hrs to fix
              ore/public/bootstrap/js/bootstrap.js on lines 1484..1494

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

              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

                function Plugin(option) {
                  return this.each(function () {
                    var $this   = $(this)
                    var data    = $this.data('bs.tooltip')
                    var options = typeof option == 'object' && option
              Severity: Major
              Found in ore/public/bootstrap/js/bootstrap.js and 1 other location - About 5 hrs to fix
              ore/public/bootstrap/js/bootstrap.js on lines 1593..1603

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

              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

              Function diff_cleanupSemantic has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
                var changes = false;
                var equalities = [];  // Stack of indices where equalities are found.
                var equalitiesLength = 0;  // Keeping our own length var is faster in JS.
                /** @type {?string} */

              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

                  $('.btn-review-takeover-submit').click(function() {
                      toggleSpinner($(this).find('[data-fa-i2svg]').toggleClass('fa-clipboard'));
                      $.ajax({
                          type: 'post',
                          url: '/' + versionPath + '/reviews/takeover',
              Severity: Major
              Found in ore/public/javascripts/review.js and 1 other location - About 4 hrs to fix
              ore/public/javascripts/review.js on lines 131..141

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

              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