MiniDigger/Hangar

View on GitHub

Showing 518 of 518 total issues

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

  def createProjectTopic(project: Model[Project]): F[Model[Project]] = {
    val title = Templates.projectTitle(project)

    implicit val mdc: DiscourseMDC = DiscourseMDC(project.ownerName, None, title)

Severity: Minor
Found in ore/app/discourse/OreDiscourseApiEnabled.scala - About 1 hr to fix

    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.RoleTable
    models/src/main/scala/ore/db/impl/schema/OrganizationRoleTable.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 123.

    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.RoleTable
    models/src/main/scala/ore/db/impl/schema/ProjectRoleTable.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 123.

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

    function initChannelManager(toggle, channelName, channelHex, title, call, method, submit, nonReviewed) {
        $(toggle).off('click'); // Unbind previous click handlers
        $(toggle).click(function() {
            var modal = getModal();
            var preview = modal.find('.preview');
    Severity: Minor
    Found in ore/public/javascripts/channelManage.js - About 1 hr to fix

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

      function loadActions(increment, action) {
          pages[action] += increment;
          var offset = (pages[action] - 1) * CONTENT_PER_PAGE;
      
          apiV2Request('users/' + USERNAME + '/' + action + '?offset=' + offset + '&limit=' + CONTENT_PER_PAGE).then(function (result) {
      Severity: Minor
      Found in ore/public/javascripts/userPage.js - About 1 hr to fix

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

        diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
            opt_deadline) {
          // Set a deadline by which time the diff must be complete.
          if (typeof opt_deadline == 'undefined') {
            if (this.Diff_Timeout <= 0) {

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

            Tab.prototype.activate = function (element, container, callback) {
              var $active    = container.find('> .active')
              var transition = callback
                && $.support.transition
                && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
          Severity: Minor
          Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

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

            function initUserSearch(callback) {
                var search = $('.user-search');
                var input = search.find('input');
            
                // Disable button with no input
            Severity: Minor
            Found in ore/public/javascripts/userSearch.js - About 1 hr to fix

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

              diff_match_patch.prototype.patch_addPadding = function(patches) {
                var paddingLength = this.Patch_Margin;
                var nullPadding = '';
                for (var x = 1; x <= paddingLength; x++) {
                  nullPadding += String.fromCharCode(x);

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

                  val getQueue: Query0[UnsortedQueueEntry] = {
                    val reviewStateId = ReviewState.Unreviewed.value
                    sql"""|SELECT sq.project_author,
                          |       sq.project_slug,
                          |       sq.project_name,
                Severity: Minor
                Found in ore/app/db/impl/query/AppQueries.scala - About 1 hr to fix

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

                    ): Query0[ProjectListEntry] = {
                      val visibilityFrag =
                        if (canSeeHidden) None
                        else
                          currentUserId.fold(Some(fr"(p.visibility = 1)")) { id =>
                  Severity: Minor
                  Found in ore/app/db/impl/query/UserPagesQueries.scala - About 1 hr to fix

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

                      ): OptionT[IO, (Model[UnsafeDownload], Option[play.api.mvc.Session])] = {
                        val addr = InetString(StatTracker.remoteAddress)
                        val dlType = downloadType
                          .flatMap(DownloadType.withValueOpt)
                          .getOrElse(DownloadType.UploadedFile)
                    Severity: Minor
                    Found in ore/app/controllers/project/Versions.scala - About 1 hr to fix

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

                          createdAt: LocalDateTime,
                          name: String,
                          dependenciesIds: List[String],
                          visibility: Visibility,
                          description: Option[String],
                      Severity: Major
                      Found in apiV2/app/models/querymodels/apiV2QueryModels.scala - About 1 hr to fix

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

                          override def authenticate(payload: String, sig: String)(isNonceValid: String => F[Boolean]): OptionT[F, AuthUser] = {
                            Logger.debug("Authenticating SSO payload...")
                            Logger.debug(payload)
                            Logger.debug("Signed with : " + sig)
                            if (generateSignature(payload) != sig) {
                        Severity: Minor
                        Found in auth/src/main/scala/ore/auth/AkkaSSOApi.scala - About 1 hr to fix

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

                            ): Fragment = {
                              val base =
                                sql"""|SELECT pv.created_at,
                                      |       pv.version_string,
                                      |       pv.dependencies,
                          Severity: Minor
                          Found in apiV2/app/db/impl/query/APIV2Queries.scala - About 1 hr to fix

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

                              ): EitherT[IO, String, (Project, ProjectSettings)] = {
                                val name = template.name
                                val slug = slugify(name)
                                val project = Project(
                                  pluginId = template.pluginId,
                            Severity: Minor
                            Found in orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala - About 1 hr to fix

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

                                  if (!self) {
                                    self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
                                    $(obj.currentTarget).data('bs.' + this.type, self)
                                  }
                              Severity: Major
                              Found in ore/public/bootstrap/js/bootstrap.js and 2 other locations - About 1 hr to fix
                              ore/public/bootstrap/js/bootstrap.js on lines 1110..1113
                              ore/public/bootstrap/js/bootstrap.js on lines 1451..1454

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

                              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 3 locations. Consider refactoring.
                              Open

                                  if (!self) {
                                    self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
                                    $(obj.currentTarget).data('bs.' + this.type, self)
                                  }
                              Severity: Major
                              Found in ore/public/bootstrap/js/bootstrap.js and 2 other locations - About 1 hr to fix
                              ore/public/bootstrap/js/bootstrap.js on lines 1147..1150
                              ore/public/bootstrap/js/bootstrap.js on lines 1451..1454

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

                              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 3 locations. Consider refactoring.
                              Open

                                    if (!self) {
                                      self = new this.constructor(e.currentTarget, this.getDelegateOptions())
                                      $(e.currentTarget).data('bs.' + this.type, self)
                                    }
                              Severity: Major
                              Found in ore/public/bootstrap/js/bootstrap.js and 2 other locations - About 1 hr to fix
                              ore/public/bootstrap/js/bootstrap.js on lines 1110..1113
                              ore/public/bootstrap/js/bootstrap.js on lines 1147..1150

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

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

                              function setupAvatarForm() {
                              
                                  $('.btn-got-it').click(function () {
                                      var prompt = $(this).closest('.prompt');
                                      $.ajax({
                              Severity: Minor
                              Found in ore/public/javascripts/userPage.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language