aboutsummaryrefslogtreecommitdiff
path: root/detekt-baselines
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-07-23 03:15:29 +0530
committerGitHub <noreply@github.com>2022-07-22 21:45:29 +0000
commit6d0bff144c35c9f2c73f34065e972b3f48a34241 (patch)
tree674da15806a0f97641cb90ac3dcc0e96dfe6bcf5 /detekt-baselines
parent9a3c18234883d10fb2391e7bad6c06ff4f16f9b3 (diff)
Begin cleaning up Detekt warnings (#2027)
Diffstat (limited to 'detekt-baselines')
-rw-r--r--detekt-baselines/app.xml35
-rw-r--r--detekt-baselines/autofill-parser.xml21
-rw-r--r--detekt-baselines/coroutine-utils.xml5
3 files changed, 3 insertions, 58 deletions
diff --git a/detekt-baselines/app.xml b/detekt-baselines/app.xml
index be37b720..a82c325e 100644
--- a/detekt-baselines/app.xml
+++ b/detekt-baselines/app.xml
@@ -35,59 +35,28 @@
<ID>LongMethod:RepositorySettings.kt$RepositorySettings$override fun provideSettings(builder: PreferenceScreen.Builder)</ID>
<ID>LoopWithTooManyJumpStatements:AutofillMatcher.kt$AutofillMatcher.Companion$for ((key, value) in prefs.all) { if (!key.startsWith(PREFERENCE_PREFIX_MATCHES)) continue // We know that preferences starting with `PREFERENCE_PREFIX_MATCHES` were // created with `putStringSet`. @Suppress("UNCHECKED_CAST") val oldMatches = value as? Set&lt;String> if (oldMatches == null) { logcat(WARN) { "Failed to read matches for $key" } continue } // Delete all matches for file locations that are going to be overwritten, then // transfer matches over to the files at their new locations. val newMatches = oldMatches .asSequence() .minus(deletePathList) .minus(oldNewPathMap.values) .map { match -> val newPath = oldNewPathMap[match] ?: return@map match logcat { "Updating match for $key: $match --> $newPath" } newPath } .toSet() if (newMatches != oldMatches) prefs.edit { putStringSet(key, newMatches) } }</ID>
<ID>LoopWithTooManyJumpStatements:ErrorMessages.kt$ErrorMessages$while (cause.cause != null) { if (cause is GitException) break val nextCause = cause.cause!! if (nextCause is RemoteException) break cause = nextCause }</ID>
- <ID>MagicNumber:Api30AutofillResponseBuilder.kt$Api30AutofillResponseBuilder$30</ID>
- <ID>MagicNumber:AutofillDecryptActivity.kt$AutofillDecryptActivity$26</ID>
- <ID>MagicNumber:AutofillDecryptActivity.kt$AutofillDecryptActivity.Companion$31</ID>
- <ID>MagicNumber:AutofillFilterView.kt$AutofillFilterView$26</ID>
- <ID>MagicNumber:AutofillFilterView.kt$AutofillFilterView.Companion$31</ID>
- <ID>MagicNumber:AutofillPreferences.kt$DirectoryStructure$26</ID>
- <ID>MagicNumber:AutofillPublisherChangedActivity.kt$AutofillPublisherChangedActivity$26</ID>
- <ID>MagicNumber:AutofillPublisherChangedActivity.kt$AutofillPublisherChangedActivity.Companion$31</ID>
- <ID>MagicNumber:AutofillResponseBuilder.kt$AutofillResponseBuilder$26</ID>
- <ID>MagicNumber:AutofillResponseBuilder.kt$AutofillResponseBuilder$28</ID>
- <ID>MagicNumber:AutofillResponseBuilder.kt$AutofillResponseBuilder.Companion$28</ID>
- <ID>MagicNumber:AutofillSaveActivity.kt$AutofillSaveActivity$26</ID>
- <ID>MagicNumber:AutofillSettings.kt$AutofillSettings$26</ID>
- <ID>MagicNumber:AutofillViewUtils.kt$30</ID>
- <ID>MagicNumber:AutofillViewUtils.kt$31</ID>
- <ID>MagicNumber:BasePgpActivity.kt$BasePgpActivity$26</ID>
<ID>MagicNumber:BasePgpActivity.kt$BasePgpActivity$45</ID>
<ID>MagicNumber:ClipboardService.kt$ClipboardService$1000</ID>
<ID>MagicNumber:ClipboardService.kt$ClipboardService$1000L</ID>
- <ID>MagicNumber:ClipboardService.kt$ClipboardService$23</ID>
- <ID>MagicNumber:ClipboardService.kt$ClipboardService$24</ID>
- <ID>MagicNumber:ClipboardService.kt$ClipboardService$26</ID>
- <ID>MagicNumber:ClipboardService.kt$ClipboardService$31</ID>
<ID>MagicNumber:ClipboardService.kt$ClipboardService$45</ID>
<ID>MagicNumber:ClipboardService.kt$ClipboardService$500</ID>
<ID>MagicNumber:DicewareModule.kt$DicewareModule$6</ID>
<ID>MagicNumber:DicewarePasswordGeneratorDialogFragment.kt$DicewarePasswordGeneratorDialogFragment$5</ID>
<ID>MagicNumber:Extensions.kt$1000</ID>
- <ID>MagicNumber:GeneralSettings.kt$GeneralSettings$25</ID>
<ID>MagicNumber:GitConfigActivity.kt$GitConfigActivity$0.5f</ID>
<ID>MagicNumber:GitConfigActivity.kt$GitConfigActivity$500</ID>
<ID>MagicNumber:GitConfigActivity.kt$GitConfigActivity$8</ID>
<ID>MagicNumber:GitLogAdapter.kt$8</ID>
<ID>MagicNumber:GitServerConfigActivity.kt$GitServerConfigActivity$500</ID>
<ID>MagicNumber:LaunchActivity.kt$LaunchActivity$500L</ID>
- <ID>MagicNumber:OreoAutofillService.kt$OreoAutofillService$26</ID>
- <ID>MagicNumber:OreoAutofillService.kt$OreoAutofillService$28</ID>
- <ID>MagicNumber:OreoAutofillService.kt$OreoAutofillService$30</ID>
- <ID>MagicNumber:PasswordCreationActivity.kt$PasswordCreationActivity$28</ID>
<ID>MagicNumber:PasswordExportService.kt$PasswordExportService$1024</ID>
- <ID>MagicNumber:PasswordExportService.kt$PasswordExportService$26</ID>
<ID>MagicNumber:PasswordGeneratorDialogFragment.kt$PasswordGeneratorDialogFragment$20</ID>
<ID>MagicNumber:PasswordItemRecyclerAdapter.kt$PasswordItemRecyclerAdapter.PasswordItemViewHolder$0.7f</ID>
- <ID>MagicNumber:ProxySelectorActivity.kt$ProxySelectorActivity$29</ID>
<ID>MagicNumber:ProxySelectorActivity.kt$ProxySelectorActivity$500</ID>
- <ID>MagicNumber:RepositorySettings.kt$RepositorySettings$25</ID>
- <ID>MagicNumber:ShortcutHandler.kt$ShortcutHandler$25</ID>
- <ID>MagicNumber:ShortcutHandler.kt$ShortcutHandler$26</ID>
<ID>MagicNumber:SshKey.kt$SshKey$100_000</ID>
<ID>MagicNumber:SshKey.kt$SshKey$15</ID>
<ID>MagicNumber:SshKey.kt$SshKey$30</ID>
<ID>MagicNumber:SshKey.kt$SshKey.Algorithm.Ecdsa$256</ID>
- <ID>MagicNumber:SshKey.kt$SshKey.Algorithm.Ecdsa$28</ID>
<ID>MagicNumber:SshKey.kt$SshKey.Algorithm.Rsa$3072</ID>
<ID>MagicNumber:SshjSessionFactory.kt$SshjSession$22</ID>
<ID>MagicNumber:UriTotpFinder.kt$UriTotpFinder$30</ID>
@@ -124,9 +93,7 @@
<ID>ThrowsCount:GitCommandExecutor.kt$GitCommandExecutor$suspend fun execute(): Result&lt;Unit, Throwable></ID>
<ID>ThrowsCount:SshKey.kt$SshKey$fun import(uri: Uri)</ID>
<ID>TooManyFunctions:PasswordStore.kt$PasswordStore : BaseGitActivity</ID>
- <ID>TooManyFunctions:SearchableRepositoryViewModel.kt$SearchableRepositoryViewModel : AndroidViewModel</ID>
<ID>TooManyFunctions:SshjConfig.kt$AbstractLogger : Logger</ID>
- <ID>TooManyFunctions:SshjConfig.kt$LogcatLoggerFactory$LogcatLogger : AbstractLogger</ID>
<ID>TopLevelPropertyNaming:AutofillMatcher.kt$private const val PREFERENCES_AUTOFILL_APP_MATCHES = "oreo_autofill_app_matches"</ID>
<ID>TopLevelPropertyNaming:AutofillMatcher.kt$private const val PREFERENCES_AUTOFILL_WEB_MATCHES = "oreo_autofill_web_matches"</ID>
<ID>TopLevelPropertyNaming:Extensions.kt$/** The default OpenPGP provider for the app */ const val OPENPGP_PROVIDER = "org.sufficientlysecure.keychain"</ID>
@@ -134,8 +101,6 @@
<ID>TopLevelPropertyNaming:SshKey.kt$private const val ANDROIDX_SECURITY_KEYSET_PREF_NAME = "androidx_sshkey_keyset_prefs"</ID>
<ID>TopLevelPropertyNaming:SshKey.kt$private const val KEYSTORE_ALIAS = "sshkey"</ID>
<ID>TopLevelPropertyNaming:SshKey.kt$private const val PROVIDER_ANDROID_KEY_STORE = "AndroidKeyStore"</ID>
- <ID>UnusedPrivateMember:PasswordStore.kt$PasswordStore$private val directorySelectAction = registerForActivityResult(StartActivityForResult()) { result -> if (result.resultCode == RESULT_OK) { checkLocalRepository() } }</ID>
- <ID>UnusedPrivateMember:PasswordStore.kt$PasswordStore$private val storagePermissionRequest = registerForActivityResult(RequestPermission()) { granted -> if (granted) checkLocalRepository() }</ID>
<ID>UseCheckOrError:CredentialFinder.kt$CredentialFinder$throw IllegalStateException("Only SshKey and Password connection mode ask for passwords")</ID>
<ID>UseCheckOrError:FragmentViewBindingDelegate.kt$FragmentViewBindingDelegate$throw IllegalStateException( "Should not attempt to get bindings when Fragment views are destroyed." )</ID>
<ID>UseCheckOrError:GitOperation.kt$GitOperation$throw IllegalStateException("Biometric authentication failures should be ignored")</ID>
diff --git a/detekt-baselines/autofill-parser.xml b/detekt-baselines/autofill-parser.xml
index a7726c93..83f3316f 100644
--- a/detekt-baselines/autofill-parser.xml
+++ b/detekt-baselines/autofill-parser.xml
@@ -11,30 +11,9 @@
<ID>LoopWithTooManyJumpStatements:AutofillStrategyDsl.kt$PairOfFieldsMatcher$for ((i, tieBreaker) in tieBreakers.withIndex()) { val new = current.filter { tieBreaker(it, alreadyMatched) } if (new.isEmpty()) { logcat { "Tie breaker #${i + 1}: Didn't match any pair of fields; skipping" } continue } // and return if the available options have been narrowed to a single field. if (new.size == 1) { logcat { "Tie breaker #${i + 1}: Success" } current = new break } logcat { "Tie breaker #${i + 1}: Matched ${new.size} pairs of fields; continuing" } current = new }</ID>
<ID>LoopWithTooManyJumpStatements:AutofillStrategyDsl.kt$SingleFieldMatcher$for ((i, tieBreaker) in tieBreakers.withIndex()) { // Successively filter matched fields via tie breakers... val new = current.filter { tieBreaker(it, alreadyMatched) } // skipping those tie breakers that are not satisfied for any remaining field... if (new.isEmpty()) { logcat { "Tie breaker #${i + 1}: Didn't match any field; skipping" } continue } // and return if the available options have been narrowed to a single field. if (new.size == 1) { logcat { "Tie breaker #${i + 1}: Success" } current = new break } logcat { "Tie breaker #${i + 1}: Matched ${new.size} fields; continuing" } current = new }</ID>
<ID>LoopWithTooManyJumpStatements:ByteArray.kt$while (true) { val byte0 = if (expectDot) { expectDot = false '.'.code.toByte() } else { labels[currentLabelIndex][currentLabelByteIndex] and BITMASK } val byte1 = this[start + publicSuffixByteIndex] and BITMASK // Compare the bytes. Note that the file stores UTF-8 encoded bytes, so we must compare // the // unsigned bytes. compareResult = (byte0.toUByte() - byte1.toUByte()).toInt() if (compareResult != 0) { break } publicSuffixByteIndex++ currentLabelByteIndex++ if (publicSuffixByteIndex == publicSuffixLength) { break } if (labels[currentLabelIndex].size == currentLabelByteIndex) { // We've exhausted our current label. Either there are more labels to compare, in // which // case we expect a dot as the next character. Otherwise, we've checked all our // labels. if (currentLabelIndex == labels.size - 1) { break } else { currentLabelIndex++ currentLabelByteIndex = -1 expectDot = true } } }</ID>
- <ID>MagicNumber:AutofillFormParser.kt$AutofillFormParser$26</ID>
- <ID>MagicNumber:AutofillFormParser.kt$FillableForm$26</ID>
- <ID>MagicNumber:AutofillHelper.kt$26</ID>
- <ID>MagicNumber:AutofillHelper.kt$28</ID>
- <ID>MagicNumber:AutofillHelper.kt$FixedSaveCallback$26</ID>
- <ID>MagicNumber:AutofillHelper.kt$FixedSaveCallback$28</ID>
<ID>MagicNumber:AutofillHelper.kt$FixedSaveCallback$29</ID>
- <ID>MagicNumber:AutofillScenario.kt$26</ID>
<ID>MagicNumber:AutofillScenario.kt$4</ID>
<ID>MagicNumber:AutofillScenario.kt$5</ID>
- <ID>MagicNumber:AutofillScenario.kt$AutofillScenario$26</ID>
- <ID>MagicNumber:AutofillScenario.kt$ClassifiedAutofillScenario$26</ID>
- <ID>MagicNumber:AutofillScenario.kt$GenericAutofillScenario$26</ID>
- <ID>MagicNumber:AutofillStrategyDsl.kt$26</ID>
- <ID>MagicNumber:AutofillStrategyDsl.kt$AutofillRule$26</ID>
- <ID>MagicNumber:AutofillStrategyDsl.kt$AutofillStrategy$26</ID>
- <ID>MagicNumber:AutofillStrategyDsl.kt$FieldMatcher$26</ID>
- <ID>MagicNumber:AutofillStrategyDsl.kt$PairOfFieldsMatcher$26</ID>
- <ID>MagicNumber:AutofillStrategyDsl.kt$SingleFieldMatcher$26</ID>
- <ID>MagicNumber:FeatureAndTrustDetection.kt$26</ID>
- <ID>MagicNumber:FeatureAndTrustDetection.kt$28</ID>
- <ID>MagicNumber:FormField.kt$FormField$26</ID>
- <ID>MagicNumber:FormField.kt$FormField.Companion$26</ID>
- <ID>MagicNumber:PublicSuffixListCache.kt$29</ID>
<ID>MaxLineLength:FeatureAndTrustDetection.kt$/* In order to add a new browser, do the following: 1. Obtain the .apk from a trusted source. For example, download it from the Play Store on your phone and use adb pull to get it onto your computer. We will assume that it is called browser.apk. 2. Run aapt dump badging browser.apk | grep package: | grep -Eo " name='[a-zA-Z0-9_\.]*" | cut -c8- to obtain the package name (actually, the application ID) of the app in the .apk. 3. Run apksigner verify --print-certs browser.apk | grep "#1 certificate SHA-256" | grep -Eo "[a-f0-9]{64}" | tr -d '\n' | xxd -r -p | base64 to calculate the hash of browser.apk's first signing certificate. Note: This will only work if the apk has a single signing certificate. Apps with multiple signers are very rare, so there is probably no need to add them. Refer to computeCertificatesHash to learn how the hash would be computed in this case. 4. Verify the package name and the hash, for example by asking other people to repeat the steps above. 5. Add an entry with the browser apps's package name and the hash to TRUSTED_BROWSER_CERTIFICATE_HASH. 6. Optionally, try adding the browser's package name to BROWSERS_WITH_SAVE_SUPPORT and check whether a save request to Password Store is triggered when you submit a registration form. 7. Optionally, try adding the browser's package name to BROWSERS_WITH_MULTI_ORIGIN_SUPPORT and check whether it correctly distinguishes web origins even if iframes are present on the page. You can use https://fabianhenneke.github.io/Android-Password-Store/ as a test form. */</ID>
<ID>MaxLineLength:FormField.kt$FormField$"\"$hint\", \"$fieldId\"${if (isFocused) ", focused" else ""}${if (isVisible) ", visible" else ""}, $webOrigin, $htmlAttributesDebug, $autofillHints"</ID>
<ID>ReturnCount:AutofillFormParser.kt$AutofillFormParser$private fun determineFormOrigin(context: Context): FormOrigin?</ID>
diff --git a/detekt-baselines/coroutine-utils.xml b/detekt-baselines/coroutine-utils.xml
index 1d920d34..6d7bc820 100644
--- a/detekt-baselines/coroutine-utils.xml
+++ b/detekt-baselines/coroutine-utils.xml
@@ -1,8 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<SmellBaseline>
- <ManuallySuppressedIssues/>
+ <ManuallySuppressedIssues>
+ <ID>TooGenericExceptionCaught:RunSuspendCatching.kt$e: Throwable</ID>
+ </ManuallySuppressedIssues>
<CurrentIssues>
- <ID>InstanceOfCheckForException:RunSuspendCatching.kt$e is CancellationException</ID>
<ID>TooGenericExceptionCaught:RunSuspendCatching.kt$e: Throwable</ID>
</CurrentIssues>
</SmellBaseline>