Skip to content

Commit

Permalink
feat: Added require_trailing_commas lint (#224)
Browse files Browse the repository at this point in the history
* feat: updated lint, dart fix

* feat: updated metadata, dart format

* fix: fixed PR comment
  • Loading branch information
jhomlala authored Jul 8, 2024
1 parent da907e7 commit 1a1ec27
Show file tree
Hide file tree
Showing 63 changed files with 905 additions and 676 deletions.
2 changes: 1 addition & 1 deletion examples/alice/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
2 changes: 1 addition & 1 deletion examples/alice/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class _MyAppState extends State<MyApp> {
child: const Text(
'Run HTTP Inspector',
),
)
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion examples/alice_chopper/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
2 changes: 1 addition & 1 deletion examples/alice_chopper/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ class _MyAppState extends State<MyApp> {
ElevatedButton(
onPressed: _runHttpInspector,
child: const Text('Run HTTP Inspector'),
)
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion examples/alice_dio/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
4 changes: 2 additions & 2 deletions examples/alice_dio/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class _MyAppState extends State<MyApp> {
child: const Text(
'Run HTTP Inspector',
),
)
),
],
),
),
Expand All @@ -74,7 +74,7 @@ class _MyAppState extends State<MyApp> {
final Map<String, dynamic> body = {
'title': 'foo',
'body': 'bar',
'userId': '1'
'userId': '1',
};
_dio.get<void>(
'https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org',
Expand Down
2 changes: 1 addition & 1 deletion examples/alice_http/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
4 changes: 2 additions & 2 deletions examples/alice_http/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _MyAppState extends State<MyApp> {
child: const Text(
'Run HTTP Inspector',
),
)
),
],
),
),
Expand All @@ -70,7 +70,7 @@ class _MyAppState extends State<MyApp> {
final Map<String, String> body = {
'title': 'foo',
'body': 'bar',
'userId': '1'
'userId': '1',
};

http
Expand Down
2 changes: 1 addition & 1 deletion examples/alice_http_client/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
14 changes: 9 additions & 5 deletions examples/alice_http_client/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class _MyAppState extends State<MyApp> {
children: [
const SizedBox(height: 8),
const Text(
'Welcome to example of Alice Http Inspector. Click buttons below to generate sample data.'),
'Welcome to example of Alice Http Inspector.'
' Click buttons below to generate sample data.',
),
ElevatedButton(
onPressed: _runHttpHttpClientRequests,
child: const Text(
Expand All @@ -50,14 +52,16 @@ class _MyAppState extends State<MyApp> {
),
const SizedBox(height: 8),
const Text(
'After clicking on buttons above, you should receive notification.'
' Click on it to show inspector. You can also shake your device or click button below.'),
'After clicking on buttons above, you should receive'
' notification. Click on it to show inspector. You can '
'also shake your device or click button below.',
),
ElevatedButton(
onPressed: _runHttpInspector,
child: const Text(
'Run HTTP Inspector',
),
)
),
],
),
),
Expand All @@ -69,7 +73,7 @@ class _MyAppState extends State<MyApp> {
final Map<String, dynamic> body = {
'title': 'foo',
'body': 'bar',
'userId': '1'
'userId': '1',
};

_httpClient
Expand Down
2 changes: 1 addition & 1 deletion examples/alice_objectbox/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
6 changes: 3 additions & 3 deletions examples/alice_objectbox/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class _MyAppState extends State<MyApp> {
),
);
late final Alice _alice = Alice(
configuration: configuration
configuration: configuration,
)..addAdapter(_aliceHttpAdapter);

@override
Expand Down Expand Up @@ -82,7 +82,7 @@ class _MyAppState extends State<MyApp> {
child: const Text(
'Run HTTP Inspector',
),
)
),
],
),
),
Expand All @@ -94,7 +94,7 @@ class _MyAppState extends State<MyApp> {
final Map<String, String> body = {
'title': 'foo',
'body': 'bar',
'userId': '1'
'userId': '1',
};

http
Expand Down
2 changes: 2 additions & 0 deletions packages/alice/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 1.0.0-dev.11
* Fixed issue with invalid count of error calls in stats page.
* Added lint for trailing commas.
* General refactor of code base.

# 1.0.0-dev.10

Expand Down
2 changes: 1 addition & 1 deletion packages/alice/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
#library_annotations: false
- require_trailing_commas
4 changes: 3 additions & 1 deletion packages/alice/lib/core/alice_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ class AliceCore {
/// Save all calls to file.
Future<AliceExportResult> saveCallsToFile(BuildContext context) =>
AliceExportHelper.saveCallsToFile(
context, _configuration.aliceStorage.getCalls());
context,
_configuration.aliceStorage.getCalls(),
);

/// Adds new log to Alice logger.
void addLog(AliceLog log) => _configuration.aliceLogger.add(log);
Expand Down
18 changes: 11 additions & 7 deletions packages/alice/lib/core/alice_memory_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ class AliceMemoryStorage implements AliceStorage {
)
.length,
redirects: calls
.where((AliceHttpCall call) =>
(call.response?.status.gte(300) ?? false) &&
(call.response?.status.lt(400) ?? false))
.where(
(AliceHttpCall call) =>
(call.response?.status.gte(300) ?? false) &&
(call.response?.status.lt(400) ?? false),
)
.length,
errors: calls
.where((AliceHttpCall call) =>
((call.response?.status.gte(400) ?? false) &&
(call.response?.status.lt(600) ?? false)) ||
const [-1, 0].contains(call.response?.status))
.where(
(AliceHttpCall call) =>
((call.response?.status.gte(400) ?? false) &&
(call.response?.status.lt(600) ?? false)) ||
const [-1, 0].contains(call.response?.status),
)
.length,
loading: calls.where((AliceHttpCall call) => call.loading).length,
);
Expand Down
Loading

0 comments on commit 1a1ec27

Please sign in to comment.