chore: enable avoid_bool_literals_in_conditional_expressions

This commit is contained in:
Nicolas Werner 2023-11-02 10:55:23 +01:00
parent a0970b7fcb
commit 5dc3adadfc
No known key found for this signature in database
GPG Key ID: B38119FF80087618
3 changed files with 16 additions and 19 deletions

View File

@ -2,17 +2,18 @@ include: package:lints/recommended.yaml
linter:
rules:
avoid_print: true
prefer_final_locals: true
prefer_final_in_for_each: true
sort_pub_dependencies: true
always_use_package_imports: true
always_declare_return_types: true
always_use_package_imports: true
avoid_bool_literals_in_conditional_expressions: true
avoid_print: true
non_constant_identifier_names: false # seems to wrongly diagnose static const variables
prefer_final_in_for_each: true
prefer_final_locals: true
prefer_single_quotes: true
sort_child_properties_last: true
sort_pub_dependencies: true
unawaited_futures: true
unsafe_html: true
non_constant_identifier_names: false # seems to wrongly diagnose static const variables
analyzer:
errors:

View File

@ -267,11 +267,8 @@ class KeyVerification {
}
/// `qrCanWork` - qr cannot work if we are verifying another master key but our own is unverified
final qrCanWork = (userId != client.userID)
? ((client.userDeviceKeys[client.userID]?.masterKey?.verified ?? false)
? true
: false)
: true;
final qrCanWork = (userId == client.userID) ||
((client.userDeviceKeys[client.userID]?.masterKey?.verified ?? false));
if (client.verificationMethods.contains(KeyVerificationMethod.qrShow) &&
qrCanWork) {

View File

@ -433,17 +433,16 @@ class DeviceKeys extends SignableKey {
bool? _validSelfSignature;
bool get selfSigned =>
_validSelfSignature ??
(_validSelfSignature = (deviceId != null &&
signatures
?.tryGetMap<String, Object?>(userId)
?.tryGet<String>('ed25519:$deviceId') ==
null
? false
(_validSelfSignature = deviceId != null &&
signatures
?.tryGetMap<String, Object?>(userId)
?.tryGet<String>('ed25519:$deviceId') !=
null &&
// without libolm we still want to be able to add devices. In that case we ofc just can't
// verify the signature
: _verifySignature(
_verifySignature(
ed25519Key!, signatures![userId]!['ed25519:$deviceId']!,
isSignatureWithoutLibolmValid: true)));
isSignatureWithoutLibolmValid: true));
@override
bool get blocked => super.blocked || !selfSigned;