MiniDigger/Hangar

View on GitHub

Showing 518 of 518 total issues

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

    $('.btn-review-addmessage-submit').click(function() {
        toggleSpinner($(this).find('[data-fa-i2svg]').removeClass('fa-clipboard'));
        $.ajax({
            type: 'post',
            url: '/' + versionPath + '/reviews/addmessage',
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 91..101

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

File Application.scala has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package controllers

import java.sql.Timestamp
import java.time.temporal.ChronoUnit
import java.time.{Instant, LocalDate}
Severity: Minor
Found in ore/app/controllers/Application.scala - About 4 hrs to fix

    File APIV2Queries.scala has 350 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package db.impl.query
    
    import java.sql.Timestamp
    import java.time.LocalDateTime
    
    
    Severity: Minor
    Found in apiV2/app/db/impl/query/APIV2Queries.scala - About 4 hrs to fix

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

                      $.ajax({
                          url: '/api/v2/authenticate',
                          method: 'POST',
                          dataType: 'json'
                      }).done(function (data) {
      Severity: Major
      Found in ore/public/javascripts/apiRequests.js and 1 other location - About 4 hrs to fix
      ore/public/javascripts/apiRequests.js on lines 54..67

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

      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

                      return $.ajax({
                          url: '/api/v2/authenticate/user',
                          method: 'POST',
                          dataType: 'json'
                      }).done(function (data) {
      Severity: Major
      Found in ore/public/javascripts/apiRequests.js and 1 other location - About 4 hrs to fix
      ore/public/javascripts/apiRequests.js on lines 74..87

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

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

      diff_match_patch.prototype.diff_cleanupEfficiency = 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

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

        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.scrollspy')
              var options = typeof option == 'object' && option
        Severity: Major
        Found in ore/public/bootstrap/js/bootstrap.js and 1 other location - About 4 hrs to fix
        ore/public/bootstrap/js/bootstrap.js on lines 1895..1904

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

        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.affix')
              var options = typeof option == 'object' && option
        Severity: Major
        Found in ore/public/bootstrap/js/bootstrap.js and 1 other location - About 4 hrs to fix
        ore/public/bootstrap/js/bootstrap.js on lines 2287..2296

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

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

        package ore.rest
        
        import java.lang.Math._
        import javax.inject.{Inject, Singleton}
        
        
        Severity: Minor
        Found in ore/app/ore/rest/OreRestfulApiV1.scala - About 4 hrs to fix

          Function initBtnEdit has 99 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function initBtnEdit() {
              var btnEdit = $('.btn-edit');
              if (!btnEdit.length) return;
          
              var pageBtns = $('.btn-page');
          Severity: Major
          Found in ore/public/javascripts/projectDetail.js - About 3 hrs to fix

            Function patch_make has a Cognitive Complexity of 26 (exceeds 5 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

            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

            diff_match_patch.prototype.diff_text1 = function(diffs) {
              var text = [];
              for (var x = 0; x < diffs.length; x++) {
                if (diffs[x][0] !== DIFF_INSERT) {
                  text[x] = diffs[x][1];
            ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js on lines 1299..1307

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

            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

            diff_match_patch.prototype.diff_text2 = function(diffs) {
              var text = [];
              for (var x = 0; x < diffs.length; x++) {
                if (diffs[x][0] !== DIFF_DELETE) {
                  text[x] = diffs[x][1];
            ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js on lines 1283..1291

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

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

            diff_match_patch.prototype.patch_fromText = function(textline) {
              var patches = [];
              if (!textline) {
                return patches;
              }

            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

            package ore.models.user.role
            
            import scala.language.higherKinds
            
            import ore.db.impl.DefaultModelCompanion
            models/src/main/scala/ore/models/user/role/OrganizationUserRole.scala on lines 1..47

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

            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.user.role
            
            import scala.language.higherKinds
            
            import ore.db.impl.DefaultModelCompanion
            models/src/main/scala/ore/models/user/role/ProjectUserRole.scala on lines 1..48

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

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

              ): EitherT[F, String, (Model[Project], Model[ProjectSettings])] = {
                import cats.instances.vector._
                logger.debug("Saving project settings")
                logger.debug(this.toString)
                val newOwnerId = this.ownerId.getOrElse(project.ownerId)
            Severity: Major
            Found in ore/app/form/project/ProjectSettingsForm.scala - About 3 hrs to fix

              File Actions.scala has 313 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              package controllers.sugar
              
              import scala.language.higherKinds
              
              import java.time.Instant
              Severity: Minor
              Found in orePlayCommon/app/controllers/sugar/Actions.scala - About 3 hrs to fix

                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.dropdown')
                
                
                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 91..99

                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

                Severity
                Category
                Status
                Source
                Language