MiniDigger/Hangar

View on GitHub

Showing 518 of 518 total issues

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

  def bytesToHex(bytes: Array[Byte]): String = {
    val hexChars = new Array[Char](bytes.length * 2)
    var j        = 0
    while (j < bytes.length) {
      val v = bytes(j) & 0xFF
Severity: Major
Found in models/src/main/scala/ore/util/StringUtils.scala and 1 other location - About 1 hr to fix
auth/src/main/scala/ore/auth/CryptoUtils.scala on lines 44..55

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

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

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

  private def bytesToHex(bytes: Array[Byte]): String = {
    val hexChars = new Array[Char](bytes.length * 2)
    var j        = 0
    while (j < bytes.length) {
      val v = bytes(j) & 0xFF
Severity: Major
Found in auth/src/main/scala/ore/auth/CryptoUtils.scala and 1 other location - About 1 hr to fix
models/src/main/scala/ore/util/StringUtils.scala on lines 65..76

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

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

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

    diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
      // Scan the text on a line-by-line basis first.
      var a = this.diff_linesToChars_(text1, text2);
      text1 = a.chars1;
      text2 = a.chars2;

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

      package ore.db.impl.schema
      
      import ore.db.DbRef
      import ore.db.impl.OrePostgresDriver.api._
      import ore.db.impl.table.common.VisibilityChangeColumns
      models/src/main/scala/ore/db/impl/schema/VersionVisibilityChangeTable.scala on lines 1..20

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

      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.db.impl.schema
      
      import ore.db.DbRef
      import ore.db.impl.OrePostgresDriver.api._
      import ore.db.impl.table.common.VisibilityChangeColumns
      models/src/main/scala/ore/db/impl/schema/ProjectVisibilityChangeTable.scala on lines 1..20

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

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

        Carousel.prototype.slide = function (type, next) {
          var $active   = this.$element.find('.item.active')
          var $next     = next || this.getItemForDirection(type, $active)
          var isCycling = this.interval
          var direction = type == 'next' ? 'left' : 'right'
      Severity: Minor
      Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

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

          def loadMeta[F[_]](implicit messages: Messages, F: Sync[F]): EitherT[F, String, PluginFileWithData] = {
            val fileNames = PluginFileData.fileNames
        
            val res = newJarStream
              .flatMap { in =>
        Severity: Minor
        Found in orePlayCommon/app/ore/models/project/io/PluginFile.scala - About 1 hr to fix

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

            $(window).on('load', function () {
              $('[data-ride="carousel"]').each(function () {
                var $carousel = $(this)
                Plugin.call($carousel, $carousel.data())
              })
          Severity: Major
          Found in ore/public/bootstrap/js/bootstrap.js and 1 other location - About 1 hr to fix
          ore/public/bootstrap/js/bootstrap.js on lines 2316..2321

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

          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 14 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              versionString: String,
              dependencyIds: List[String],
              description: Option[String],
              projectId: Option[DbRef[Project]], // Version might be for an uncreated project
              fileSize: Long,
          Severity: Major
          Found in orePlayCommon/app/ore/models/project/factory/PendingVersion.scala - About 1 hr to fix

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

              $(window).on('load.bs.scrollspy.data-api', function () {
                $('[data-spy="scroll"]').each(function () {
                  var $spy = $(this)
                  Plugin.call($spy, $spy.data())
                })
            Severity: Major
            Found in ore/public/bootstrap/js/bootstrap.js and 1 other location - About 1 hr to fix
            ore/public/bootstrap/js/bootstrap.js on lines 480..485

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

            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

                object users extends ConfigCategory {
                  val raw: Configuration    = ore.raw.get[Configuration]("users")
                  val starsPerPage: Int     = raw.get[Int]("stars-per-page")
                  val maxTaglineLen: Int    = raw.get[Int]("max-tagline-len")
                  val authorPageSize: Long  = raw.get[Long]("author-page-size")
            Severity: Major
            Found in orePlayCommon/app/ore/OreConfig.scala and 1 other location - About 1 hr to fix
            orePlayCommon/app/ore/OreConfig.scala on lines 60..66

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

            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

                object channels extends ConfigCategory {
                  val raw: Configuration  = ore.raw.get[Configuration]("channels")
                  val maxNameLen: Int     = raw.get[Int]("max-name-len")
                  val nameRegex: String   = raw.get[String]("name-regex")
                  val colorDefault: Int   = raw.get[Int]("color-default")
            Severity: Major
            Found in orePlayCommon/app/ore/OreConfig.scala and 1 other location - About 1 hr to fix
            orePlayCommon/app/ore/OreConfig.scala on lines 92..98

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

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

              ): APIV2.Project = {
                val iconPath = projectFiles.getIconPath(namespace.ownerName, name)
                val iconUrl =
                  if (iconPath.isDefined)
                    controllers.project.routes.Projects.showIcon(namespace.ownerName, namespace.slug).absoluteURL()
            Severity: Minor
            Found in apiV2/app/models/querymodels/apiV2QueryModels.scala - About 1 hr to fix

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

                    created_at: LocalDateTime,
                    plugin_id: String,
                    name: String,
                    namespace: ProjectNamespace,
                    recommended_version: Option[RecommendedVersion],
              Severity: Major
              Found in apiV2/app/models/protocols/APIV2.scala - About 1 hr to fix

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

                    service: ModelService[IO],
                    sso: SSOApi[IO],
                    bakery: Bakery,
                    config: OreConfig,
                    users: UserBase[IO],
                Severity: Major
                Found in orePlayCommon/app/controllers/OreControllerComponents.scala - About 1 hr to fix

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

                  diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
                      deadline) {
                    var diffs;
                  
                    if (!text1) {

                    Function diff_fromDelta has 40 lines of code (exceeds 25 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);

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

                        Modal.prototype.show = function (_relatedTarget) {
                          var that = this
                          var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
                      
                          this.$element.trigger(e)
                      Severity: Minor
                      Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                          Modal.prototype.backdrop = function (callback) {
                            var that = this
                            var animate = this.$element.hasClass('fade') ? 'fade' : ''
                        
                            if (this.isShown && this.options.backdrop) {
                        Severity: Minor
                        Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language