Skip to content

Commit

Permalink
Merge branch 'main' into feat/in-app-purchase-add-swift-package-manag…
Browse files Browse the repository at this point in the history
…er-support
  • Loading branch information
alejandro-all-win-software authored Jan 21, 2025
2 parents 2c0cff2 + 3d3ab7b commit b71a757
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions script/tool/lib/src/federation_safety_check_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,19 @@ class FederationSafetyCheckCommand extends PackageLoopingCommand {
Future<bool> _changeIsCommentOnly(
GitVersionFinder git, String repoPath) async {
final List<String> diff = await git.getDiffContents(targetPath: repoPath);
final RegExp changeLine = RegExp(r'^[+-] ');
final RegExp changeLine = RegExp(r'^[+-]');
// This will not catch /**/-style comments, but false negatives are fine
// (and in practice, we almost never use that comment style in Dart code).
final RegExp commentLine = RegExp(r'^[+-]\s*//');
final RegExp blankLine = RegExp(r'^[+-]\s*$');
bool foundComment = false;
for (final String line in diff) {
if (!changeLine.hasMatch(line) ||
line.startsWith('--- ') ||
line.startsWith('+++ ')) {
continue;
}
if (!commentLine.hasMatch(line)) {
if (!(commentLine.hasMatch(line) || blankLine.hasMatch(line))) {
return false;
}
foundComment = true;
Expand Down
4 changes: 3 additions & 1 deletion script/tool/test/federation_safety_check_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,12 @@ diff --git a/packages/foo/foo_bar/lib/foo.dart b/packages/foo/foo_bar/lib/foo.da
index abc123..def456 100644
--- a/packages/foo/foo_bar/lib/foo.dart
+++ b/packages/foo/foo_bar/lib/foo.dart
@@ -51,6 +51,7 @@ Future<bool> launchUrl(
@@ -51,6 +51,9 @@ Future<bool> launchUrl(
}
void foo() {
+ // blank lines should also be allowed as part of comment changes.
+
+ // ignore: exhaustive_cases
switch(a_foo) {
case a:
Expand Down

0 comments on commit b71a757

Please sign in to comment.