lbryio / lbrycrd

The blockchain that provides the digital content namespace for the LBRY protocol
https://lbry.com
MIT License
2.57k stars 178 forks source link

mandatory code formatting complicates code reviews #200

Closed BrannonKing closed 4 years ago

BrannonKing commented 6 years ago

The code formatting script makes the author's exact changes ambiguous, leading to more complicated code reviews. Reviews would be easier if PRs came in without additional formatting changes.

Options:

We don't currently run code formatting tools on Windows. In addition, the code formatting tools on OSX have proven to have some compatibility differences. Testing and developing on OSX can also be problematic if no one on the team is actively using that OS.

lbrynaut commented 6 years ago

In this model, It's up to the PR author to run formatting to ensure it passes the diff check before issuing it. Maybe that isn't the right answer, but that's what the current checking is trying to enforce.

If we're not going to use this model, I'd like to see (after the upstream merge) some kind of automated formatter that just runs clang-format nightly across the entire code base and commits changes if any.

The advantage to how it is now is that it guarantees reviewers don't have to page through useless style changes (made manually or automatically by some editors). I suspect removing this will further complicate the review process.

bvbfan commented 6 years ago

If we're not going to use this model, I'd like to see (after the upstream merge) some kind of automated formatter that just runs clang-format nightly across the entire code base and commits changes if any.

It looks good to me.

The advantage to how it is now is that it guarantees reviewers don't have to page through useless style changes (made manually or automatically by some editors).

This is exactly how it should be, about me. I mean these is no guaranteed, just ask author to remove them in RR.

kaykurokawa commented 6 years ago

Don't require the formatting for the build.

I think this is fine. Because as we've discussed , many areas of the code do not conform to standard formatting and it creates very inconsistent looking code if the PR is a small change. So maybe it is best to ignore formatting issues returned by the clang auto format tool in some cases. And yes its also annoying to have to review formatting changes together with the actual change.

But I still think we should run it anyways individually, and have it show up on travis so that we have some way of enforcing formatting where we need to. Just that we can choose to ignore it in certain situations.

Have the person doing the merge run the formatting tool as part of that step.

I think this could be fine, or there could be seperate PR's just to correct the formatting. Or maybe it can be something automated? If its automated, I think it should not run on the entire code base, maybe just for the claimtrie code or just for any new commits.

BrannonKing commented 4 years ago

It's no longer part of the build.