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

Gazelle: sort srcs and deps string lists in buildifier order #613

Merged
merged 2 commits into from
Jul 10, 2017

Conversation

jayconrod
Copy link
Contributor

This is a workaround for bazelbuild/buildtools#122. When buildifier
sorts lists, it only processes list expressions as arguments for
certain attributes. It doesn't process lists inside select or lists
concatenated with select. When that bug is fixed, this code can be
removed.

Fixes #584

This is a workaround for bazelbuild/buildtools#122. When buildifier
sorts lists, it only processes list expressions as arguments for
certain attributes. It doesn't process lists inside select or lists
concatenated with select. When that bug is fixed, this code can be
removed.

Fixes bazel-contrib#584
@jayconrod jayconrod requested a review from ianthehat July 7, 2017 23:04
@jayconrod
Copy link
Contributor Author

I ran this version of Gazelle on Kubernetes, and it's starting to look pretty good. There are a lot of changes, but nearly all of them are reasonable now (e.g., moving platform specific files to select).

continue
}
bf.Walk(attr.Y, func(e bf.Expr, _ []bf.Expr) {
list, ok := e.(*bf.ListExpr)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably have extracted this to a named function.
I don't think it's closing over any variables, so it's reasonably discrete, and I generally try to avoid long lambdas with return statements, it's really hard to see what the return will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jayconrod jayconrod merged commit f6dd5ae into bazel-contrib:master Jul 10, 2017
@jayconrod jayconrod deleted the gazelle-sort-deps branch July 10, 2017 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gazelle attribute sorting
3 participants