Skip to content

Conversation

@arukuka
Copy link
Member

@arukuka arukuka commented Oct 21, 2022

Summary

  • Add configuration in .clang-format for include orders
    • IncludeBlocks: Preserve

Purpose

Without added IncludeBlocks: Preserve config, we will get include orders that go against Google C++ Style.

exmaple

If the source code we are editing is example.cpp,

  • original
    #include "exmaple.hpp"
    
    #include <iostream>
    #include <atomic>
    
    #include <boost/uuid/uuid.hpp>
    
    #include "projects/other/header.hpp"
  • clang-format applied with current .clang-format
  #include "exmaple.hpp"
  
  #include <atomic>
  #include <boost/uuid/uuid.hpp>
  #include <iostream>
  
  #include "projects/other/header.hpp"
  • Following Google C++ style
    #include "exmaple.hpp"
    
    #include <atomic>
    #include <iostream>
    
    #include <boost/uuid/uuid.hpp>
    
    #include "projects/other/header.hpp"
    • I think that it is desired result
    • this patch will take this result

notation

When this patch is applied, separating include blocks will require human effort.

Contents

Testing Methods Performed

  • run clang-format

@arukuka arukuka merged commit 6eeab9f into main Oct 21, 2022
@arukuka arukuka deleted the feature/otsuka/add_clang-format_config branch October 21, 2022 05:26
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