MiniDigger/Hangar

View on GitHub

Showing 229 of 518 total issues

Function diff_compute_ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

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

  if (!text1) {

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

    pluginId: String,
    name: String,
    namespace: ProjectNamespace,
    recommendedVersion: Option[String],
    recommendedVersionTags: Option[List[APIV2QueryVersionTag]],
Severity: Major
Found in apiV2/app/models/querymodels/apiV2QueryModels.scala - About 1 hr to fix

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

        joinable: Model[Project],
        projectOwner: Model[User],
        publicVersions: Int, // project.versions.count(_.visibility === VisibilityTypes.Public)
        settings: Model[ProjectSettings],
        members: Seq[(Model[ProjectUserRole], Model[User])],
    Severity: Major
    Found in orePlayCommon/app/models/viewhelper/ProjectData.scala - About 1 hr to fix

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

          namespace: ProjectNamespace,
          visibility: Visibility,
          views: Long,
          downloads: Long,
          stars: Long,
      Severity: Major
      Found in ore/app/models/querymodels/ProjectListEntry.scala - About 1 hr to fix

        Function diff_cleanupSemanticScore_ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function diff_cleanupSemanticScore_(one, two) {
            if (!one || !two) {
              // Edges are the best.
              return 6;
            }

          Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Tooltip.prototype.applyPlacement = function (offset, placement) {
              var $tip   = this.tip()
              var width  = $tip[0].offsetWidth
              var height = $tip[0].offsetHeight
          
          
          Severity: Minor
          Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

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

              Tab.prototype.show = function () {
                var $this    = this.element
                var $ul      = $this.closest('ul:not(.dropdown-menu)')
                var selector = $this.data('target')
            
            
            Severity: Minor
            Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix

              Function initColorPicker has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function initColorPicker() {
                  var modal = getModal();
                  // Initialize popover to stay opened when hovered over
                  modal.find(".color-picker").popover({
                      html: true,
              Severity: Minor
              Found in ore/public/javascripts/channelManage.js - About 1 hr to fix

                Function updateProjectTopic has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function provideOreDiscourseApi has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    ): OreDiscourseApi[IO] = {
                      val forums = config.forums
                      if (forums.api.enabled) {
                        val api = forums.api
                  
                  
                  Severity: Minor
                  Found in ore/app/Module.scala - About 1 hr to fix

                    Function takeoverReview has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def takeoverReview(author: String, slug: String, versionString: String): Action[String] = {
                        Authenticated
                          .andThen(PermissionAction(Permission.Reviewer))
                          .asyncEitherT(parse.form(forms.ReviewDescription)) { implicit request =>
                            for {
                    Severity: Minor
                    Found in ore/app/controllers/Reviews.scala - About 1 hr to fix

                      Function patch_addContext_ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
                        if (text.length == 0) {
                          return;
                        }
                        if (patch.start2 === null) {

                        Function diff_commonOverlap_ has 29 lines of code (exceeds 25 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.

                          Function getData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            override def getData(bufferedReader: BufferedReader): Seq[DataValue] = {
                              val dataValues = new ArrayBuffer[DataValue]
                              try {
                                val info = McModInfo.DEFAULT.read(bufferedReader).asScala
                                if (info.lengthCompare(1) < 0) Nil
                          Severity: Minor
                          Found in orePlayCommon/app/ore/models/project/io/PluginFileData.scala - About 1 hr to fix

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

                                private val id: ObjId[User],
                                fullName: Option[String] = None,
                                name: String = "",
                                email: Option[String] = None,
                                tagline: Option[String] = None,
                            Severity: Major
                            Found in models/src/main/scala/ore/models/user/User.scala - About 1 hr to fix

                              Method rawApply has 9 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                    id: Option[DbRef[LoggedActionModel[Ctx]]],
                                    createdAt: Option[Instant],
                                    userId: DbRef[User],
                                    address: InetString,
                                    action: LoggedAction[Ctx],
                              Severity: Major
                              Found in models/src/main/scala/ore/db/impl/schema/LoggedActionTable.scala - About 1 hr to fix

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

                                    api: DiscourseApi[F],
                                    categoryDefault: Int,
                                    categoryDeleted: Int,
                                    topicTemplatePath: Path,
                                    versionReleasePostTemplatePath: Path,
                                Severity: Major
                                Found in ore/app/discourse/OreDiscourseApiEnabled.scala - About 1 hr to fix

                                  Method getHomeProjects has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                        currentUserId: Option[DbRef[User]],
                                        canSeeHidden: Boolean,
                                        platformNames: List[String],
                                        categories: List[Category],
                                        query: Option[String],
                                  Severity: Major
                                  Found in ore/app/db/impl/query/AppQueries.scala - About 1 hr to fix

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

                                    function apiV2Request(url, method = "GET", data = {}) {
                                        return getApiSession().then(function (session) {
                                            return new Promise(function (resolve, reject) {
                                                const isFormData = data instanceof FormData;
                                                const isBodyRequest = (method === "POST" || method === "PUT" || method === "PATCH");
                                    Severity: Minor
                                    Found in ore/public/javascripts/apiRequests.js - About 1 hr to fix

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

                                        Affix.prototype.checkPosition = function () {
                                          if (!this.$element.is(':visible')) return
                                      
                                          var height       = this.$element.height()
                                          var offset       = this.options.offset
                                      Severity: Minor
                                      Found in ore/public/bootstrap/js/bootstrap.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language