MiniDigger/Hangar

View on GitHub

Showing 229 of 518 total issues

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

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

      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;

                    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.');
                      }
                    
                    

                      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

                            File versionList.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            //=====> EXTERNAL CONSTANTS
                            
                            var PLUGIN_ID = null;
                            var VERSIONS_PER_PAGE = 10;
                            var PROJECT_OWNER = null;
                            Severity: Minor
                            Found in ore/public/javascripts/versionList.js - About 2 hrs to fix

                              Function diff_halfMatch_ has 63 lines of code (exceeds 25 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;
                                }

                                Method rawApply has 20 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                      id: Option[DbRef[LoggedActionViewModel[Ctx]]],
                                      createdAt: Option[Instant],
                                      userId: DbRef[User],
                                      address: InetString,
                                      action: LoggedAction[Ctx],
                                Severity: Major
                                Found in models/src/main/scala/ore/db/impl/schema/LoggedActionViewTable.scala - About 2 hrs to fix

                                  Function projectSelectFrag has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    ): Fragment = {
                                      val userActionsTaken = currentUserId.fold(fr"FALSE, FALSE,") { id =>
                                        fr"""|EXISTS(SELECT * FROM project_stars s WHERE s.project_id = p.id AND s.user_id = $id)    AS user_stared,
                                             |EXISTS(SELECT * FROM project_watchers s WHERE s.project_id = p.id AND s.user_id = $id) AS user_watching,""".stripMargin
                                      }
                                  Severity: Major
                                  Found in apiV2/app/db/impl/query/APIV2Queries.scala - About 2 hrs to fix

                                    Function diff_fromDelta has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
                                      var diffs = [];
                                      var diffsLength = 0;  // Keeping our own length var is faster in JS.
                                      var pointer = 0;  // Cursor in text1
                                      var tokens = delta.split(/\t/g);

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language