MiniDigger/Hangar

View on GitHub
orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala

Summary

Maintainability
C
7 hrs
Test Coverage

File ProjectFactory.scala has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package ore.models.project.factory

import java.nio.file.Files._
import javax.inject.{Inject, Singleton}

Severity: Minor
Found in orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala - About 2 hrs 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

      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

        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

          Method startVersion has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                plugin: PluginFileWithData,
                pluginId: String,
                projectId: Option[DbRef[Project]],
                projectUrl: String,
                forumSync: Boolean,
          Severity: Minor
          Found in orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala - About 45 mins to fix

            Function createVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def createVersion(
                  project: Model[Project],
                  pending: PendingVersion
              )(
                  implicit ec: ExecutionContext,
            Severity: Minor
            Found in orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala - About 25 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

            There are no issues that match your filters.

            Category
            Status