MiniDigger/Hangar

View on GitHub

Showing 518 of 518 total issues

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

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

                        user
                          .projectRoles(ModelView.now(ProjectUserRole))
                          .get(id)
                          .semiflatMap { role =>
                            import MembershipDossier._
                  Severity: Major
                  Found in ore/app/controllers/project/Projects.scala and 1 other location - About 2 hrs to fix
                  ore/app/controllers/Organizations.scala on lines 98..109

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

                  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

                        request.user
                          .organizationRoles(ModelView.now(OrganizationUserRole))
                          .get(id)
                          .semiflatMap { role =>
                            import MembershipDossier._
                  Severity: Major
                  Found in ore/app/controllers/Organizations.scala and 1 other location - About 2 hrs to fix
                  ore/app/controllers/project/Projects.scala on lines 346..358

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

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

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

                      implicit val projectSortingStrategyQueryStringBindable: QueryStringBindable[ProjectSortingStrategy] =
                        new QueryStringBindable[ProjectSortingStrategy] {
                          override def bind(key: String, params: Map[String, Seq[String]]): Option[Either[String, ProjectSortingStrategy]] =
                            params.get(key).flatMap(_.headOption).map { s =>
                              ProjectSortingStrategy.values.find(_.apiName == s).toRight(s"$s is not a valid sorting strategy")
                    Severity: Major
                    Found in apiV2/app/util/APIBinders.scala and 1 other location - About 2 hrs to fix
                    apiV2/app/util/APIBinders.scala on lines 11..18

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

                    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 val categoryQueryStringBindable: QueryStringBindable[Category] = new QueryStringBindable[Category] {
                        override def bind(key: String, params: Map[String, Seq[String]]): Option[Either[String, Category]] =
                          params.get(key).flatMap(_.headOption).map { s =>
                            Category.values.find(_.apiName == s).toRight(s"$s is not a valid category")
                          }
                    Severity: Major
                    Found in apiV2/app/util/APIBinders.scala and 1 other location - About 2 hrs to fix
                    apiV2/app/util/APIBinders.scala on lines 30..38

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

                    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

                    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
                            Severity
                            Category
                            Status
                            Source
                            Language