MiniDigger/Hangar

View on GitHub

Showing 518 of 518 total issues

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

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

                                    self.timeout = setTimeout(function () {
                                      if (self.hoverState == 'in') self.show()
                                    }, self.options.delay.show)
                                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 1164..1166

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

                                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

                                    self.timeout = setTimeout(function () {
                                      if (self.hoverState == 'out') self.hide()
                                    }, self.options.delay.hide)
                                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 1130..1132

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

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

                                package ore.db.impl.schema
                                
                                import ore.db.DbRef
                                import ore.db.impl.OrePostgresDriver.api._
                                import ore.models.project.Project
                                models/src/main/scala/ore/db/impl/schema/OrganizationMembersTable.scala on lines 1..15
                                models/src/main/scala/ore/db/impl/schema/ProjectMembersTable.scala on lines 1..15
                                models/src/main/scala/ore/db/impl/schema/ProjectStarsTable.scala on lines 1..15
                                models/src/main/scala/ore/db/impl/schema/UserGlobalRolesTable.scala on lines 1..15

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

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

                                package ore.db.impl.schema
                                
                                import ore.db.DbRef
                                import ore.db.impl.OrePostgresDriver.api._
                                import ore.models.project.Project
                                models/src/main/scala/ore/db/impl/schema/OrganizationMembersTable.scala on lines 1..15
                                models/src/main/scala/ore/db/impl/schema/ProjectStarsTable.scala on lines 1..15
                                models/src/main/scala/ore/db/impl/schema/ProjectWatchersTable.scala on lines 1..15
                                models/src/main/scala/ore/db/impl/schema/UserGlobalRolesTable.scala on lines 1..15

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

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language