ClickHouse/utils/check-style/check-ungrouped-includes.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

9 lines
403 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
ROOT_PATH=$(git rev-parse --show-toplevel)
# Find files with includes not grouped together by first component of path
2020-04-14 07:14:22 +00:00
find $ROOT_PATH/src -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