Skip to content

Added .clang-format flie #4

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Przemog1
Copy link
Contributor

Formating settings

  • Access modifiers (public/protected/private) will be aligned to the beginning of the line
  • column limit of 0, which means there is no limitation on how many characters may reside on the same line (if coulum limit would be set to N, then clang format would break line (if possible), when character count in that line exceeds N)
  • no tabs
  • indent: 4 spaces
  • short ifs on a single line are not allowed, so for example:
    if(true) return 0;
    will be changed to:
    if(true)
        return 0;
    
    same for short loops
  • Allow short lambdas on a single line
  • Do not force break after template declarations
  • Always break before empty braces, so for example:
    int foo(){
        //..
    }
    
    will be changed to:
    int foo()
    {
    
    }
    
  • constructor initializer list may reside on a single line, no matter how many characters there are
  • always indent case labels (4 spaces)
  • remove consecutive empty lines, for example:
    int a = 0;
    
    
    int b = 1;
    
    will be changed to:
    int a = 0;
    
    int b = 0;
    
  • remove namespace indentation
  • pointers and references are always aligned to the type, for example: T* Ptr
  • use only LF as a line ending

Alignment:

  • Don't align:
    • params after an open bracket
    • consecutive macros
    • consecutive assignemts
    • consecutive declarations
    • operands
    • consecutive comments
  • Align:
    • escaped lines to the left (multiple line macros)

@devshgraphicsprogramming
Copy link
Member

devshgraphicsprogramming commented Sep 21, 2020

Access modifiers (public/protected/private) will be aligned to the beginning of the line

I prefer them indendented, and then anything under them indented even more.

column limit of 0, which means there is no limitation on how many characters may reside on the same line (if coulum limit would be set to N, then clang format would break line (if possible), when character count in that line exceeds N)

128 or enough characters to fill a 1080p screen.

Do not force break after template declarations

Please do break after templates.

Don't align:

params after an open bracket
consecutive macros
consecutive assignemts
consecutive declarations
operands
consecutive comments

Explain?

@devshgraphicsprogramming
Copy link
Member

update the branch to include armageddo, address the comments above, then apply the clang format on yet another branch so we can see what it produces

@AnastaZIuk
Copy link
Member

[CI]: Can one of the admins verify this patch?

@AnastaZIuk AnastaZIuk force-pushed the master branch 3 times, most recently from a07e79f to ffbd843 Compare January 18, 2024 21:24
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

Successfully merging this pull request may close these issues.

3 participants