Giter VIP home page Giter VIP logo

Comments (6)

artificiel avatar artificiel commented on June 2, 2024 2

hello @hiroMTB!

since last year there is a .clang-format file in the repository. it follows pretty well the previous formatting, with a little bit more spaces around some markers.

about auto-formatting, there was sort of a "soft decision" made not to blanket the git history with a "clang-format" white-space commits, but to reformat when a file needs a change (the commits being squashed, it can be performed as a separate commit in for the PR review, but it will no show up in the final history/blame (and the whitespace exclusion in git works relatively well to not register as "changes")).

also sometimes macros and "nicely indented data tables" are better to exclude from clang-format, which means a manual review is always preferable after a reformat.

there are different ways to apply the formatting; the git clang-format is one, and I use this automator approach on Xcode.

from openframeworks.

dimitre avatar dimitre commented on June 2, 2024 1

it would be great to format the entire core in one PR, but this has the potential to break a lot of PRs.
I think it is ok if it is right before the next release

from openframeworks.

hiroMTB avatar hiroMTB commented on June 2, 2024

Wow! Thank you for your detailed explanation. I will try clang-format and automator.

if we rely on manual review, probably we will keep seeing indent errors for future. But I can understand your point too.
Maybe we can arrange "format party" every month🤣

from openframeworks.

hiroMTB avatar hiroMTB commented on June 2, 2024

oh! I see, good point!
Btw, how do the other big C++ projects manage this issue? Maintainers do it manually?

from openframeworks.

artificiel avatar artificiel commented on June 2, 2024

well when I looked last year nothing clear was found, and I subscribed here NVIDIA/stdexec#905 thinking that when @ericniebler figures it out we can evaluate their choices...

from openframeworks.

danoli3 avatar danoli3 commented on June 2, 2024

clang-format is definitely the way.

However it does not explicitly support A Style.
We can override this by adding a .clang-format file in root directory with some custom settings to make it more A Style:

---
Language:        Cpp
# Based on Google style as a starting point
BasedOnStyle:  Google

# Indentation width
IndentWidth:     4

# Use spaces instead of tabs for indentation
UseTab:          Never

# Brace wrapping
BraceWrapping:
  AfterClass:      true
  AfterControlStatement: true
  AfterEnum:       true
  AfterFunction:   true
  AfterNamespace:  true
  AfterStruct:     true
  AfterUnion:      true
  BeforeCatch:     true
  BeforeElse:      true
  IndentBraces:    false

# Column limit
ColumnLimit:     80

# Pointer and reference alignment
PointerAlignment: Left

# Includes sorting
IncludeCategories:
  - Regex:           '^<ext/.*\.h>'
    Priority:        2
  - Regex:           '^<.*\.h>'
    Priority:        1
  - Regex:           '^".*'
    Priority:        0
IncludeBlocks:   Regroup

# Control the alignment of assignments
AlignConsecutiveAssignments: true

# Control the alignment of declarations
AlignConsecutiveDeclarations: true

from openframeworks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.