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

The output should be a little... prettier. #225

Closed
JustinBeckwith opened this issue Nov 18, 2018 · 12 comments
Closed

The output should be a little... prettier. #225

JustinBeckwith opened this issue Nov 18, 2018 · 12 comments
Milestone

Comments

@JustinBeckwith
Copy link
Collaborator

I've run into a number of situations where the output of clang-format just isn't all that readable. In a lot of cases I feel like it makes the formatting of my sources worse.

It makes me a little sad to say it... but I think it's time to really consider a switch over to prettier. I'd be happy to do this work if we have general agreement, but I wanted to get the conversation started here first.

The only real debate in my mind here is if we should be strictly adhering to the Google style guide. IMO - this really doesn't matter 🤷‍♂️ I'm actually fine with whatever the default prettier config looks like. All I care about is that it's consistent :)

Thoughts? @google/google-node-team

@ofrobots
Copy link
Contributor

If we think clang-format is making things objectively worse, the right thing to do would be to open a bug against clang-format first.

The think I am worried about is that – aesthetics being subjective – prettier may have some formatting issues that we might not like. This may end up being churn, and we would need some signal that 1) clang-format is not able to live up to our expectations (objectively) and 2) prettier is going to be better.

I'm sympathetic to this, but I want to make sure we have data that this is not going to be just moving furniture. We need to be sure this is an improvement.

@JustinBeckwith
Copy link
Collaborator Author

I think we have evidence in #215, #214, #156, and a variety of other issues that have come up. What sort of data do you have in mind?

@ofrobots
Copy link
Contributor

ofrobots commented Dec 7, 2018

Have we opened clang-format bugs for any of these issues? What's the disposition on those bugs?

@JustinBeckwith
Copy link
Collaborator Author

I have not. Do they have a github repo they monitor?

@JustinBeckwith
Copy link
Collaborator Author

Just found another one:

 * For a complete list of examples, see the [samples]
 * {@link https://github.com/googleapis/google-auth-library-nodejs/tree/master/samples}.

Is changed to:

 * For a complete list of examples, see the [samples]
 * {@link
 * https://github.com/googleapis/google-auth-library-nodejs/tree/master/samples}.

This changes the semantic meaning of the jsdoc tag and breaks our docs :(

@ofrobots
Copy link
Contributor

ofrobots commented Dec 9, 2018

Are you up to submitting a PR?

@JustinBeckwith
Copy link
Collaborator Author

Of course :)

@ofrobots
Copy link
Contributor

ofrobots commented Dec 9, 2018

To be clear: "I don't like how clang-format formats code" is not a good reason to switch formatters. What we need to demonstrate is that 1) it is not easy for JS folks to fix issues in clang-format, and 2) the existing team is not very responsive on fixing issues.

It is a given that prettier is going to be easier for JS folks to work with and fix issues in. clang-format is written in C++.

For the latter, I went and found a bug that @JustinBeckwith opened against clang-format in April that hasn't gotten looked at.

@JustinBeckwith
Copy link
Collaborator Author

Not to pile on, but my question the monitored github repo was a bit leading :) Even if they have a b/ component, that's just not going to be reasonable for any external folk that want to open a bug.

@ofrobots
Copy link
Contributor

ofrobots commented Dec 9, 2018

I believe this is the llvm component where clang-format bugs could also be opened: https://bugs.llvm.org/buglist.cgi?bug_status=__open__&component=Formatter&product=clang.

@43081j
Copy link

43081j commented Jan 23, 2019

The unconfigurable styling prettier uses is very different to google's clang style so it would be nicer to keep using clang-format if the problems could be fixed.

Also see #247 which is another edge case it has trouble with.

@ofrobots
Copy link
Contributor

ofrobots commented Feb 6, 2019

Fixed by #259.

@ofrobots ofrobots closed this as completed Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants