orePlayCommon/app/ore/models/project/factory/ProjectFactory.scala
File ProjectFactory.scala
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package ore.models.project.factory
import java.nio.file.Files._
import javax.inject.{Inject, Singleton}
Function createProject
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
): EitherT[IO, String, (Project, ProjectSettings)] = {
val name = template.name
val slug = slugify(name)
val project = Project(
pluginId = template.pluginId,
Function startVersion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
): Either[String, PendingVersion] = {
val metaData = plugin.data
if (!metaData.id.contains(pluginId))
Left("error.plugin.invalidPluginId")
else if (metaData.version.isEmpty)
Constructor has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
val service: ModelService[IO],
val config: OreConfig,
val forums: OreDiscourseApi[IO],
val cacheApi: SyncCacheApi,
val actorSystem: ActorSystem,
Method startVersion
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
plugin: PluginFileWithData,
pluginId: String,
projectId: Option[DbRef[Project]],
projectUrl: String,
forumSync: Boolean,
Function createVersion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def createVersion(
project: Model[Project],
pending: PendingVersion
)(
implicit ec: ExecutionContext,
- Read upRead up
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"