Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d3ab7b

Browse files
[tool] Allow blank lines in federated package changes (flutter#8468)
Currently the special-casing for allowing comment-only changes to other packages in a plugin group as part of a single PR, which is necessary for some changes to add `// ignore` directives, allows comment lines, but not blank lines. Blank lines should be allowed since they are safe, and are expected for certain changes (notably, temporary file-level ignores).
1 parente8f1f63 commit3d3ab7b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎script/tool/lib/src/federation_safety_check_command.dart‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,18 +212,19 @@ class FederationSafetyCheckCommand extends PackageLoopingCommand {
212212
Future<bool>_changeIsCommentOnly(
213213
GitVersionFinder git,String repoPath)async {
214214
finalList<String> diff=await git.getDiffContents(targetPath: repoPath);
215-
finalRegExp changeLine=RegExp(r'^[+-]');
215+
finalRegExp changeLine=RegExp(r'^[+-]');
216216
// This will not catch /**/-style comments, but false negatives are fine
217217
// (and in practice, we almost never use that comment style in Dart code).
218218
finalRegExp commentLine=RegExp(r'^[+-]\s*//');
219+
finalRegExp blankLine=RegExp(r'^[+-]\s*$');
219220
bool foundComment=false;
220221
for (finalString linein diff) {
221222
if (!changeLine.hasMatch(line)||
222223
line.startsWith('--- ')||
223224
line.startsWith('+++ ')) {
224225
continue;
225226
}
226-
if (!commentLine.hasMatch(line)) {
227+
if (!(commentLine.hasMatch(line)|| blankLine.hasMatch(line))) {
227228
returnfalse;
228229
}
229230
foundComment=true;

‎script/tool/test/federation_safety_check_command_test.dart‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,12 @@ diff --git a/packages/foo/foo_bar/lib/foo.dart b/packages/foo/foo_bar/lib/foo.da
446446
index abc123..def456 100644
447447
--- a/packages/foo/foo_bar/lib/foo.dart
448448
+++ b/packages/foo/foo_bar/lib/foo.dart
449-
@@ -51,6 +51,7 @@ Future<bool> launchUrl(
449+
@@ -51,6 +51,9 @@ Future<bool> launchUrl(
450450
}
451451
452452
void foo() {
453+
+ // blank lines should also be allowed as part of comment changes.
454+
+
453455
+ // ignore: exhaustive_cases
454456
switch(a_foo) {
455457
case a:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp