From 57e038c754313c304839f066582a509a534185d2 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 10 Feb 2019 20:40:18 +0300 Subject: [PATCH] Added a script to check for ungrouped includes --- utils/check-style/check-ungrouped-includes.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 utils/check-style/check-ungrouped-includes.sh diff --git a/utils/check-style/check-ungrouped-includes.sh b/utils/check-style/check-ungrouped-includes.sh new file mode 100755 index 00000000000..c394c8a04c3 --- /dev/null +++ b/utils/check-style/check-ungrouped-includes.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ROOT_PATH=$(git rev-parse --show-toplevel) + +# Find files with includes not grouped together by first component of path +find $ROOT_PATH/dbms -name '*.h' -or -name '*.cpp' | while read file; do + [[ $(grep -oP '^#include <\w+' $file | uniq -c | wc -l) > $(grep -oP '^#include <\w+' $file | sort | uniq -c | wc -l) ]] && echo $file && grep -oP '^#include <\w+' $file | uniq -c; +done