Skip to content

Commit

Permalink
Pass-through for formatter/page_width in analysis_options.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Oct 10, 2024
1 parent 0b28c61 commit 1e3edc4
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.22.13

- Pass-through for `formatter/page_width` in `analysis_options.yaml`.
- Upgraded `lints` to `^5.0.0`

## 0.22.12

- Updated report text for `wasm` readiness.
Expand Down
10 changes: 10 additions & 0 deletions lib/src/analysis_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,15 @@ String updatePassthroughOptions({
}
}

final origFormatter = origMap['formatter'];
if (origFormatter is Map) {
final pageWidth = origFormatter['page_width'];
if (pageWidth is int) {
final customFormatter =
customMap.putIfAbsent('formatter', () => <String, Object?>{}) as Map;
customFormatter['page_width'] = pageWidth;
}
}

return json.encode(customMap);
}
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pana
description: PAckage aNAlyzer - produce a report summarizing the health and quality of a Dart package.
version: 0.22.12
version: 0.22.13
repository: https://github.com/dart-lang/pana
topics:
- tool
Expand All @@ -20,7 +20,7 @@ dependencies:
http: ^1.0.0
io: ^1.0.0
json_annotation: ^4.9.0
lints: ^4.0.0
lints: '>=4.0.0 <6.0.0'
logging: ^1.0.0
markdown: ^7.0.0
meta: ^1.4.0
Expand Down
6 changes: 6 additions & 0 deletions test/analysis_options_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ analyzer:
enable-experiment:
- ignored
- macros
formatter:
unknown_key: true
page_width: 123
''', custom: '');
expect(json.decode(content), {
'analyzer': {
Expand All @@ -46,6 +49,9 @@ analyzer:
'macros',
],
},
'formatter': {
'page_width': 123,
},
});
});
}
2 changes: 1 addition & 1 deletion test/goldens/end2end/async-2.11.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"grantedPoints": 10,
"maxPoints": 20,
"status": "failed",
"summary": "### [*] 10/10 points: 20% or more of the public API has dartdoc comments\n\n246 out of 263 API elements (93.5 %) have documentation comments.\n\nSome symbols that are missing documentation: `async.AsyncMemoizer.AsyncMemoizer`, `async.ChunkedStreamReader.ChunkedStreamReader`, `async.DelegatingFuture.DelegatingFuture`, `async.DelegatingStream.DelegatingStream`, `async.ErrorResult.ErrorResult`.\n\n### [x] 0/10 points: Package has an example\n\n<details>\n<summary>\nNo example found.\n</summary>\n\nSee [package layout](https://dart.dev/tools/pub/package-layout#examples) guidelines on how to add an example.\n</details>\n"
"summary": "### [*] 10/10 points: 20% or more of the public API has dartdoc comments\n\n246 out of 246 API elements (100.0 %) have documentation comments.\n\n### [x] 0/10 points: Package has an example\n\n<details>\n<summary>\nNo example found.\n</summary>\n\nSee [package layout](https://dart.dev/tools/pub/package-layout#examples) guidelines on how to add an example.\n</details>\n"
},
{
"id": "platform",
Expand Down
4 changes: 1 addition & 3 deletions test/goldens/end2end/async-2.11.0.json_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ Detected license: `BSD-3-Clause`.

### [*] 10/10 points: 20% or more of the public API has dartdoc comments

246 out of 263 API elements (93.5 %) have documentation comments.

Some symbols that are missing documentation: `async.AsyncMemoizer.AsyncMemoizer`, `async.ChunkedStreamReader.ChunkedStreamReader`, `async.DelegatingFuture.DelegatingFuture`, `async.DelegatingStream.DelegatingStream`, `async.ErrorResult.ErrorResult`.
246 out of 246 API elements (100.0 %) have documentation comments.

### [x] 0/10 points: Package has an example

Expand Down

0 comments on commit 1e3edc4

Please sign in to comment.