-
Notifications
You must be signed in to change notification settings - Fork 666
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
Sort includes #7326
Sort includes #7326
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #7326 +/- ##
==========================================
- Coverage 89.57% 89.05% -0.53%
==========================================
Files 278 278
Lines 59973 59974 +1
Branches 7469 7469
==========================================
- Hits 53723 53409 -314
- Misses 4101 4346 +245
- Partials 2149 2219 +70 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good overall. I left some small suggestions.
Initially I was thinking of not enforcing it on CI, especially since it was looking like a need to introduce a new tool. I'd like to keep the includes in a reasonable shape after we merge this. And as it turns out, it might actually find issues where includes are not always self contained, like the one causing the identification of PG16 RC1 being used by parts of our CI system. |
d7a158a
to
6f54735
Compare
Yeah sounds, good let's add it to CI and probably also |
6f54735
to
a3020b6
Compare
0d32a3d
to
b158d22
Compare
b055f51
to
88bb019
Compare
88bb019
to
8900f46
Compare
Addressed feedback. He is out of office and not able to re-review. Onur has reviewed instead
CHERRY-PICK NOTES: This cherry-pick only includes the scripts, not the actual changes. These are done in a follow up commit to ease further backporting. This change adds a script to programatically group all includes in a specific order. The script was used as a one time invocation to group and sort all includes throught our formatted code. The grouping is as follows: - System includes (eg. `#include<...>`) - Postgres.h (eg. `#include "postgres.h"`) - Toplevel imports from postgres, not contained in a directory (eg. `#include "miscadmin.h"`) - General postgres includes (eg . `#include "nodes/..."`) - Toplevel citus includes, not contained in a directory (eg. `#include "citus_verion.h"`) - Columnar includes (eg. `#include "columnar/..."`) - Distributed includes (eg. `#include "distributed/..."`) Because it is quite hard to understand the difference between toplevel citus includes and toplevel postgres includes it hardcodes the list of toplevel citus includes. In the same manner it assumes anything not prefixed with `columnar/` or `distributed/` as a postgres include. The sorting/grouping is enforced by CI. Since we do so with our own script there are not changes required in our uncrustify configuration. (cherry picked from commit 0620c8f)
CHERRY-PICK NOTES: This cherry-pick only includes the scripts, not the actual changes. These are done in a follow up commit to ease further backporting. This change adds a script to programatically group all includes in a specific order. The script was used as a one time invocation to group and sort all includes throught our formatted code. The grouping is as follows: - System includes (eg. `#include<...>`) - Postgres.h (eg. `#include "postgres.h"`) - Toplevel imports from postgres, not contained in a directory (eg. `#include "miscadmin.h"`) - General postgres includes (eg . `#include "nodes/..."`) - Toplevel citus includes, not contained in a directory (eg. `#include "citus_verion.h"`) - Columnar includes (eg. `#include "columnar/..."`) - Distributed includes (eg. `#include "distributed/..."`) Because it is quite hard to understand the difference between toplevel citus includes and toplevel postgres includes it hardcodes the list of toplevel citus includes. In the same manner it assumes anything not prefixed with `columnar/` or `distributed/` as a postgres include. The sorting/grouping is enforced by CI. Since we do so with our own script there are not changes required in our uncrustify configuration. (cherry picked from commit 0620c8f)
CHERRY-PICK NOTES: This cherry-pick only includes the scripts, not the actual changes. These are done in a follow up commit to ease further backporting. This change adds a script to programatically group all includes in a specific order. The script was used as a one time invocation to group and sort all includes throught our formatted code. The grouping is as follows: - System includes (eg. `#include<...>`) - Postgres.h (eg. `#include "postgres.h"`) - Toplevel imports from postgres, not contained in a directory (eg. `#include "miscadmin.h"`) - General postgres includes (eg . `#include "nodes/..."`) - Toplevel citus includes, not contained in a directory (eg. `#include "citus_verion.h"`) - Columnar includes (eg. `#include "columnar/..."`) - Distributed includes (eg. `#include "distributed/..."`) Because it is quite hard to understand the difference between toplevel citus includes and toplevel postgres includes it hardcodes the list of toplevel citus includes. In the same manner it assumes anything not prefixed with `columnar/` or `distributed/` as a postgres include. The sorting/grouping is enforced by CI. Since we do so with our own script there are not changes required in our uncrustify configuration. (cherry picked from commit 0620c8f)
This change adds a script to programatically group all includes in a specific order. The script was used as a one time invocation to group and sort all includes throught our formatted code. The grouping is as follows:
#include<...>
)#include "postgres.h"
)#include "miscadmin.h"
)#include "nodes/..."
)#include "citus_verion.h"
)#include "columnar/..."
)#include "distributed/..."
)Because it is quite hard to understand the difference between toplevel citus includes and toplevel postgres includes it hardcodes the list of toplevel citus includes. In the same manner it assumes anything not prefixed with
columnar/
ordistributed/
as a postgres include.The sorting/grouping is enforced by CI. Since we do so with our own script there are not changes required in our uncrustify configuration.