diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/rocksdb/build_tools/check-sources.sh | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | src/rocksdb/build_tools/check-sources.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/rocksdb/build_tools/check-sources.sh b/src/rocksdb/build_tools/check-sources.sh new file mode 100755 index 000000000..5672f7b2b --- /dev/null +++ b/src/rocksdb/build_tools/check-sources.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. +# +# Check for some simple mistakes that should prevent commit or push + +BAD="" + +git grep -n 'namespace rocksdb' -- '*.[ch]*' +if [ "$?" != "1" ]; then + echo "^^^^^ Do not hardcode namespace rocksdb. Use ROCKSDB_NAMESPACE" + BAD=1 +fi + +git grep -n -i 'nocommit' -- ':!build_tools/check-sources.sh' +if [ "$?" != "1" ]; then + echo "^^^^^ Code was not intended to be committed" + BAD=1 +fi + +git grep -n 'include <rocksdb/' -- ':!build_tools/check-sources.sh' +if [ "$?" != "1" ]; then + echo '^^^^^ Use double-quotes as in #include "rocksdb/something.h"' + BAD=1 +fi + +git grep -n 'include "include/rocksdb/' -- ':!build_tools/check-sources.sh' +if [ "$?" != "1" ]; then + echo '^^^^^ Use #include "rocksdb/something.h" instead of #include "include/rocksdb/something.h"' + BAD=1 +fi + +git grep -n 'using namespace' -- ':!build_tools' ':!docs' \ + ':!third-party/folly/folly/lang/Align.h' \ + ':!third-party/gtest-1.8.1/fused-src/gtest/gtest.h' +if [ "$?" != "1" ]; then + echo '^^^^ Do not use "using namespace"' + BAD=1 +fi + +git grep -n -P "[\x80-\xFF]" -- ':!docs' ':!*.md' +if [ "$?" != "1" ]; then + echo '^^^^ Use only ASCII characters in source files' + BAD=1 +fi + +if [ "$BAD" ]; then + exit 1 +fi |