-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[tool] Unify most validation commands #11641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4a85959
833a8a3
0b57fd8
7d394a4
653a847
73be711
25b96b7
f272dc5
b357cee
323cb40
0f7948d
52aa7ff
72a3e9b
17060a2
d940516
4af276b
9ce590e
5bbe498
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # TODO(stuartmorgan): Remove this; see https://github.com/flutter/flutter/issues/102679 | ||
| exempt_from_excerpts: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # TODO(stuartmorgan): Remove this; see https://github.com/flutter/flutter/issues/102679 | ||
| exempt_from_excerpts: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # TODO(stuartmorgan): Remove this; see https://github.com/flutter/flutter/issues/102679 | ||
| exempt_from_excerpts: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # TODO(stuartmorgan): Remove this; see https://github.com/flutter/flutter/issues/102679 | ||
| exempt_from_excerpts: true |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| import 'package:file/file.dart'; | ||
| import 'package:path/path.dart' as p; | ||
| import 'package:yaml/yaml.dart'; | ||
|
|
||
| /// Returns a [File] created by appending all but the last item in [components] | ||
| /// to [base] as subdirectories, then appending the last as a file. | ||
|
|
@@ -49,3 +50,20 @@ String relativePosixPath( | |
| platformContext.relative(entity.absolute.path, from: from.path), | ||
| ), | ||
| ); | ||
|
|
||
| /// Loads the file at [filename], which must contain a YAML list of strings. | ||
| /// | ||
| /// If the file is not found, returns null. | ||
| List<String>? loadYamlList(File file) { | ||
| if (!file.existsSync()) { | ||
| return null; | ||
| } | ||
| final String contents = file.readAsStringSync(); | ||
| final Object? yaml = loadYaml(contents); | ||
| // Treat an empty or comment-only file as an empty list, to avoid requiring | ||
| // adding an explicit empty list entry to the YAML when no entries are needed. | ||
| if (yaml == null) { | ||
| return []; | ||
| } | ||
| return (yaml as YamlList).toList().cast<String>(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The cast to if (yaml is! YamlList) {
return <String>[];
}
return yaml.toList().cast<String>(); |
||
| } | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this isn't combined is that it's a repo-wide command, not package-level (because we don't want files to accidentally not get license blocks when they aren't in a package).
It is annoying for local validation that it's not part of the same command, but I haven't thought of a good way to combine it yet without making it more likely to miss files.