Add lint check to make sure samples are linked and have tests (#130523)

## Description

This adds a checker that will check all of the API docs examples to make sure that they are linked from at least one source file in the packages.

It also checks to make sure that all of the examples have an associated test. Since there are a large number that don't have tests at the moment, there is also a large exception list that can be burned down (burn down list is in https://github.com/flutter/flutter/issues/130459).

Because there are missing links currently, this PR will only pass after https://github.com/flutter/flutter/pull/130521 is merged.

## Related Issues

- https://github.com/flutter/flutter/issues/129956
- https://github.com/flutter/flutter/issues/130459

## Tests

- Added test for the checker.
This commit is contained in:
Greg Spencer
2023-07-18 08:26:09 -07:00
committed by GitHub
parent 3b0b8348fd
commit 8b768de18f
7 changed files with 689 additions and 42 deletions

View File

@@ -44,6 +44,12 @@ enum _CheckboxType { material, adaptive }
/// ** See code in examples/api/lib/material/checkbox/checkbox.0.dart **
/// {@end-tool}
///
/// {@tool dartpad}
/// This example shows what the checkbox error state looks like.
///
/// ** See code in examples/api/lib/material/checkbox/checkbox.1.dart **
/// {@end-tool}
///
/// See also:
///
/// * [CheckboxListTile], which combines this widget with a [ListTile] so that

View File

@@ -90,50 +90,13 @@ const Duration _kBaseSettleDuration = Duration(milliseconds: 246);
/// The [Drawer] displays the four items using a [ListView], which allows the
/// user to scroll through the items if need be.
///
/// ```dart
/// Scaffold(
/// appBar: AppBar(
/// title: const Text('Drawer Demo'),
/// ),
/// drawer: Drawer(
/// child: ListView(
/// padding: EdgeInsets.zero,
/// children: const <Widget>[
/// DrawerHeader(
/// decoration: BoxDecoration(
/// color: Colors.blue,
/// ),
/// child: Text(
/// 'Drawer Header',
/// style: TextStyle(
/// color: Colors.white,
/// fontSize: 24,
/// ),
/// ),
/// ),
/// ListTile(
/// leading: Icon(Icons.message),
/// title: Text('Messages'),
/// ),
/// ListTile(
/// leading: Icon(Icons.account_circle),
/// title: Text('Profile'),
/// ),
/// ListTile(
/// leading: Icon(Icons.settings),
/// title: Text('Settings'),
/// ),
/// ],
/// ),
/// ),
/// )
/// ```
/// ** See code in examples/api/lib/material/drawer/drawer.0.dart **
/// {@end-tool}
///
/// {@tool snippet}
/// This example shows how to migrate the above [Drawer] to a [NavigationDrawer].
///
/// See code in examples/api/lib/material/navigation_drawer/navigation_drawer.1.dart **
/// ** See code in examples/api/lib/material/navigation_drawer/navigation_drawer.1.dart **
/// {@end-tool}
///
/// An open drawer may be closed with a swipe to close gesture, pressing the