Skip to content

Commit 66c8303

Browse files
committed
style: fix linting issues and formatting
- Ignore some linting rules - Fix minor formatting issues
1 parent 176c64c commit 66c8303

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ analyzer:
44
avoid_redundant_argument_values: ignore
55
avoid_print: ignore
66
no_default_cases: ignore
7+
avoid_catches_without_on_clauses: ignore
8+
lines_longer_than_80_chars: ignore
79
exclude:
810
- build/**
911
linter:

lib/src/middlewares/authentication_middleware.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:ht_shared/ht_shared.dart';
1010
///
1111
/// If a route requires authentication (determined by where this middleware is
1212
/// applied) and the token is missing or invalid, it should ideally throw an
13-
/// [UnauthorizedException] to be caught by the [errorHandler].
13+
/// [UnauthorizedException] to be caught by the errorHandler.
1414
///
1515
/// **Usage:** Apply this middleware to routes or groups of routes that require
1616
/// access to the authenticated user's identity or need protection.
@@ -71,7 +71,8 @@ Middleware requireAuthentication() {
7171
final user = context.read<User?>();
7272
if (user == null) {
7373
print(
74-
'Authentication required but no valid user found. Denying access.',);
74+
'Authentication required but no valid user found. Denying access.',
75+
);
7576
// Throwing allows the central errorHandler to create the 401 response.
7677
throw const UnauthorizedException('Authentication required.');
7778
}

lib/src/services/auth_service.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
import 'package:ht_api/src/services/auth_token_service.dart';
2+
import 'package:ht_api/src/services/verification_code_storage_service.dart';
13
import 'package:ht_data_repository/ht_data_repository.dart';
24
import 'package:ht_email_repository/ht_email_repository.dart';
35
import 'package:ht_shared/ht_shared.dart';
46
import 'package:uuid/uuid.dart';
57

6-
import 'package:ht_api/src/services/auth_token_service.dart';
7-
import 'package:ht_api/src/services/verification_code_storage_service.dart';
8-
98
/// {@template auth_service}
109
/// Service responsible for orchestrating authentication logic on the backend.
1110
///
@@ -82,7 +81,8 @@ class AuthService {
8281
// Consider distinguishing between expired and simply incorrect codes
8382
// For now, treat both as invalid input.
8483
throw const InvalidInputException(
85-
'Invalid or expired verification code.',);
84+
'Invalid or expired verification code.',
85+
);
8686
}
8787

8888
// 2. Find or create the user
@@ -112,7 +112,8 @@ class AuthService {
112112
} on HtHttpException catch (e) {
113113
print('Error finding/creating user for $email: $e');
114114
throw const OperationFailedException(
115-
'Failed to find or create user account.',);
115+
'Failed to find or create user account.',
116+
);
116117
} catch (e) {
117118
print('Unexpected error during user lookup/creation for $email: $e');
118119
throw const OperationFailedException('Failed to process user account.');
@@ -126,7 +127,8 @@ class AuthService {
126127
} catch (e) {
127128
print('Error generating token for user ${user.id}: $e');
128129
throw const OperationFailedException(
129-
'Failed to generate authentication token.',);
130+
'Failed to generate authentication token.',
131+
);
130132
}
131133
}
132134

@@ -152,7 +154,8 @@ class AuthService {
152154
} catch (e) {
153155
print('Unexpected error during anonymous user creation: $e');
154156
throw const OperationFailedException(
155-
'Failed to process anonymous sign-in.',);
157+
'Failed to process anonymous sign-in.',
158+
);
156159
}
157160

158161
// 2. Generate token
@@ -163,7 +166,8 @@ class AuthService {
163166
} catch (e) {
164167
print('Error generating token for anonymous user ${user.id}: $e');
165168
throw const OperationFailedException(
166-
'Failed to generate authentication token.',);
169+
'Failed to generate authentication token.',
170+
);
167171
}
168172
}
169173

lib/src/services/auth_token_service.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class SimpleAuthTokenService implements AuthTokenService {
3939
String secretKey = 'very-secret-key-replace-me',
4040
}) : _secretKey = secretKey;
4141

42+
//
4243
// ignore: unused_field
4344
final String _secretKey;
4445

0 commit comments

Comments
 (0)