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

crlfmt doesn't let me wrap function calls at less than 100 chars #5

Open
andreimatei opened this issue Oct 5, 2016 · 1 comment
Open
Assignees
Labels

Comments

@andreimatei
Copy link
Contributor

The tool is removing wraps that I've added by hand. I think this is going way too far.
Radu raised the issue too in cockroachdb/cockroach#8823 (comment) but a quick discussion concluded that "less options is better". I'd like to revisit that. If I chose to wrap, let it be.
To lawyer up, this rule is not in the style guide. The style guide has vague wording saying to assume code is gonna be read on 100 cols terminals and to wrap at 100, but I'm pretty sure the intent was to set an upper bound.

Before:
func createTestClientForUser(
  t *testing.T,
  stopper *stop.Stopper,
  addr, user string,
  dbCtx client.DBContext,       
) *client.DB {


After:
func createTestClientForUser(
  t *testing.T, stopper *stop.Stopper, addr, user string, dbCtx 
 ) *client.DB {

cc @RaduBerinde @knz @paperstreet

@RaduBerinde
Copy link
Member

I don't see a problem if the tool allows this. 100 is indeed an upper bound, and there is no suggestion that you should always try to fit stuff on one line.

I believe this will require a bit more logic to detect if it is correctly formatted (because if it isn't, crlfmt will have to reformat it), so if we implement this I think it would be a good time to add some tests. The test cases could be stored in file pairs (input and expected output).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants