Skip to content
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

[all] Cleanup unformatted files #7267

Closed
wants to merge 1 commit into from

Conversation

Rexios80
Copy link
Member

@Rexios80 Rexios80 commented Aug 1, 2024

The format command always changes these even though I haven't touched them

flutter/flutter#152651

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style], or this PR is [exempt from CHANGELOG changes].
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@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 "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

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.

@@ -7,7 +7,7 @@
NS_ASSUME_NONNULL_BEGIN

/// Queue-specific context data to be associated with the capture session queue.
extern const char* FLTCaptureSessionQueueSpecific;
extern const char *FLTCaptureSessionQueueSpecific;
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably depends on the exact version of clang-format, due to changes in the logic for detecting whether a file is C++ or Obj-C.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I'm using the latest clang-format version. What version is CI using? Or has this file just not been touched in a really long time?

@@ -39,7 +39,7 @@ CaptureControllerImpl::CaptureControllerImpl(
: capture_controller_listener_(listener),
media_settings_(
PlatformMediaSettings(PlatformResolutionPreset::kMax, true)),
CaptureController(){};
CaptureController() {};
Copy link
Contributor

Choose a reason for hiding this comment

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

All of the rest of these are minor differences in how clang-format handles this code, but the easy solution to these is to fix them all to not have the stray ; that shouldn't be there and is causing it to have non-trivial format analysis. Every one of these should have stable formatting across versions once the incorrect ; is gone.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the ; and the formatter still adds the space. Is that the expected behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the space is correct.

@stuartmorgan
Copy link
Contributor

(FYI, the CI runs the same format command that you are running locally, and fails on diffs, so there are never files checked in that format touches but that aren't formatted.)

@Rexios80
Copy link
Member Author

Rexios80 commented Aug 1, 2024

(FYI, the CI runs the same format command that you are running locally, and fails on diffs, so there are never files checked in that format touches but that aren't formatted.)

I figured that was the case. Is CI using an old clang-format version? Or does it only check files that changed in the PR.

@stuartmorgan
Copy link
Contributor

Is CI using an old clang-format version?

It's using a specific git revision specified in the CI config; I don't know the exact clang version it corresponds to.

Or does it only check files that changed in the PR.

Like almost all the repo commands, in CI it runs on any touched packages, or on all packages for repo-level changes (such as the daily Flutter roll).

@Rexios80
Copy link
Member Author

Rexios80 commented Aug 1, 2024

It's using a specific git revision specified in the CI config; I don't know the exact clang version it corresponds to.

What is the reason for this? Should we update it?

Should we update the documentation on how to setup the correct version of clang-format? I've accidentally checked in these formatting changes a few times and goofed up PRs.

@stuartmorgan
Copy link
Contributor

It's using a specific git revision specified in the CI config; I don't know the exact clang version it corresponds to.

What is the reason for this?

The reason for using specific builds in CI is to ensure repeatable behavior in CI.

Should we update it?

If there's a newer CIPD package already available, I'd be happy to review a PR to update it. It was current as of about a year ago, and there hasn't been a need to update it.

Should we update the documentation on how to setup the correct version of clang-format? I've accidentally checked in these formatting changes a few times and goofed up PRs.

It's not-trivial to set up an identical version locally, and this doesn't come up all that often. There's an issue tracking doing this IIRC, but it hasn't been a priority. I'm happy to review a PR for that as well.

@Rexios80
Copy link
Member Author

Rexios80 commented Aug 1, 2024

We should definitely do something about this. It's not a great developer experience (especially for new contributors) to have untouched files change by running the format command.

@Rexios80
Copy link
Member Author

Rexios80 commented Aug 1, 2024

@stuartmorgan See #7271

@Rexios80 Rexios80 closed this Aug 1, 2024
@stuartmorgan
Copy link
Contributor

We should definitely do something about this. It's not a great developer experience (especially for new contributors) to have untouched files change by running the format command.

If clang is updated to a newer version that what all the contributors who don't currently have that problem are using, then they will start having that problem. There's no solution that will work for everyone unless the repo tooling manages a clang-format version itself (which is a lot of extra complexity).

@Rexios80
Copy link
Member Author

Rexios80 commented Aug 1, 2024

There's no solution that will work for everyone unless the repo tooling manages a clang-format version itself (which is a lot of extra complexity).

Yeah I'm thinking we just add a note to the readme for flutter_plugin_tools about this. Anything else would be a lot of extra work.

auto-submit bot pushed a commit that referenced this pull request Aug 2, 2024
This repo uses clang 15 to format files. Newer versions of clang format code differently. This PR adds a note to the tool README about this and adds sample instructions for how to install clang 15 on macOS. We might want to add instructions for other platforms.

Fixes flutter/flutter#152651

Additional context
- #7267
- #7271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants