From 19a2d6c5a6f96673f536b602c8121e16afd525b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20So=C3=B3s?= Date: Fri, 11 Oct 2024 15:55:05 +0200 Subject: [PATCH] Pass-through for formatter/page_width in analysis_options.yaml (#1408) --- CHANGELOG.md | 5 +++++ lib/src/analysis_options.dart | 10 ++++++++++ lib/src/version.dart | 2 +- pubspec.yaml | 4 ++-- test/analysis_options_test.dart | 6 ++++++ test/goldens/end2end/async-2.11.0.json | 2 +- test/goldens/end2end/async-2.11.0.json_report.md | 4 +--- 7 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96cd0b1d1..c49e835df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/lib/src/analysis_options.dart b/lib/src/analysis_options.dart index 6c2829745..435b16a56 100644 --- a/lib/src/analysis_options.dart +++ b/lib/src/analysis_options.dart @@ -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', () => {}) as Map; + customFormatter['page_width'] = pageWidth; + } + } + return json.encode(customMap); } diff --git a/lib/src/version.dart b/lib/src/version.dart index 76c07debd..082f85d72 100644 --- a/lib/src/version.dart +++ b/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '0.22.12'; +const packageVersion = '0.22.13'; diff --git a/pubspec.yaml b/pubspec.yaml index db50ecb5b..6cc0d2870 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 @@ -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 diff --git a/test/analysis_options_test.dart b/test/analysis_options_test.dart index 1b0f4d4fd..f082e9096 100644 --- a/test/analysis_options_test.dart +++ b/test/analysis_options_test.dart @@ -36,6 +36,9 @@ analyzer: enable-experiment: - ignored - macros +formatter: + unknown_key: true + page_width: 123 ''', custom: ''); expect(json.decode(content), { 'analyzer': { @@ -46,6 +49,9 @@ analyzer: 'macros', ], }, + 'formatter': { + 'page_width': 123, + }, }); }); } diff --git a/test/goldens/end2end/async-2.11.0.json b/test/goldens/end2end/async-2.11.0.json index c24f8e17f..fec106f91 100644 --- a/test/goldens/end2end/async-2.11.0.json +++ b/test/goldens/end2end/async-2.11.0.json @@ -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
\n\nNo example found.\n\n\nSee [package layout](https://dart.dev/tools/pub/package-layout#examples) guidelines on how to add an example.\n
\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
\n\nNo example found.\n\n\nSee [package layout](https://dart.dev/tools/pub/package-layout#examples) guidelines on how to add an example.\n
\n" }, { "id": "platform", diff --git a/test/goldens/end2end/async-2.11.0.json_report.md b/test/goldens/end2end/async-2.11.0.json_report.md index bb097bd76..84c4e5bf3 100644 --- a/test/goldens/end2end/async-2.11.0.json_report.md +++ b/test/goldens/end2end/async-2.11.0.json_report.md @@ -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