diff --git a/.github/workflows/update-lint-baselines.yml b/.github/workflows/update-lint-baselines.yml new file mode 100644 index 000000000..17043a588 --- /dev/null +++ b/.github/workflows/update-lint-baselines.yml @@ -0,0 +1,11 @@ +name: Update lint baselines + +on: + workflow_dispatch: + schedule: + - cron: "0 0 1 * *" + +jobs: + update-lint-baselines: + uses: FossifyOrg/.github/.github/workflows/update-lint-baselines.yml@main + secrets: inherit diff --git a/.gitignore b/.gitignore index d209458ca..72ae8c3bc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ keystore.jks keystore.properties fastlane/fastlane.json fastlane/report.xml +.kotlin/ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 54b8695ac..1d0920676 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,6 +1,7 @@ -import java.io.FileInputStream +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.konan.properties.Properties +import java.io.FileInputStream plugins { alias(libs.plugins.android) @@ -101,7 +102,9 @@ android { } tasks.withType { - kotlinOptions.jvmTarget = project.libs.versions.app.build.kotlinJVMTarget.get() + compilerOptions.jvmTarget.set( + JvmTarget.fromTarget(project.libs.versions.app.build.kotlinJVMTarget.get()) + ) } namespace = project.property("APP_ID").toString() @@ -109,8 +112,9 @@ android { lint { checkReleaseBuilds = false abortOnError = true - warningsAsErrors = true + warningsAsErrors = false baseline = file("lint-baseline.xml") + lintConfig = rootProject.file("lint.xml") } bundle { diff --git a/app/detekt-baseline.xml b/app/detekt-baseline.xml index e16cb805f..cf6c40f78 100644 --- a/app/detekt-baseline.xml +++ b/app/detekt-baseline.xml @@ -1,10 +1,7 @@ - + - ComplexCondition:MainActivity.kt$MainActivity$config.showNotePicker && savedInstanceState == null && hasNoIntent && !mIsPasswordProtectionPending - ComplexCondition:MainActivity.kt$MainActivity$requestCode == PICK_EXPORT_FILE_INTENT && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null && mNotes.isNotEmpty() - ComplexCondition:MainActivity.kt$MainActivity$requestCode == PICK_OPEN_FILE_INTENT && resultCode == RESULT_OK && resultData != null && resultData.data != null ComplexCondition:TextFragment.kt$TextFragment$config.showKeyboard && isMenuVisible && (!note!!.isLocked() || shouldShowLockedContent) CyclomaticComplexMethod:MainActivity.kt$MainActivity$private fun refreshMenuItems() CyclomaticComplexMethod:MainActivity.kt$MainActivity$private fun setupOptionsMenu() @@ -47,28 +44,8 @@ MaxLineLength:ExportNotesDialog.kt$ExportNotesDialog$activity.getAlertDialogBuilder().setPositiveButton(org.fossify.commons.R.string.ok, null).setNegativeButton(org.fossify.commons.R.string.cancel, null) MaxLineLength:ImportFolderDialog.kt$ImportFolderDialog$class MaxLineLength:MainActivity.kt$MainActivity$!config.autosaveNotes && showSaveButton && (::mCurrentNote.isInitialized && mCurrentNote.type == NoteType.TYPE_TEXT) - MaxLineLength:MainActivity.kt$MainActivity$(drawable as LayerDrawable).findDrawableByLayerId(R.id.shortcut_plus_background).applyColorFilter(appIconColor) MaxLineLength:MainActivity.kt$MainActivity$// if we got here by some other app invoking the file open intent, we have no permission for updating the original file itself - MaxLineLength:MainActivity.kt$MainActivity$ConfirmationDialog - MaxLineLength:MainActivity.kt$MainActivity$Note(null, title.substringBeforeLast('.'), fileText, NoteType.TYPE_CHECKLIST, "", PROTECTION_NONE, "") - MaxLineLength:MainActivity.kt$MainActivity$displayNewNoteDialog(note.value, title = it.title, it.path, setChecklistAsDefault = true) - MaxLineLength:MainActivity.kt$MainActivity$faqItems.add(FAQItem(org.fossify.commons.R.string.faq_10_title_commons, org.fossify.commons.R.string.faq_10_text_commons)) - 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$faqItems.add(FAQItem(org.fossify.commons.R.string.faq_7_title_commons, org.fossify.commons.R.string.faq_7_text_commons)) - MaxLineLength:MainActivity.kt$MainActivity$findItem(R.id.lock_note).isVisible = mNotes.isNotEmpty() && (::mCurrentNote.isInitialized && !mCurrentNote.isLocked()) - 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$findItem(R.id.unlock_note).isVisible = mNotes.isNotEmpty() && (::mCurrentNote.isInitialized && mCurrentNote.isLocked()) - MaxLineLength:MainActivity.kt$MainActivity$fun - MaxLineLength:MainActivity.kt$MainActivity$getPagerAdapter().updateCurrentNoteData(binding.viewPager.currentItem, mCurrentNote.path, mCurrentNote.value) MaxLineLength:MainActivity.kt$MainActivity$if - MaxLineLength:MainActivity.kt$MainActivity$intent.flags = intent.flags or Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NO_HISTORY - MaxLineLength:MainActivity.kt$MainActivity$private - MaxLineLength:MainActivity.kt$MainActivity$private fun isCurrentItemChecklist() - MaxLineLength:MainActivity.kt$MainActivity$updateMaterialActivityViews(binding.mainCoordinator, null, useTransparentNavigation = false, useTopSearchMenu = false) - MaxLineLength:MainActivity.kt$MainActivity$val newChecklist = Note(null, getCurrentFormattedDateTime(), "", NoteType.TYPE_CHECKLIST, "", PROTECTION_NONE, "") - MaxLineLength:MainActivity.kt$MainActivity$val newTextNote = Note(null, getCurrentFormattedDateTime(), "", NoteType.TYPE_TEXT, "", PROTECTION_NONE, "") - MaxLineLength:MainActivity.kt$MainActivity$} MaxLineLength:MyWidgetProvider.kt$MyWidgetProvider$PendingIntent.getActivity(context, widgetId, startActivityIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) MaxLineLength:MyWidgetProvider.kt$MyWidgetProvider$val pendingIntent = PendingIntent.getActivity(context, widget.widgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) MaxLineLength:NewChecklistItemDialog.kt$NewChecklistItemDialog$if @@ -87,12 +64,6 @@ MaxLineLength:RenameNoteDialog.kt$RenameNoteDialog$class MaxLineLength:SettingsActivity.kt$SettingsActivity$NotesHelper.ImportResult.IMPORT_PARTIAL -> toast(org.fossify.commons.R.string.importing_some_entries_failed) MaxLineLength:SettingsActivity.kt$SettingsActivity$binding.settingsUseEnglishHolder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus()) - MaxLineLength:SettingsActivity.kt$SettingsActivity$org.fossify.commons.R.string.fingerprint_setup_successfully - MaxLineLength:SettingsActivity.kt$SettingsActivity$updateMaterialActivityViews(binding.settingsCoordinator, binding.settingsHolder, useTransparentNavigation = true, useTopSearchMenu = false) - MaxLineLength:SettingsActivity.kt$SettingsActivity$val items = listOf(GRAVITY_START, GRAVITY_CENTER, GRAVITY_END).map { RadioItem(it, getGravityOptionLabel(it)) } - MaxLineLength:SettingsActivity.kt$SettingsActivity$val leftToRightDirection = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_LTR - MaxLineLength:TasksAdapter.kt$TasksAdapter$menu.findItem(R.id.cab_move_to_bottom).isVisible = selectedItems.none { it.isDone } || !activity.config.moveDoneChecklistItems - MaxLineLength:TasksAdapter.kt$TasksAdapter$menu.findItem(R.id.cab_move_to_top).isVisible = selectedItems.none { it.isDone } || !activity.config.moveDoneChecklistItems MaxLineLength:TasksAdapter.kt$TasksAdapter$private fun getSelectedItems() MaxLineLength:TasksAdapter.kt$TasksAdapter$text = resources.getQuantityString(R.plurals.num_checked_items, completedTasks.tasks.size, completedTasks.tasks.size) MaxLineLength:TasksFragment.kt$TasksFragment$note.getNoteStoredValue(requireActivity())?.split("\n")?.map { it.trim() }?.filter { it.isNotBlank() } @@ -109,7 +80,6 @@ MaxLineLength:WidgetConfigureActivity.kt$WidgetConfigureActivity$val sampleValue = if (note.value.isEmpty() || mIsCustomizingColors) getString(R.string.widget_config) else note.value NestedBlockDepth:MainActivity.kt$MainActivity$private fun checkIntents(intent: Intent) NestedBlockDepth:Note.kt$Note$fun getNoteStoredValue(context: Context): String? - NestedBlockDepth:OpenNoteAdapter.kt$OpenNoteAdapter$private fun Note.getFormattedValue(context: Context): CharSequence? NestedBlockDepth:TasksFragment.kt$TasksFragment$private fun prepareTaskItems(): List<NoteItem> ReturnCount:TasksFragment.kt$TasksFragment$private fun saveNote(callback: () -> Unit = {}) ReturnCount:TextFragment.kt$TextFragment$fun saveText(force: Boolean, callback: ((note: Note) -> Unit)? = null) @@ -150,12 +120,6 @@ WildcardImport:ExportFilesDialog.kt$import org.fossify.commons.extensions.* WildcardImport:ExportNotesDialog.kt$import org.fossify.commons.extensions.* WildcardImport:ImportFolderDialog.kt$import org.fossify.commons.extensions.* - WildcardImport:MainActivity.kt$import org.fossify.commons.dialogs.* - WildcardImport:MainActivity.kt$import org.fossify.commons.extensions.* - WildcardImport:MainActivity.kt$import org.fossify.commons.helpers.* - WildcardImport:MainActivity.kt$import org.fossify.notes.dialogs.* - WildcardImport:MainActivity.kt$import org.fossify.notes.extensions.* - WildcardImport:MainActivity.kt$import org.fossify.notes.helpers.* WildcardImport:ManageAutoBackupsDialog.kt$import org.fossify.commons.extensions.* WildcardImport:NewChecklistItemDialog.kt$import org.fossify.commons.extensions.* WildcardImport:NewNoteDialog.kt$import org.fossify.commons.extensions.* @@ -164,10 +128,6 @@ WildcardImport:NotesDao.kt$import androidx.room.* WildcardImport:OpenNoteAdapter.kt$import org.fossify.commons.extensions.* WildcardImport:RenameNoteDialog.kt$import org.fossify.commons.extensions.* - WildcardImport:SettingsActivity.kt$import org.fossify.commons.extensions.* - WildcardImport:SettingsActivity.kt$import org.fossify.commons.helpers.* - WildcardImport:SettingsActivity.kt$import org.fossify.notes.extensions.* - WildcardImport:SettingsActivity.kt$import org.fossify.notes.helpers.* WildcardImport:TasksFragment.kt$import org.fossify.commons.extensions.* WildcardImport:TextFragment.kt$import org.fossify.commons.extensions.* WildcardImport:UnlockNotesDialog.kt$import org.fossify.commons.extensions.* diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index dea0335ad..6d763b48f 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -1,66 +1,22 @@ - + - - - - - - - - - - - - - - - - + id="NotificationPermission" + message="When targeting Android 13 or higher, posting a permission requires holding the `POST_NOTIFICATIONS` permission (usage from org.fossify.commons.asynctasks.CopyMoveTask)"> + file="src/main/AndroidManifest.xml"/> + id="OldTargetApi" + message="Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the `android.os.Build.VERSION_CODES` javadoc for details." + errorLine1="app-build-targetSDK = "34"" + errorLine2=" ~~~~"> + file="$HOME/Projects/Fossify/FossifyOrg/Notes/gradle/libs.versions.toml" + line="20" + column="23"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + message="A newer version of Gradle than 8.11.1 is available: 8.14.2" + errorLine1="distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> - - - - + column="17"/> + message="A newer version of androidx.room:room-compiler than 2.7.1 is available: 2.7.2" + errorLine1="room = "2.7.1"" + errorLine2=" ~~~~~~~"> + file="$HOME/Projects/Fossify/FossifyOrg/Notes/gradle/libs.versions.toml" + line="13" + column="8"/> + message="A newer version of androidx.room:room-ktx than 2.7.1 is available: 2.7.2" + errorLine1="room = "2.7.1"" + errorLine2=" ~~~~~~~"> + file="$HOME/Projects/Fossify/FossifyOrg/Notes/gradle/libs.versions.toml" + line="13" + column="8"/> + message="A newer version of androidx.room:room-runtime than 2.7.1 is available: 2.7.2" + errorLine1="room = "2.7.1"" + errorLine2=" ~~~~~~~"> + file="$HOME/Projects/Fossify/FossifyOrg/Notes/gradle/libs.versions.toml" + line="13" + column="8"/> + message="A newer version of org.fossify:commons than 3.0.5 is available: 3.1.0" + errorLine1="commons = "3.0.5"" + errorLine2=" ~~~~~~~"> + message="A newer version of `compileSdkVersion` than 34 is available: 35" + errorLine1="app-build-compileSDKVersion = "34"" + errorLine2=" ~~~~"> + file="$HOME/Projects/Fossify/FossifyOrg/Notes/gradle/libs.versions.toml" + line="19" + column="31"/> - - - - - - - - - - - - + + + + @@ -1230,14 +1043,54 @@ + id="ExtraTranslation" + message=""num_checked_items" is translated here but not found in default locale" + errorLine1=" <string name="num_checked_items">%d zaškrtnutých položek</string>" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~"> + file="src/main/res/values-cs/strings.xml" + line="79" + column="13"/> + + + + + + + + + + + + + + + + + + + + + errorLine1=" shortcutManager.dynamicShortcuts = listOf(newTextNote, newChecklist)" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1489,10 +1628,21 @@ errorLine2=" ~~~~~~~~~"> + + + + @@ -1515,15 +1665,4 @@ column="9"/> - - - - diff --git a/lint.xml b/lint.xml new file mode 100644 index 000000000..05685cd8e --- /dev/null +++ b/lint.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +