MiniDigger/Hangar

View on GitHub

Showing 229 of 518 total issues

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

  ): Query0[(String, Option[Instant], Instant, Option[Role], Option[Role], Long)] = {
    val (sort, reverse) = if (ordering.startsWith("-")) (ordering.substring(1), false) else (ordering, true)
    val pageSize        = config.ore.users.authorPageSize
    val offset          = (page - 1) * pageSize

Severity: Minor
Found in ore/app/db/impl/query/UserPagesQueries.scala - About 1 hr to fix

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

      )(implicit service: ModelService[F], F: Monad[F]): EitherT[F, List[String], Unit] = {
        val otherDbChannels = project.channels(ModelView.later(Channel)).filterView(_.name =!= oldName)
        val query = project.channels(ModelView.raw(Channel)).filter(_.name === oldName).map { channel =>
          (
            channel,
    Severity: Minor
    Found in ore/app/form/project/TChannelData.scala - About 1 hr to fix

      Function diff_lineMode_ has a Cognitive Complexity of 10 (exceeds 5 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;

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

        def updateVersionPost(project: Model[Project], version: Model[Version]): F[Boolean] = {
          require(project.topicId.isDefined, "undefined topic id")
          require(version.postId.isDefined, "undefined post id")
      
          val topicId   = project.topicId
      Severity: Minor
      Found in ore/app/discourse/OreDiscourseApiEnabled.scala - About 1 hr to fix

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

          override def run(): Unit = {
            import cats.instances.vector._
            Logger.debug("Running Discourse recovery task...")
        
            def runUpdates[T, M, S[_], A](query: Query[T, M, S], error: String)(use: S[M] => F[A]): Unit =
        Severity: Minor
        Found in ore/app/discourse/RecoveryTask.scala - About 1 hr to fix

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

            def showNotifications(notificationFilter: Option[String], inviteFilter: Option[String]): Action[AnyContent] = {
              Authenticated.asyncF { implicit request =>
                import cats.instances.vector._
                val user = request.user
          
          
          Severity: Minor
          Found in ore/app/controllers/Users.scala - About 1 hr to fix

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

              def setVisible(author: String, slug: String, visibility: Int): Action[AnyContent] = {
                AuthedProjectAction(author, slug, requireUnlock = true)
                  .andThen(ProjectPermissionAction(Permission.Reviewer))
                  .asyncF { implicit request =>
                    val newVisibility = Visibility.withValue(visibility)
            Severity: Minor
            Found in ore/app/controllers/project/Projects.scala - About 1 hr to fix

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

                Collapse.prototype.hide = function () {
                  if (this.transitioning || !this.$element.hasClass('in')) return
              
                  var startEvent = $.Event('hide.bs.collapse')
                  this.$element.trigger(startEvent)
              Severity: Minor
              Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                    function next() {
                      $active
                        .removeClass('active')
                        .find('> .dropdown-menu > .active')
                          .removeClass('active')
                Severity: Minor
                Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                    ScrollSpy.prototype.refresh = function () {
                      var that          = this
                      var offsetMethod  = 'offset'
                      var offsetBase    = 0
                  
                  
                  Severity: Minor
                  Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

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

                      ): Either[String, PendingVersion] = {
                        val metaData = plugin.data
                        if (!metaData.id.contains(pluginId))
                          Left("error.plugin.invalidPluginId")
                        else if (metaData.version.isEmpty)
                    Severity: Minor
                    Found in orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala - About 1 hr to fix

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

                        def approve(author: String, slug: String, versionString: String, partial: Boolean): Action[AnyContent] = {
                          AuthedProjectAction(author, slug, requireUnlock = true)
                            .andThen(ProjectPermissionAction(Permission.Reviewer))
                            .asyncEitherT { implicit request =>
                              val newState = if (partial) ReviewState.PartiallyReviewed else ReviewState.Reviewed
                      Severity: Minor
                      Found in ore/app/controllers/project/Versions.scala - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                              if (lastEquality && ((pre_ins && pre_del && post_ins && post_del) ||
                                                   ((lastEquality.length < this.Diff_EditCost / 2) &&
                                                    (pre_ins + pre_del + post_ins + post_del) == 3))) {
                                // Duplicate record.
                                diffs.splice(equalities[equalitiesLength - 1], 0,

                          Method listProjects has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                q: Option[String],
                                categories: Seq[Category],
                                tags: Seq[String],
                                owner: Option[String],
                                sort: Option[ProjectSortingStrategy],
                          Severity: Major
                          Found in apiV2/app/controllers/apiv2/ApiV2Controller.scala - About 1 hr to fix

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

                                projectId: DbRef[Project],
                                homepage: Option[String] = None,
                                issues: Option[String] = None,
                                source: Option[String] = None,
                                support: Option[String] = None,
                            Severity: Major
                            Found in models/src/main/scala/ore/models/project/ProjectSettings.scala - About 1 hr to fix

                              Function initChannelManager has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function initChannelManager(toggle, channelName, channelHex, title, call, method, submit, nonReviewed) {
                              Severity: Major
                              Found in ore/public/javascripts/channelManage.js - About 1 hr to fix

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

                                    headerData: HeaderData,
                                    user: Model[User],
                                    isOrga: Boolean,
                                    projectCount: Int,
                                    orgas: Seq[(Model[Organization], Model[User], Model[OrganizationUserRole], Model[User])],
                                Severity: Major
                                Found in orePlayCommon/app/models/viewhelper/UserData.scala - About 1 hr to fix

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

                                      val service: ModelService[IO],
                                      val config: OreConfig,
                                      val forums: OreDiscourseApi[IO],
                                      val cacheApi: SyncCacheApi,
                                      val actorSystem: ActorSystem,
                                  Severity: Major
                                  Found in orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala - About 1 hr to fix

                                    Function toString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    diff_match_patch.patch_obj.prototype.toString = function() {
                                      var coords1, coords2;
                                      if (this.length1 === 0) {
                                        coords1 = this.start1 + ',0';
                                      } else if (this.length1 == 1) {
                                    Severity: Minor
                                    Found in ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js - About 55 mins 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 diff_commonOverlap_ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
                                      // Cache the text lengths to prevent multiple calls.
                                      var text1_length = text1.length;
                                      var text2_length = text2.length;
                                      // Eliminate the null case.
                                    Severity: Minor
                                    Found in ore/public/diff-match-patch/javascript/diff_match_patch_uncompressed.js - About 55 mins 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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language