Skip to content

Commit

Permalink
chore: api snippet formatting (#92)
Browse files Browse the repository at this point in the history
* chore: trying to find an agreeable code format

dart format and the API snippet parser haver incompatible requirements and I'm trying to satisfy both

* chore: more trickery to get function defs spread across 2 lines

* chore: using find to exclude doc examples

The dart format utility keeps munging my api examples file such that it iss incompatible with the API snippet parser, so am using find to gather dart files to format and excluding the snippets explicitly.

* fix: add in dart file in root of lib

* fix: fixing find command format

* fix: remove unneeded arg
  • Loading branch information
pgautier404 committed Jan 11, 2024
1 parent d8ff271 commit fbbd3d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

# Uncomment this step to verify the use of 'dart format' on each commit.
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
run: find lib/momento.dart lib/src example test -name "*.dart" -not -name doc_example_apis.dart -exec dart format --output=none --set-exit-if-changed {} \;

# Consider passing '--fatal-infos' for slightly stricter analysis.
- name: Analyze project source
Expand Down
15 changes: 5 additions & 10 deletions example/doc_example_apis/doc_example_apis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ Future<void> example_API_InstantiateCacheClient() async {
}
}

Future<void> example_API_CreateCache(
CacheClient cacheClient, String cacheName) async {
Future<void> example_API_CreateCache(CacheClient cacheClient, String cacheName) async {
final result = await cacheClient.createCache(cacheName);
switch (result) {
case CreateCacheAlreadyExists():
Expand All @@ -37,8 +36,7 @@ Future<void> example_API_ListCaches(CacheClient cacheClient) async {
}
}

Future<void> example_API_DeleteCache(
CacheClient cacheClient, String cacheName) async {
Future<void> example_API_DeleteCache(CacheClient cacheClient, String cacheName) async {
final result = await cacheClient.deleteCache(cacheName);
switch (result) {
case DeleteCacheError():
Expand All @@ -49,8 +47,7 @@ Future<void> example_API_DeleteCache(
}
}

Future<void> example_API_Set(
CacheClient cacheClient, String cacheName, Value key, Value value) async {
Future<void> example_API_Set(CacheClient cacheClient, String cacheName, Value key, Value value) async {
final result = await cacheClient.set(cacheName, key, value);
switch (result) {
case SetError():
Expand All @@ -61,8 +58,7 @@ Future<void> example_API_Set(
}
}

Future<void> example_API_Get(
CacheClient cacheClient, String cacheName, Value key) async {
Future<void> example_API_Get(CacheClient cacheClient, String cacheName, Value key) async {
final result = await cacheClient.get(cacheName, key);
switch (result) {
case GetMiss():
Expand All @@ -74,8 +70,7 @@ Future<void> example_API_Get(
}
}

Future<void> example_API_Delete(
CacheClient cacheClient, String cacheName, Value key) async {
Future<void> example_API_Delete(CacheClient cacheClient, String cacheName, Value key) async {
final result = await cacheClient.delete(cacheName, key);
switch (result) {
case DeleteError():
Expand Down

0 comments on commit fbbd3d3

Please sign in to comment.