MiniDigger/Hangar

View on GitHub

Showing 229 of 518 total issues

File ApiV1Controller.scala has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package controllers

import java.time.Instant
import java.util.{Base64, UUID}
import javax.inject.{Inject, Singleton}
Severity: Minor
Found in ore/app/controllers/ApiV1Controller.scala - About 2 hrs to fix

    File ProjectFactory.scala has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package ore.models.project.factory
    
    import java.nio.file.Files._
    import javax.inject.{Inject, Singleton}
    
    
    Severity: Minor
    Found in orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala - About 2 hrs to fix

      Function patch_fromText has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

            pluginId: String,
            ownerName: String,
            ownerId: DbRef[User],
            name: String,
            slug: String,
        Severity: Major
        Found in models/src/main/scala/ore/models/project/Project.scala - About 2 hrs to fix

          Function diff_linesToChars_ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
            var lineArray = [];  // e.g. lineArray[4] == 'Hello\n'
            var lineHash = {};   // e.g. lineHash['Hello\n'] == 4
          
            // '\x00' is a valid character, but various debuggers don't like it.

          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

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

              userId: DbRef[User],
              address: InetString,
              action: LoggedAction[Ctx],
              actionContext: LoggedActionContext[Ctx],
              actionContextId: DbRef[Ctx],
          Severity: Major
          Found in models/src/main/scala/ore/models/admin/LoggedActionView.scala - About 2 hrs to fix

            File Users.scala has 258 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            package controllers
            
            import javax.inject.{Inject, Singleton}
            
            import play.api.i18n.MessagesApi
            Severity: Minor
            Found in ore/app/controllers/Users.scala - About 2 hrs to fix

              Function show has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                Tooltip.prototype.show = function () {
                  var e = $.Event('show.bs.' + this.type)
              
                  if (this.hasContent() && this.enabled) {
                    this.$element.trigger(e)
              Severity: Major
              Found in ore/public/bootstrap/js/bootstrap.js - About 2 hrs to fix

                Function getHomeProjects has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  ): Query0[ProjectListEntry] = {
                    //TODO: Let the query handle tag search in the future
                    val platformFrag = platformNames.map(_.toLowerCase).toNel.map(Fragments.in(fr"lower(p.tag_name)", _))
                    val categoryFrag = categories.toNel.map(Fragments.in(fr"p.category", _))
                    val visibilityFrag =
                Severity: Major
                Found in ore/app/db/impl/query/AppQueries.scala - About 2 hrs to fix

                  Function create has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      )(implicit mdc: OreMDC): EitherT[F, List[String], Model[Organization]] = {
                        import cats.instances.vector._
                        val logging = F.delay {
                          MDCLogger.debug("Creating Organization...")
                          MDCLogger.debug("Name     : " + name)
                  Severity: Major
                  Found in orePlayCommon/app/db/impl/access/OrganizationBase.scala - About 2 hrs to fix

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

                        projectId: DbRef[Project],
                        versionString: String,
                        dependencyIds: List[String],
                        channelId: DbRef[Channel],
                        fileSize: Long,
                    Severity: Major
                    Found in models/src/main/scala/ore/models/project/Version.scala - About 2 hrs to fix

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

                        Function wrapExternal has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private def wrapExternal(urlString: String) = {
                              try {
                                val uri  = new URI(urlString)
                                val host = uri.getHost
                                if (uri.getScheme != null && host == null) { // scalafix:ok
                        Severity: Minor
                        Found in ore/app/ore/markdown/FlexmarkRenderer.scala - About 2 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

                        Function getData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                          @SuppressWarnings(Array("scalafix:DisableSyntax.null"))
                          override def getData(bufferedReader: BufferedReader): Seq[DataValue] = {
                            val dataValues = new ArrayBuffer[DataValue]
                            try {
                              val info = McModInfo.DEFAULT.read(bufferedReader).asScala
                        Severity: Minor
                        Found in orePlayCommon/app/ore/models/project/io/PluginFileData.scala - About 2 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

                        Function setupInvites has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function setupInvites() {
                        
                            function fadeOutLoading(loading, after) {
                                loading.fadeOut('fast', after);
                            }
                        Severity: Major
                        Found in ore/public/javascripts/notifications.js - About 2 hrs to fix

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

                              categoryName: String,
                              homepage: String,
                              issues: String,
                              source: String,
                              support: String,
                          Severity: Major
                          Found in ore/app/form/project/ProjectSettingsForm.scala - About 2 hrs to fix

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

                              ): F[ProjectData] = {
                                val flagsWithNames = project
                                  .flags(ModelView.later(Flag))
                                  .query
                                  .join(TableQuery[UserTable])
                            Severity: Minor
                            Found in orePlayCommon/app/models/viewhelper/ProjectData.scala - About 1 hr to fix

                              Function saveTo has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                ): F[Unit] = {
                                  import cats.instances.list._
                                  import cats.instances.option._
                                  import cats.instances.vector._
                              
                              
                              Severity: Minor
                              Found in ore/app/form/organization/OrganizationMembersUpdate.scala - About 1 hr to fix

                                Function sendJar has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  ): IO[Result] = {
                                    if (project.visibility == Visibility.SoftDelete) {
                                      IO.pure(NotFound)
                                    } else {
                                      checkConfirmation(version, token).flatMap { passed =>
                                Severity: Minor
                                Found in ore/app/controllers/project/Versions.scala - About 1 hr to fix

                                  Function getApiSession has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function getApiSession() {
                                      return new Promise(function (resolve, reject) {
                                          let session;
                                          const date = new Date();
                                          date.setTime(date.getTime() + 60000);
                                  Severity: Minor
                                  Found in ore/public/javascripts/apiRequests.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language