Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jmagman
Copy link
Member

@jmagman jmagman commented Nov 19, 2021

When running ci/format.sh without --fix (as is done in the presubmit hook), wrap the diff output in patch -p0 so the fix can be easily pasted into the command line.

Example output with bad formatting in several files (that fixed the formatting when pasted):
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8830155832086566049/+/u/test:_format_and_dart_test/stdout

$ ci/format.sh
Performing C++/ObjC format check
Checking C++/ObjC formatting...
ERROR: Found 3 C++/ObjC files which were formatted incorrectly.
To fix, run:

patch -p0 <<DONE
--- fml/platform/darwin/scoped_nsobject.h	2021-11-18 22:37:13.000000000 -0800
+++ -	2021-11-18 22:37:46.000000000 -0800
@@ -42,8 +42,7 @@
  public:
   explicit scoped_nsprotocol(NST object = nil) : object_(object) {}

-  scoped_nsprotocol(const scoped_nsprotocol<NST>& that) :
-  object_([that.object_ retain]) {}
+  scoped_nsprotocol(const scoped_nsprotocol<NST>& that) : object_([that.object_ retain]) {}

   template <typename NSU>
   scoped_nsprotocol(const scoped_nsprotocol<NSU>& that) : object_([that.get() retain]) {}
--- flow/display_list_utils.h	2021-11-18 22:37:21.000000000 -0800
+++ -	2021-11-18 22:37:46.000000000 -0800
@@ -227,8 +227,7 @@

 class BoundsAccumulator {
  public:
-  void accumulate(const SkPoint& p)
-  { accumulate(p.fX, p.fY); }
+  void accumulate(const SkPoint& p) { accumulate(p.fX, p.fY); }
   void accumulate(SkScalar x, SkScalar y) {
     if (min_x_ > x) {
       min_x_ = x;
--- shell/platform/android/android_image_generator.h	2021-11-18 22:37:26.000000000 -0800
+++ -	2021-11-18 22:37:46.000000000 -0800
@@ -25,8 +25,7 @@
   const SkImageInfo& GetInfo() override;

   // |ImageGenerator|
-  unsigned int GetFrameCount()
-  const override;
+  unsigned int GetFrameCount() const override;

   // |ImageGenerator|
   unsigned int GetPlayCount() const override;
DONE

Found C++/ObjC format problems.
Performing Java format check
Checking Java formatting...
ERROR: Found 1 Java file which was formatted incorrectly.
To fix, run:

patch -p0 <<DONE
--- shell/platform/android/io/flutter/plugin/platform/PlatformView.java	2021-11-18 22:37:16.000000000 -0800
+++ -	2021-11-18 22:37:47.000000000 -0800
@@ -29,8 +29,7 @@
    */
   // Default interface methods are supported on all min SDK versions of Android.
   @SuppressLint("NewApi")
-  default void
-  onFlutterViewAttached(@NonNull View flutterView) {}
+  default void onFlutterViewAttached(@NonNull View flutterView) {}

   /**
    * Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code
DONE

Found Java format problems.
Performing Trailing whitespace format check
Checking for trailing whitespace on 5 source files...
No trailing whitespace found.
Performing GN format check
Checking GN formatting...
All GN files formatted correctly.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@jmagman jmagman marked this pull request as ready for review November 19, 2021 06:48
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@jmagman
Copy link
Member Author

jmagman commented Nov 19, 2021

luci-engine check isn't working, tree is actually green. Merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants