diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-11-27 13:10:34 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2022-11-27 13:28:46 +0530 |
commit | 30b91b6447704b6ef000972c963078f0eedf5ebf (patch) | |
tree | 231ee5516f2b9243e0160fe07d3e069faea83b65 /detekt-baselines/random.xml | |
parent | d4dd147c25b8fe38d4d4ae567237eb9265e62df0 (diff) |
chore: re-roll Detekt baselines
Diffstat (limited to 'detekt-baselines/random.xml')
-rw-r--r-- | detekt-baselines/random.xml | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/detekt-baselines/random.xml b/detekt-baselines/random.xml index 345a7f94..d4728260 100644 --- a/detekt-baselines/random.xml +++ b/detekt-baselines/random.xml @@ -1,12 +1,10 @@ -<?xml version='1.0' encoding='UTF-8'?> +<?xml version="1.0" ?> <SmellBaseline> - <ManuallySuppressedIssues/> + <ManuallySuppressedIssues></ManuallySuppressedIssues> <CurrentIssues> - <ID>ComplexCondition:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$!candidate.flags.hasFlag(nextBasicType) || (isStartOfPart && candidate.flags hasFlag NOT_FIRST) || // Don't let a diphthong that starts with a vowel follow a vowel. (previousFlags hasFlag VOWEL && candidate.flags hasFlag VOWEL && candidate.flags hasFlag DIPHTHONG) || // Don't add multi-character candidates if we would go over the targetLength. (password.length + candidate.length > targetLength) || (pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && candidate.isAmbiguous)</ID> - <ID>ComplexMethod:PasswordGenerator.kt$PasswordGenerator$@Throws(PasswordGeneratorException::class) public fun generate(passwordOptions: List<PasswordOption>, length: Int = DEFAULT_LENGTH): String</ID> - <ID>ComplexMethod:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$fun generate(targetLength: Int, pwFlags: Int): String?</ID> + <ID>ComplexCondition:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$!candidate.flags.hasFlag(nextBasicType) || (isStartOfPart && candidate.flags hasFlag NOT_FIRST) || // Don't let a diphthong that starts with a vowel follow a vowel. (previousFlags hasFlag VOWEL && candidate.flags hasFlag VOWEL && candidate.flags hasFlag DIPHTHONG) || // Don't add multi-character candidates if we would go over the targetLength. (password.length + candidate.length > targetLength) || (pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && candidate.isAmbiguous)</ID> <ID>LongMethod:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$fun generate(targetLength: Int, pwFlags: Int): String?</ID> - <ID>LoopWithTooManyJumpStatements:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$while (password.length < targetLength) { // First part: Add a single letter or pronounceable pair of letters in varying case. val candidate = elements.secureRandomElement() // Reroll if the candidate does not fulfill the current requirements. if ( !candidate.flags.hasFlag(nextBasicType) || (isStartOfPart && candidate.flags hasFlag NOT_FIRST) || // Don't let a diphthong that starts with a vowel follow a vowel. (previousFlags hasFlag VOWEL && candidate.flags hasFlag VOWEL && candidate.flags hasFlag DIPHTHONG) || // Don't add multi-character candidates if we would go over the targetLength. (password.length + candidate.length > targetLength) || (pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && candidate.isAmbiguous) ) { continue } // At this point the candidate could be appended to the password, but we still have // to determine the case. If no upper case characters are required, we don't add // any. val useUpperIfBothCasesAllowed = (isStartOfPart || candidate.flags hasFlag CONSONANT) && secureRandomBiasedBoolean(20) password += if ( pwFlags hasFlag PasswordGenerator.UPPERS && (!(pwFlags hasFlag PasswordGenerator.LOWERS) || useUpperIfBothCasesAllowed) ) { candidate.upperCase } else { candidate.lowerCase } // We ensured above that we will not go above the target length. check(password.length <= targetLength) if (password.length == targetLength) break // Second part: Add digits and symbols with a certain probability (if requested) if // they would not directly follow the first character in a pronounceable part. if ( !isStartOfPart && pwFlags hasFlag PasswordGenerator.DIGITS && secureRandomBiasedBoolean(30) ) { var randomDigit: Char do { randomDigit = secureRandomNumber(10).toString(10).first() } while ( pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && randomDigit in PasswordGenerator.AMBIGUOUS_STR ) password += randomDigit // Begin a new pronounceable part after every digit. isStartOfPart = true nextBasicType = if (secureRandomBoolean()) VOWEL else CONSONANT previousFlags = 0 continue } if ( !isStartOfPart && pwFlags hasFlag PasswordGenerator.SYMBOLS && secureRandomBiasedBoolean(20) ) { var randomSymbol: Char do { randomSymbol = PasswordGenerator.SYMBOLS_STR.secureRandomCharacter() } while ( pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && randomSymbol in PasswordGenerator.AMBIGUOUS_STR ) password += randomSymbol // Continue the password generation as if nothing was added. } // Third part: Determine the basic type of the next character depending on the letter // we just added. nextBasicType = when { candidate.flags.hasFlag(CONSONANT) -> VOWEL previousFlags.hasFlag(VOWEL) || candidate.flags.hasFlag(DIPHTHONG) || secureRandomBiasedBoolean(60) -> CONSONANT else -> VOWEL } previousFlags = candidate.flags isStartOfPart = false }</ID> + <ID>LoopWithTooManyJumpStatements:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$while (password.length < targetLength) { // First part: Add a single letter or pronounceable pair of letters in varying case. val candidate = elements.secureRandomElement() // Reroll if the candidate does not fulfill the current requirements. if ( !candidate.flags.hasFlag(nextBasicType) || (isStartOfPart && candidate.flags hasFlag NOT_FIRST) || // Don't let a diphthong that starts with a vowel follow a vowel. (previousFlags hasFlag VOWEL && candidate.flags hasFlag VOWEL && candidate.flags hasFlag DIPHTHONG) || // Don't add multi-character candidates if we would go over the targetLength. (password.length + candidate.length > targetLength) || (pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && candidate.isAmbiguous) ) { continue } // At this point the candidate could be appended to the password, but we still have // to determine the case. If no upper case characters are required, we don't add // any. val useUpperIfBothCasesAllowed = (isStartOfPart || candidate.flags hasFlag CONSONANT) && secureRandomBiasedBoolean(20) password += if ( pwFlags hasFlag PasswordGenerator.UPPERS && (!(pwFlags hasFlag PasswordGenerator.LOWERS) || useUpperIfBothCasesAllowed) ) { candidate.upperCase } else { candidate.lowerCase } // We ensured above that we will not go above the target length. check(password.length <= targetLength) if (password.length == targetLength) break // Second part: Add digits and symbols with a certain probability (if requested) if // they would not directly follow the first character in a pronounceable part. if ( !isStartOfPart && pwFlags hasFlag PasswordGenerator.DIGITS && secureRandomBiasedBoolean(30) ) { var randomDigit: Char do { randomDigit = secureRandomNumber(10).toString(10).first() } while ( pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && randomDigit in PasswordGenerator.AMBIGUOUS_STR ) password += randomDigit // Begin a new pronounceable part after every digit. isStartOfPart = true nextBasicType = if (secureRandomBoolean()) VOWEL else CONSONANT previousFlags = 0 continue } if ( !isStartOfPart && pwFlags hasFlag PasswordGenerator.SYMBOLS && secureRandomBiasedBoolean(20) ) { var randomSymbol: Char do { randomSymbol = PasswordGenerator.SYMBOLS_STR.secureRandomCharacter() } while ( pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && randomSymbol in PasswordGenerator.AMBIGUOUS_STR ) password += randomSymbol // Continue the password generation as if nothing was added. } // Third part: Determine the basic type of the next character depending on the letter // we just added. nextBasicType = when { candidate.flags.hasFlag(CONSONANT) -> VOWEL previousFlags.hasFlag(VOWEL) || candidate.flags.hasFlag(DIPHTHONG) || secureRandomBiasedBoolean(60) -> CONSONANT else -> VOWEL } previousFlags = candidate.flags isStartOfPart = false }</ID> <ID>MagicNumber:PasswordGenerator.kt$PasswordGenerator$1000</ID> <ID>MagicNumber:PasswordGenerator.kt$PasswordGenerator$6</ID> <ID>MagicNumber:RandomNumberGenerator.kt$100</ID> @@ -16,6 +14,6 @@ <ID>MagicNumber:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$30</ID> <ID>MagicNumber:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$60</ID> <ID>ReturnCount:PasswordGenerator.kt$PasswordGenerator$internal fun isValidPassword(password: String, pwFlags: Int): Boolean</ID> - <ID>ThrowsCount:PasswordGenerator.kt$PasswordGenerator$@Throws(PasswordGeneratorException::class) public fun generate(passwordOptions: List<PasswordOption>, length: Int = DEFAULT_LENGTH): String</ID> + <ID>ThrowsCount:PasswordGenerator.kt$PasswordGenerator$@Throws(PasswordGeneratorException::class) public fun generate(passwordOptions: List<PasswordOption>, length: Int = DEFAULT_LENGTH): String</ID> </CurrentIssues> </SmellBaseline> |