[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2022-10-16 08:15:02 +00:00 committed by Cloudburst
parent 711629926e
commit b13e35a442
6 changed files with 10 additions and 10 deletions

View File

@ -16,7 +16,7 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
var repository: Repo? = null var repository: Repo? = null
internal set internal set
var buildBranch: String = "builds" var buildBranch: String = "builds"
fun overrideUrlPrefix(url: String) { fun overrideUrlPrefix(url: String) {
@ -46,7 +46,7 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
} }
fun setRepo(url: String) { fun setRepo(url: String) {
var type: String? = null var type: String? = null
var split = when { var split = when {
url.startsWith("https://github.com") -> { url.startsWith("https://github.com") -> {
type = "github" type = "github"
@ -69,7 +69,7 @@ abstract class CloudstreamExtension @Inject constructor(project: Project) {
.removePrefix("/") .removePrefix("/")
.removeSuffix("/") .removeSuffix("/")
.split("/") .split("/")
setRepo(split[0], split[1], type) setRepo(split[0], split[1], type)
} }

View File

@ -11,7 +11,7 @@ fun Project.makeManifest(): PluginManifest {
require(extension.pluginClassName != null) { require(extension.pluginClassName != null) {
"No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin" "No plugin class found, make sure your plugin class is annotated with @CloudstreamPlugin"
} }
val version = this.version.toString().toIntOrNull(10) val version = this.version.toString().toIntOrNull(10)
if (version == null) { if (version == null) {
logger.warn("'${project.version}' is not a valid version. Use an integer.") logger.warn("'${project.version}' is not a valid version. Use an integer.")

View File

@ -32,7 +32,7 @@ abstract class CompileDexTask : DefaultTask() {
@get:OutputFile @get:OutputFile
abstract val pluginClassFile: RegularFileProperty abstract val pluginClassFile: RegularFileProperty
@TaskAction @TaskAction
fun compileDex() { fun compileDex() {
val android = project.extensions.getByName("android") as BaseExtension val android = project.extensions.getByName("android") as BaseExtension

View File

@ -40,7 +40,7 @@ abstract class DeployWithAdbTask : DefaultTask() {
var file = make.outputs.files.singleFile var file = make.outputs.files.singleFile
var path = "/storage/emulated/0/Cloudstream3/plugins/" var path = "/storage/emulated/0/Cloudstream3/plugins/"
device.push(file, RemoteFile(path + file.name)) device.push(file, RemoteFile(path + file.name))
val args = arrayListOf("start", "-a", "android.intent.action.VIEW", "-d", "cloudstreamapp:") val args = arrayListOf("start", "-a", "android.intent.action.VIEW", "-d", "cloudstreamapp:")

View File

@ -34,7 +34,7 @@ abstract class MakePluginsJsonTask : DefaultTask() {
.build() .build()
).toPrettyString() ).toPrettyString()
) )
logger.lifecycle("Created ${outputFile.asFile.get()}") logger.lifecycle("Created ${outputFile.asFile.get()}")
} }
} }

View File

@ -23,7 +23,7 @@ fun registerTasks(project: Project) {
if (project.rootProject.tasks.findByName("makePluginsJson") == null) { if (project.rootProject.tasks.findByName("makePluginsJson") == null) {
project.rootProject.tasks.register("makePluginsJson", MakePluginsJsonTask::class.java) { project.rootProject.tasks.register("makePluginsJson", MakePluginsJsonTask::class.java) {
it.group = TASK_GROUP it.group = TASK_GROUP
it.outputs.upToDateWhen { false } it.outputs.upToDateWhen { false }
it.outputFile.set(it.project.buildDir.resolve("plugins.json")) it.outputFile.set(it.project.buildDir.resolve("plugins.json"))
@ -105,7 +105,7 @@ fun registerTasks(project: Project) {
} }
it.from(compileDexTask.outputFile) it.from(compileDexTask.outputFile)
val zip = it as Zip val zip = it as Zip
if (extension.requiresResources) { if (extension.requiresResources) {
zip.dependsOn(compileResources.get()) zip.dependsOn(compileResources.get())
@ -121,7 +121,7 @@ fun registerTasks(project: Project) {
task.logger.lifecycle("Made Cloudstream package at ${task.outputs.files.singleFile}") task.logger.lifecycle("Made Cloudstream package at ${task.outputs.files.singleFile}")
} }
} }
project.rootProject.tasks.getByName("makePluginsJson").dependsOn(make) project.rootProject.tasks.getByName("makePluginsJson").dependsOn(make)
} }
project.tasks.register("cleanCache", CleanCacheTask::class.java) { project.tasks.register("cleanCache", CleanCacheTask::class.java) {