Skip to content

Commit

Permalink
Merge branch 'main' into records-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
MaryaBelanger authored Feb 19, 2025
2 parents 2fab6a5 + c62d996 commit c686ae8
Show file tree
Hide file tree
Showing 281 changed files with 6,799 additions and 6,943 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a
uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -44,7 +44,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@dd746615b3b9d728a6a37ca2045b68ca76d4841a
uses: github/codeql-action/autobuild@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -58,4 +58,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a
uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0
with:
sarif_file: results.sarif
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: ${{ matrix.sdk }}
- name: Fetch Dart packages
Expand All @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: stable
- name: Fetch Dart packages
Expand All @@ -74,12 +74,12 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: stable
- name: Fetch Dart packages
run: dart pub get
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
with:
node-version: ${{ env.NODE_VERSION }}
Expand All @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: stable
- name: Fetch Dart packages
Expand All @@ -115,7 +115,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: stable
- name: Fetch Dart packages
Expand Down
2 changes: 1 addition & 1 deletion examples/analysis/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.6.1
sdk: ^3.7.0

dependencies:
examples_util: {path: ../util}
2 changes: 1 addition & 1 deletion examples/analysis_alt/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.6.1
sdk: ^3.7.0
1 change: 1 addition & 0 deletions examples/async_await/bin/futures_intro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ void main() {
fetchUserOrder();
print('Fetching user order...');
}

// #enddocregion no-error, error
7 changes: 2 additions & 5 deletions examples/async_await/bin/get_order.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ Future<String> createOrderMessage() async {
}

Future<String> fetchUserOrder() =>
// Imagine that this function is more complex and slow.
Future.delayed(
const Duration(seconds: 2),
() => 'Large Latte',
);
// Imagine that this function is more complex and slow.
Future.delayed(const Duration(seconds: 2), () => 'Large Latte');

// #docregion main-sig
Future<void> main() async {
Expand Down
8 changes: 3 additions & 5 deletions examples/async_await/bin/get_order_sync_bad.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ String createOrderMessage() {
}

Future<String> fetchUserOrder() =>
// Imagine that this function is more complex and slow.
Future.delayed(
const Duration(seconds: 2),
() => 'Large Latte',
);
// Imagine that this function is more complex and slow.
Future.delayed(const Duration(seconds: 2), () => 'Large Latte');

// #docregion main-sig
void main() {
// #enddocregion main-sig
print('Fetching user order...');
print(createOrderMessage());
}

// #enddocregion no-warning
7 changes: 4 additions & 3 deletions examples/async_await/bin/try_catch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Future<void> printOrderMessage() async {
Future<String> fetchUserOrder() {
// Imagine that this function is more complex.
var str = Future.delayed(
const Duration(seconds: 4),
// ignore: only_throw_errors
() => throw 'Cannot locate user order');
const Duration(seconds: 4),
// ignore: only_throw_errors
() => throw 'Cannot locate user order',
);
return str;
}

Expand Down
1 change: 1 addition & 0 deletions examples/async_await/lib/practice_errors/solution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Future<String> changeUsername() async {
return err.toString();
}
}

// #enddocregion
24 changes: 16 additions & 8 deletions examples/async_await/lib/practice_errors/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,28 @@ Future<String> fetchNewUsername() {
void main() async {
try {
messages
..add(makeReadable(
..add(
makeReadable(
testLabel: '',
testResult: await asyncDidCatchException(changeUsername),
readableErrors: {
typoMessage: typoMessage,
noCatch:
'Did you remember to call fetchNewUsername within a try/catch block?',
}))
..add(makeReadable(
},
),
)
..add(
makeReadable(
testLabel: '',
testResult: await asyncErrorEquals(changeUsername),
readableErrors: {
typoMessage: typoMessage,
noCatch:
'Did you remember to call fetchNewUsername within a try/catch block?',
}))
},
),
)
..removeWhere((m) => m.contains(passed))
..toList();

Expand Down Expand Up @@ -73,10 +79,11 @@ void passIfNoMessages(List<String> messages, Map<String, String> readable) {
if (messages.isEmpty) {
_result(true);
} else {
final userMessages = messages
.where((message) => readable.containsKey(message))
.map((message) => readable[message]!)
.toList();
final userMessages =
messages
.where((message) => readable.containsKey(message))
.map((message) => readable[message]!)
.toList();
print(messages);

_result(false, userMessages);
Expand Down Expand Up @@ -109,4 +116,5 @@ Future<String> asyncDidCatchException(Function fn) async {
return passed;
}
}

// #enddocregion
1 change: 1 addition & 0 deletions examples/async_await/lib/practice_using/solution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ Future<String> reportLogins() async {
var logins = await fetchLoginAmount();
return 'Total number of logins: $logins';
}

// #enddocregion
33 changes: 20 additions & 13 deletions examples/async_await/lib/practice_using/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ Future<int> fetchLoginAmount() => Future.delayed(oneSecond, () => logins);
void main() async {
try {
messages
..add(makeReadable(
..add(
makeReadable(
testLabel: 'Part 1',
testResult: await asyncEquals(
expected: 'User role: administrator',
actual: await reportUserRole(),
typoKeyword: role),
expected: 'User role: administrator',
actual: await reportUserRole(),
typoKeyword: role,
),
readableErrors: {
typoMessage: typoMessage,
'null': '$didNotImplement reportUserRole?',
Expand All @@ -39,13 +41,17 @@ void main() async {
'$testFailedMessage reportUserRole. Did you return a user role?',
'User role: tester':
'$testFailedMessage reportUserRole. Did you invoke fetchRole to fetch the user\'s role?',
}))
..add(makeReadable(
},
),
)
..add(
makeReadable(
testLabel: 'Part 2',
testResult: await asyncEquals(
expected: 'Total number of logins: 42',
actual: await reportLogins(),
typoKeyword: logins.toString()),
expected: 'Total number of logins: 42',
actual: await reportLogins(),
typoKeyword: logins.toString(),
),
readableErrors: {
typoMessage: typoMessage,
'null': '$didNotImplement reportLogins?',
Expand All @@ -59,7 +65,9 @@ void main() async {
'$testFailedMessage reportLogins. Did you return the number of logins?',
'Total number of logins: 57':
'$testFailedMessage reportLogins. Did you invoke fetchLoginAmount to fetch the number of user logins?',
}))
},
),
)
..removeWhere((m) => m.contains(passed))
..toList();

Expand All @@ -69,9 +77,7 @@ void main() async {
_result(false, messages);
}
} on UnimplementedError {
_result(false, [
'$didNotImplement reportUserRole?',
]);
_result(false, ['$didNotImplement reportUserRole?']);
} catch (e) {
_result(false, ['Tried to run solution, but received an exception: $e']);
}
Expand Down Expand Up @@ -114,4 +120,5 @@ Future<String> asyncEquals({
return e.toString();
}
}

// #enddocregion
1 change: 1 addition & 0 deletions examples/async_await/lib/putting_together/solution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Future<String> sayGoodbye() async {
return 'Failed to logout user: $e';
}
}

// #enddocregion
Loading

0 comments on commit c686ae8

Please sign in to comment.