MiniDigger/Hangar

View on GitHub

Showing 518 of 518 total issues

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.alert')

Severity: Major
Found in ore/public/bootstrap/js/bootstrap.js and 1 other location - About 3 hrs to fix
ore/public/bootstrap/js/bootstrap.js on lines 618..626

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

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_bisect_ has 87 lines of code (exceeds 25 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);

    Function * has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      override def * = {
        val applyFunc: (
            (
                Option[DbRef[User]],
                Option[Instant],
    Severity: Major
    Found in models/src/main/scala/ore/db/impl/schema/UserTable.scala - About 3 hrs to fix

      Function diff_cleanupSemantic has 83 lines of code (exceeds 25 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} */

        Function diff_cleanupSemanticLossless has 83 lines of code (exceeds 25 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).

          Function patch_make has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {
            var text1, diffs;
            if (typeof a == 'string' && typeof opt_b == 'string' &&
                typeof opt_c == 'undefined') {
              // Method 1: text1, text2

            Function patch_apply has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function patch_splitMax has 76 lines of code (exceeds 25 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;

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

                    if (m[2] === '') {
                      patch.start1--;
                      patch.length1 = 1;
                    } else if (m[2] == '0') {
                      patch.length1 = 0;
                ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js on lines 2118..2126

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

                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 (m[4] === '') {
                      patch.start2--;
                      patch.length2 = 1;
                    } else if (m[4] == '0') {
                      patch.length2 = 0;
                ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js on lines 2107..2115

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

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

                diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {
                  if (this.Diff_Timeout <= 0) {
                    // Don't risk returning a non-optimal diff if we have unlimited time.
                    return null;
                  }

                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 match_bitap_ has 72 lines of code (exceeds 25 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.');
                  }
                
                

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

                  package ore.models.user
                  
                  import scala.language.{higherKinds, implicitConversions}
                  
                  import ore.db.access.ModelView
                  Severity: Major
                  Found in models/src/main/scala/ore/models/user/UserOwned.scala and 1 other location - About 2 hrs to fix
                  models/src/main/scala/ore/models/project/ProjectOwned.scala on lines 1..28

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

                  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

                  package ore.models.project
                  
                  import scala.language.{higherKinds, implicitConversions}
                  
                  import ore.db.access.ModelView
                  Severity: Major
                  Found in models/src/main/scala/ore/models/project/ProjectOwned.scala and 1 other location - About 2 hrs to fix
                  models/src/main/scala/ore/models/user/UserOwned.scala on lines 1..26

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

                  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.length2 === 0) {
                      coords2 = this.start2 + ',0';
                    } else if (this.length2 == 1) {
                      coords2 = this.start2 + 1;
                    } else {
                  ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js on lines 2188..2194

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

                  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.length1 === 0) {
                      coords1 = this.start1 + ',0';
                    } else if (this.length1 == 1) {
                      coords1 = this.start1 + 1;
                    } else {
                  ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js on lines 2195..2201

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

                  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 showDownloadConfirm has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    ): Action[AnyContent] = {
                      ProjectAction(author, slug).asyncEitherT { implicit request =>
                        val dlType              = downloadType.flatMap(DownloadType.withValueOpt).getOrElse(DownloadType.UploadedFile)
                        implicit val lang: Lang = request.lang
                        val project             = request.project
                  Severity: Major
                  Found in ore/app/controllers/project/Versions.scala - About 2 hrs to fix

                    Function publish has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def publish(author: String, slug: String, versionString: String): Action[AnyContent] = {
                        UserLock(ShowProject(author, slug)).asyncF { implicit request =>
                          // First get the pending Version
                          this.factory.getPendingVersion(author, slug, versionString) match {
                            case None =>
                    Severity: Major
                    Found in ore/app/controllers/project/Versions.scala - About 2 hrs to fix

                      Constructor has 22 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          createdAt: LocalDateTime,
                          pluginId: String,
                          name: String,
                          namespace: ProjectNamespace,
                          recommendedVersion: Option[String],
                      Severity: Major
                      Found in apiV2/app/models/querymodels/apiV2QueryModels.scala - About 2 hrs to fix

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

                            memberList.find('.user-changed').each(function(i) {
                                $(this).find('input').attr('name', 'userUps[' + i + ']');
                                $(this).find('select').attr('name', 'roleUps[' + i + ']');
                            });
                        Severity: Major
                        Found in ore/public/javascripts/memberList.js and 1 other location - About 2 hrs to fix
                        ore/public/javascripts/memberList.js on lines 5..8

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

                        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