Skip to content

Brainstorm .clang-format proposal#87

Closed
mloskot wants to merge 1 commit intoboostorg:developfrom
mloskot:ml/brainstorm-clang-format
Closed

Brainstorm .clang-format proposal#87
mloskot wants to merge 1 commit intoboostorg:developfrom
mloskot:ml/brainstorm-clang-format

Conversation

@mloskot
Copy link
Member

@mloskot mloskot commented Apr 28, 2018

IMPORTANT: This is NOT ready to merge, this may NEVER be merged. It aims to serve as subject for discussion if and how clang-format may become useful for us.

Description

Following 90 100 character column limit, I decided to try clang-format and start development of annotated .clang-format configuration file that may be useful for Boost.GIL

Please, consider this as a proposal to brainstorm, try and refine .clang-format for Boost.GIL.

Goals:

  • Provide .clang-format with reasonable defaults for Boost.GIL as a basic formatting guideline and helper.
  • Support edit - select (class, function) - format workflow with consistent settings across editors.
  • Help for manual formatting: run clang-format first, then adjust formatting in those (few) palces where necessary.
  • Use clang-format from its latest release.

No goals:

  • No automatic reformat on file save or pre-commit is proposed.
  • No bulk reformat is proposed.
  • No CI build running clang-format verifying code style.

Environment

  • clang-forma 5.0 or later

@mloskot mloskot requested a review from a team April 28, 2018 22:06
@chhenning
Copy link
Contributor

Can you add a couple of problematic files which would benefit? Just so I can see a difference.

Also, are these tools good enough for complicated templated code?

@mloskot
Copy link
Member Author

mloskot commented Apr 30, 2018

@chhenning

Can you add a couple of problematic files which would benefit? Just so I can see a difference.

No, sorry, I can't. I didn't have time to provide you guys with comprehensive picture that you can just have a look at.

I just aim to provided anyone interested in trying out clang-format with basic playground:

You will have to run it yourself on a whole file or selection/parts of file only that you are interested to see the clang-format-ing effect for. Then, I assume, you may want to tweak the .clang-format configuration, run again. Once you find your preferred formatting for certain aspects of Boost.GIL code, then you come back with comments and suggest modification to this PR.

So, this PR should be labelled not for lazy ones ;)

Also, are these tools good enough for complicated templated code?

What is good enough, what do you consider good enough, what is a complicated templated code. I mean, you are asking difficult questions ;)

In my personal opinion, clang-format has limitations as any code formatting tool, but clang-format is a tool that has the best capacity of all open source tools currently available in the wild.

Finally, please keep in mind this PR is tagged with WIP and Brainstorm for reason. I'm not even convinced myself that clang-format can cover Boost.GIL code formatting requirements. So, let's try...

@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch 2 times, most recently from ed244b9 to 3214179 Compare June 24, 2018 22:16
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch 2 times, most recently from 0105ce8 to 9293966 Compare November 5, 2018 18:37
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch from 9293966 to a7a0467 Compare December 5, 2018 21:21
@mloskot mloskot added cat/enhancement Improvements, but not fixes addressing identified bugs cat/refactoring Any nonfunctional changes status/need-feedback Asking for more details about the problem labels Dec 5, 2018
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch 2 times, most recently from 0df6eb7 to 8dd4c6b Compare December 17, 2018 08:57
@mloskot mloskot added the status/work-in-progress Do NOT merge yet until this label has been removed! label Dec 17, 2018
@mloskot mloskot changed the title WIP: Brainstorm .clang-format proposal Brainstorm .clang-format proposal Dec 17, 2018
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch from 8dd4c6b to cb61565 Compare January 16, 2019 17:37
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch from cb61565 to fde4f3e Compare January 27, 2019 00:43
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch from fde4f3e to cf957f6 Compare February 27, 2019 09:48
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch from cf957f6 to c024050 Compare July 26, 2019 21:09
@mloskot
Copy link
Member Author

mloskot commented Jul 26, 2019

I have just asked the StackOverflow for advise on desire formatting using clang-format

Can clang-format split template parameters list in multiple lines?

@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch 3 times, most recently from 38b5cbf to b0fec19 Compare July 30, 2019 20:40
@mloskot
Copy link
Member Author

mloskot commented Jul 31, 2019

I answered a StackOverflow question on spacing and breaking trailing return type with clang-format which is also related to desired formatting discussed here.

@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch from b0fec19 to b21eadf Compare March 22, 2020 17:34
Following column limit agreement, consider this as proposal to
brainstorm, try and refine `.clang-format` for Boost.GIL.

Goals:
- Provide `.clang-format` with reasonable defaults for Boost.GIL
  as a basic formatting guideline and helper.
- Support edit - select (class, function) - format workflow
  with consistent settings across editors.
- Help for manual formatting: run `clang-format` first, then adjust
  formatting in those (few) places where necessary.
- Use `clang-format` from its latest release.

No goals:
- No automatic reformat on file save or pre-commit is proposed.
- No bulk reformat of the whole codebase is proposed.
- No CI build running clang-format verifying code style, however,
  this may be added in future to ensure maintenance of consistent style.

[ci skip]
@mloskot mloskot force-pushed the ml/brainstorm-clang-format branch from b21eadf to ba49b7f Compare March 22, 2020 19:28
@mloskot mloskot removed the status/need-feedback Asking for more details about the problem label Mar 25, 2020
@mloskot mloskot removed the status/work-in-progress Do NOT merge yet until this label has been removed! label Mar 25, 2020
@mloskot mloskot self-assigned this Mar 25, 2020
@mloskot mloskot closed this in 23702f9 Mar 25, 2020
@mloskot mloskot added example Examples of how to use GIL and removed cat/refactoring Any nonfunctional changes cat/enhancement Improvements, but not fixes addressing identified bugs labels Mar 25, 2020
@mloskot mloskot deleted the ml/brainstorm-clang-format branch March 25, 2020 23:40
@mloskot
Copy link
Member Author

mloskot commented Mar 25, 2020

23702f9 adds good-enough .clang-format to example/clang-format/

This is an example which offers good enough configuration and
may be useful when writing code for GIL, but is not required though.
After using it myself for fair bit of time now, it proved useful, even if code still requires some manual tweaks. This is not a complete configuration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

example Examples of how to use GIL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants