diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
new file mode 100644
index 00000000..36adc78e
--- /dev/null
+++ b/.github/workflows/pr.yml
@@ -0,0 +1,9 @@
+name: PR
+
+on:
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ call-pr-workflow:
+ uses: FossifyOrg/.github/.github/workflows/pr.yml@main
diff --git a/.github/workflows/testing-build.yml b/.github/workflows/testing-build.yml
new file mode 100644
index 00000000..33379f92
--- /dev/null
+++ b/.github/workflows/testing-build.yml
@@ -0,0 +1,10 @@
+name: Testing build (on PR)
+
+on:
+ pull_request:
+ branches: [ master ]
+ types: [ labeled, opened, synchronize, reopened ]
+
+jobs:
+ call-testing-build-workflow:
+ uses: FossifyOrg/.github/.github/workflows/testing-build.yml@main
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index e6acd4f8..15682047 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.android)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.ksp)
+ alias(libs.plugins.detekt)
}
val keystorePropertiesFile: File = rootProject.file("keystore.properties")
@@ -88,10 +89,16 @@ android {
lint {
checkReleaseBuilds = false
- abortOnError = false
+ abortOnError = true
+ warningsAsErrors = true
+ baseline = file("lint-baseline.xml")
}
}
+detekt {
+ baseline = file("detekt-baseline.xml")
+}
+
dependencies {
implementation(libs.fossify.commons)
implementation(libs.eventbus)
diff --git a/app/detekt-baseline.xml b/app/detekt-baseline.xml
new file mode 100644
index 00000000..58aa0a5c
--- /dev/null
+++ b/app/detekt-baseline.xml
@@ -0,0 +1,119 @@
+
+
+
+
+ EmptyCatchBlock:Activity.kt${ }
+ EmptyCatchBlock:RecorderFragment.kt$RecorderFragment${ }
+ EmptyFunctionBlock:Mp3Recorder.kt$Mp3Recorder${}
+ EmptyFunctionBlock:PlayerFragment.kt$PlayerFragment.<no name provided>${}
+ EmptyFunctionBlock:RecordingsAdapter.kt$RecordingsAdapter${}
+ EmptyFunctionBlock:TrashAdapter.kt$TrashAdapter${}
+ EmptyFunctionBlock:TrashFragment.kt$TrashFragment${}
+ EmptyFunctionBlock:WidgetRecordDisplayConfigureActivity.kt$WidgetRecordDisplayConfigureActivity.<no name provided>${}
+ FunctionParameterNaming:Config.kt$Config$audio_source: Int
+ MagicNumber:Activity.kt$1000
+ MagicNumber:Activity.kt$1000L
+ MagicNumber:Constants.kt$128000
+ MagicNumber:Constants.kt$160000
+ MagicNumber:Constants.kt$192000
+ MagicNumber:Constants.kt$256000
+ MagicNumber:Constants.kt$32000
+ MagicNumber:Constants.kt$320000
+ MagicNumber:Constants.kt$64000
+ MagicNumber:Constants.kt$96000
+ MagicNumber:Context.kt$1000
+ MagicNumber:Context.kt$60
+ MagicNumber:Mp3Recorder.kt$Mp3Recorder$1.25
+ MagicNumber:Mp3Recorder.kt$Mp3Recorder$1000
+ MagicNumber:Mp3Recorder.kt$Mp3Recorder$7200
+ MagicNumber:Mp3Recorder.kt$Mp3Recorder$8
+ MagicNumber:PlayerFragment.kt$PlayerFragment$1000
+ MagicNumber:PlayerFragment.kt$PlayerFragment$10000
+ MagicNumber:PlayerFragment.kt$PlayerFragment.<no name provided>$1000
+ MagicNumber:RecorderFragment.kt$RecorderFragment$500
+ MagicNumber:RecorderService.kt$RecorderService$1000
+ MagicNumber:RecorderService.kt$RecorderService$75L
+ MagicNumber:SettingsActivity.kt$SettingsActivity$1000
+ MagicNumber:ViewPagerAdapter.kt$ViewPagerAdapter$3
+ MagicNumber:WidgetRecordDisplayConfigureActivity.kt$WidgetRecordDisplayConfigureActivity$100
+ MaxLineLength:Activity.kt$fileDirItems = recordingsToMove.map { File(it.path).toFileDirItem(this) }.toMutableList() as ArrayList<FileDirItem>
+ MaxLineLength:Activity.kt$fileDirItems = recordingsToRestore.map { File(it.path).toFileDirItem(this) }.toMutableList() as ArrayList<FileDirItem>
+ MaxLineLength:Activity.kt$fun
+ MaxLineLength:Activity.kt$val recordingsToRemove = getLegacyRecordings(trashed = true).filter { it.timestamp < System.currentTimeMillis() - MONTH_SECONDS * 1000L }
+ MaxLineLength:BackgroundRecordActivity.kt$BackgroundRecordActivity$PermissionRequiredDialog(this, org.fossify.commons.R.string.allow_notifications_voice_recorder, { openNotificationSettings() })
+ MaxLineLength:MainActivity.kt$MainActivity$customView?.findViewById<ImageView>(org.fossify.commons.R.id.tab_item_icon)?.setImageDrawable(getDrawable(drawableId))
+ MaxLineLength:MainActivity.kt$MainActivity$faqItems.add(FAQItem(org.fossify.commons.R.string.faq_2_title_commons, org.fossify.commons.R.string.faq_2_text_commons))
+ MaxLineLength:MainActivity.kt$MainActivity$faqItems.add(FAQItem(org.fossify.commons.R.string.faq_6_title_commons, org.fossify.commons.R.string.faq_6_text_commons))
+ MaxLineLength:MainActivity.kt$MainActivity$findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(org.fossify.commons.R.bool.hide_google_relations)
+ MaxLineLength:MainActivity.kt$MainActivity$updateMaterialActivityViews(binding.mainCoordinator, binding.mainHolder, useTransparentNavigation = false, useTopSearchMenu = true)
+ MaxLineLength:MyViewPagerFragment.kt$MyViewPagerFragment$abstract
+ MaxLineLength:MyWidgetRecordDisplayProvider.kt$MyWidgetRecordDisplayProvider$PendingIntent.getActivity(context, OPEN_APP_INTENT_ID, this, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
+ MaxLineLength:MyWidgetRecordDisplayProvider.kt$MyWidgetRecordDisplayProvider$val drawable = context.resources.getColoredDrawableWithColor(org.fossify.commons.R.drawable.ic_microphone_vector, color, alpha)
+ MaxLineLength:PlayerFragment.kt$PlayerFragment$class
+ MaxLineLength:PlayerFragment.kt$PlayerFragment$if
+ MaxLineLength:PlayerFragment.kt$PlayerFragment$val drawable = if (isPlaying) org.fossify.commons.R.drawable.ic_pause_vector else org.fossify.commons.R.drawable.ic_play_vector
+ MaxLineLength:PlayerFragment.kt$PlayerFragment$val filtered = itemsIgnoringSearch.filter { it.title.contains(text, true) }.toMutableList() as ArrayList<Recording>
+ MaxLineLength:RecorderFragment.kt$RecorderFragment$PermissionRequiredDialog
+ MaxLineLength:RecorderFragment.kt$RecorderFragment$if (status == RECORDING_RUNNING || status == RECORDING_PAUSED) org.fossify.commons.R.drawable.ic_stop_vector else org.fossify.commons.R.drawable.ic_microphone_vector
+ MaxLineLength:RecorderFragment.kt$RecorderFragment$setImageDrawable(resources.getColoredDrawableWithColor(org.fossify.commons.R.drawable.ic_pause_vector, properPrimaryColor.getContrastColor()))
+ MaxLineLength:RecorderService.kt$RecorderService$return PendingIntent.getActivity(this, RECORDER_RUNNING_NOTIF_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
+ MaxLineLength:RecorderService.kt$RecorderService$val importance = if (hideNotification) NotificationManager.IMPORTANCE_MIN else NotificationManager.IMPORTANCE_DEFAULT
+ MaxLineLength:Recording.kt$Recording
+ MaxLineLength:RecordingsAdapter.kt$RecordingsAdapter$private
+ MaxLineLength:SettingsActivity.kt$SettingsActivity$arrayOf(binding.settingsColorCustomizationSectionLabel, binding.settingsGeneralSettingsLabel, binding.settingsRecycleBinLabel)
+ MaxLineLength:SettingsActivity.kt$SettingsActivity$binding.settingsUseEnglishHolder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus())
+ MaxLineLength:SettingsActivity.kt$SettingsActivity$updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false)
+ MaxLineLength:TrashFragment.kt$TrashFragment$class
+ MaxLineLength:TrashFragment.kt$TrashFragment$val filtered = itemsIgnoringSearch.filter { it.title.contains(text, true) }.toMutableList() as ArrayList<Recording>
+ MaxLineLength:WidgetRecordDisplayConfigureActivity.kt$WidgetRecordDisplayConfigureActivity$mWidgetColorWithoutTransparency = Color.rgb(Color.red(mWidgetColor), Color.green(mWidgetColor), Color.blue(mWidgetColor))
+ PrintStackTrace:Mp3Recorder.kt$Mp3Recorder$e
+ SwallowedException:Activity.kt$e: Exception
+ SwallowedException:Context.kt$e: Exception
+ SwallowedException:RecorderFragment.kt$RecorderFragment$e: Exception
+ TooGenericExceptionCaught:Activity.kt$e: Exception
+ TooGenericExceptionCaught:Context.kt$e: Exception
+ TooGenericExceptionCaught:Mp3Recorder.kt$Mp3Recorder$e: Exception
+ TooGenericExceptionCaught:PlayerFragment.kt$PlayerFragment$e: Exception
+ TooGenericExceptionCaught:RecorderFragment.kt$RecorderFragment$e: Exception
+ TooGenericExceptionCaught:RecorderService.kt$RecorderService$e: Exception
+ TooGenericExceptionCaught:RenameRecordingDialog.kt$RenameRecordingDialog$e: Exception
+ TooManyFunctions:Context.kt$org.fossify.voicerecorder.extensions.Context.kt
+ TooManyFunctions:MainActivity.kt$MainActivity : SimpleActivity
+ TooManyFunctions:PlayerFragment.kt$PlayerFragment : MyViewPagerFragmentRefreshRecordingsListener
+ TooManyFunctions:RecorderFragment.kt$RecorderFragment : MyViewPagerFragment
+ TooManyFunctions:RecorderService.kt$RecorderService : Service
+ TooManyFunctions:RecordingsAdapter.kt$RecordingsAdapter : MyRecyclerViewAdapterOnPopupTextUpdate
+ TooManyFunctions:SettingsActivity.kt$SettingsActivity : SimpleActivity
+ TooManyFunctions:TrashAdapter.kt$TrashAdapter : MyRecyclerViewAdapterOnPopupTextUpdate
+ TooManyFunctions:TrashFragment.kt$TrashFragment : MyViewPagerFragmentRefreshRecordingsListener
+ UnusedParameter:PlayerFragment.kt$PlayerFragment$event: Events.RecordingCompleted
+ UnusedParameter:PlayerFragment.kt$PlayerFragment$event: Events.RecordingTrashUpdated
+ UnusedParameter:TrashFragment.kt$TrashFragment$event: Events.RecordingTrashUpdated
+ UnusedPrivateMember:TrashAdapter.kt$TrashAdapter$private fun getItemWithKey(key: Int): Recording?
+ VariableNaming:MyWidgetRecordDisplayProvider.kt$MyWidgetRecordDisplayProvider$private val OPEN_APP_INTENT_ID = 1
+ VariableNaming:PlayerFragment.kt$PlayerFragment$private val FAST_FORWARD_SKIP_MS = 10000
+ VariableNaming:RecorderService.kt$RecorderService$private val AMPLITUDE_UPDATE_MS = 75L
+ WildcardImport:Activity.kt$import org.fossify.commons.helpers.*
+ WildcardImport:Context.kt$import org.fossify.commons.extensions.*
+ WildcardImport:Context.kt$import org.fossify.voicerecorder.helpers.*
+ WildcardImport:MainActivity.kt$import org.fossify.commons.extensions.*
+ WildcardImport:MainActivity.kt$import org.fossify.commons.helpers.*
+ WildcardImport:Mp3Recorder.kt$import java.io.*
+ WildcardImport:PlayerFragment.kt$import org.fossify.commons.extensions.*
+ WildcardImport:RecorderFragment.kt$import org.fossify.commons.extensions.*
+ WildcardImport:RecorderFragment.kt$import org.fossify.voicerecorder.helpers.*
+ WildcardImport:RecorderService.kt$import android.app.*
+ WildcardImport:RecorderService.kt$import org.fossify.commons.extensions.*
+ WildcardImport:RecorderService.kt$import org.fossify.voicerecorder.helpers.*
+ WildcardImport:RecordingsAdapter.kt$import android.view.*
+ WildcardImport:RecordingsAdapter.kt$import org.fossify.commons.extensions.*
+ WildcardImport:RenameRecordingDialog.kt$import org.fossify.commons.extensions.*
+ WildcardImport:SettingsActivity.kt$import org.fossify.commons.dialogs.*
+ WildcardImport:SettingsActivity.kt$import org.fossify.commons.extensions.*
+ WildcardImport:SettingsActivity.kt$import org.fossify.commons.helpers.*
+ WildcardImport:TrashAdapter.kt$import android.view.*
+ WildcardImport:TrashAdapter.kt$import org.fossify.commons.extensions.*
+ WildcardImport:TrashFragment.kt$import org.fossify.commons.extensions.*
+ WildcardImport:WidgetRecordDisplayConfigureActivity.kt$import org.fossify.commons.extensions.*
+
+
diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml
new file mode 100644
index 00000000..64a3b10e
--- /dev/null
+++ b/app/lint-baseline.xml
@@ -0,0 +1,704 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build.gradle.kts b/build.gradle.kts
index 9a736eea..b7bc0032 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -2,4 +2,5 @@ plugins {
alias(libs.plugins.android).apply(false)
alias(libs.plugins.kotlinAndroid).apply(false)
alias(libs.plugins.ksp).apply(false)
+ alias(libs.plugins.detekt).apply(false)
}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index aeb0ae0a..dd92fde0 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -3,6 +3,8 @@
kotlin = "1.9.21"
#KSP
ksp = "1.9.21-1.0.16"
+#Detekt
+detekt = "1.23.3"
#AndroidX
androidx-constraintlayout = "2.1.4"
androidx-documentfile = "1.0.1"
@@ -48,3 +50,4 @@ autofittextview = { module = "me.grantland:autofittextview", version.ref = "auto
android = { id = "com.android.application", version.ref = "gradlePlugins-agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
+detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }