From b8eb32f8cf5041087146b7b8ee85ec8fa34dd857 Mon Sep 17 00:00:00 2001 From: Mark Isaacson Date: Mon, 29 Jan 2018 12:43:56 -0800 Subject: [PATCH] Suppress lint in old files Summary: Grandfather in super old lint issues to make a clean slate for moving forward that allows us to have stronger enforcement on new issues. Reviewed By: yiwu-arbug Differential Revision: D6821806 fbshipit-source-id: 22797d31ec58e9eb0255d3b66fedfcfcb0dc127c --- buckifier/buckify_rocksdb.py | 2 +- buckifier/rocks_test_runner.sh | 1 + build_tools/cont_integration.sh | 2 ++ build_tools/dependencies.sh | 1 + build_tools/dependencies_4.8.1.sh | 1 + build_tools/make_package.sh | 5 +++++ coverage/parse_gcov_output.py | 2 +- db/log_reader.h | 1 + hdfs/setup.sh | 1 + java/jdb_bench.sh | 2 ++ java/rocksjni/compaction_filter_factory.cc | 1 + java/rocksjni/ingest_external_file_options.cc | 1 + java/rocksjni/jnicallback.cc | 1 + java/rocksjni/jnicallback.h | 1 + java/rocksjni/rocks_callback_object.cc | 1 + java/rocksjni/statisticsjni.cc | 1 + java/rocksjni/statisticsjni.h | 1 + table/cuckoo_table_builder_test.cc | 1 + tools/auto_sanity_test.sh | 1 + tools/benchmark.sh | 1 + tools/benchmark_leveldb.sh | 1 + tools/db_crashtest.py | 2 +- tools/ldb_test.py | 4 ++-- tools/regression_test.sh | 1 + tools/rocksdb_dump_test.sh | 1 + tools/write_stress_runner.py | 2 +- utilities/env_librados.cc | 1 + utilities/simulator_cache/sim_cache.cc | 1 + utilities/simulator_cache/sim_cache_test.cc | 1 + utilities/ttl/ttl_test.cc | 1 + 30 files changed, 37 insertions(+), 6 deletions(-) diff --git a/buckifier/buckify_rocksdb.py b/buckifier/buckify_rocksdb.py index a3c8be3b1..6d4136468 100644 --- a/buckifier/buckify_rocksdb.py +++ b/buckifier/buckify_rocksdb.py @@ -36,7 +36,7 @@ def parse_src_mk(repo_path): # get all .cc / .c files def get_cc_files(repo_path): cc_files = [] - for root, dirnames, filenames in os.walk(repo_path): + for root, dirnames, filenames in os.walk(repo_path): # noqa: B007 T25377293 Grandfathered in root = root[(len(repo_path) + 1):] if "java" in root: # Skip java diff --git a/buckifier/rocks_test_runner.sh b/buckifier/rocks_test_runner.sh index e1f48a760..baca6c2e4 100755 --- a/buckifier/rocks_test_runner.sh +++ b/buckifier/rocks_test_runner.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash # Create a tmp directory for the test to use TEST_DIR=$(mktemp -d /dev/shm/fbcode_rocksdb_XXXXXXX) +# shellcheck disable=SC2068 TEST_TMPDIR="$TEST_DIR" $@ && rm -rf "$TEST_DIR" diff --git a/build_tools/cont_integration.sh b/build_tools/cont_integration.sh index 06f25c596..66d255227 100755 --- a/build_tools/cont_integration.sh +++ b/build_tools/cont_integration.sh @@ -13,10 +13,12 @@ error=0 function log { DATE=`date +%Y-%m-%d:%H:%M:%S` + # shellcheck disable=SC2068 echo $DATE $@ } function log_err { + # shellcheck disable=SC2145 log "ERROR: $@ Error code: $error." } diff --git a/build_tools/dependencies.sh b/build_tools/dependencies.sh index 06c709714..78f4393b9 100644 --- a/build_tools/dependencies.sh +++ b/build_tools/dependencies.sh @@ -1,3 +1,4 @@ +# shellcheck disable=SC2148 GCC_BASE=/mnt/gvfs/third-party2/gcc/8219ec1bcedf8ad9da05e121e193364de2cc4f61/5.x/centos6-native/c447969 CLANG_BASE=/mnt/gvfs/third-party2/llvm-fb/64d8d58e3d84f8bde7a029763d4f5baf39d0d5b9/stable/centos6-native/6aaf4de LIBGCC_BASE=/mnt/gvfs/third-party2/libgcc/ba9be983c81de7299b59fe71950c664a84dcb5f8/5.x/gcc-5-glibc-2.23/339d858 diff --git a/build_tools/dependencies_4.8.1.sh b/build_tools/dependencies_4.8.1.sh index ef0cda239..bd02165d8 100644 --- a/build_tools/dependencies_4.8.1.sh +++ b/build_tools/dependencies_4.8.1.sh @@ -1,3 +1,4 @@ +# shellcheck disable=SC2148 GCC_BASE=/mnt/gvfs/third-party2/gcc/cf7d14c625ce30bae1a4661c2319c5a283e4dd22/4.8.1/centos6-native/cc6c9dc CLANG_BASE=/mnt/gvfs/third-party2/llvm-fb/8598c375b0e94e1448182eb3df034704144a838d/stable/centos6-native/3f16ddd LIBGCC_BASE=/mnt/gvfs/third-party2/libgcc/d6e0a7da6faba45f5e5b1638f9edd7afc2f34e7d/4.8.1/gcc-4.8.1-glibc-2.17/8aac7fc diff --git a/build_tools/make_package.sh b/build_tools/make_package.sh index 58bac4473..0d86548e8 100755 --- a/build_tools/make_package.sh +++ b/build_tools/make_package.sh @@ -1,3 +1,4 @@ +# shellcheck disable=SC1113 #/usr/bin/env bash set -e @@ -28,12 +29,14 @@ function package() { if dpkg --get-selections | grep --quiet $1; then log "$1 is already installed. skipping." else + # shellcheck disable=SC2068 apt-get install $@ -y fi elif [[ $OS = "centos" ]]; then if rpm -qa | grep --quiet $1; then log "$1 is already installed. skipping." else + # shellcheck disable=SC2068 yum install $@ -y fi fi @@ -52,6 +55,7 @@ function gem_install() { if gem list | grep --quiet $1; then log "$1 is already installed. skipping." else + # shellcheck disable=SC2068 gem install $@ fi } @@ -125,4 +129,5 @@ function main() { include $LIB_DIR } +# shellcheck disable=SC2068 main $@ diff --git a/coverage/parse_gcov_output.py b/coverage/parse_gcov_output.py index 72e8b0723..b007e13b5 100644 --- a/coverage/parse_gcov_output.py +++ b/coverage/parse_gcov_output.py @@ -72,7 +72,7 @@ def display_file_coverage(per_file_coverage, total_coverage): header_template = \ "%" + str(max_file_name_length) + "s\t%s\t%s" separator = "-" * (max_file_name_length + 10 + 20) - print header_template % ("Filename", "Coverage", "Lines") + print header_template % ("Filename", "Coverage", "Lines") # noqa: E999 T25377293 Grandfathered in print separator # -- Print body diff --git a/db/log_reader.h b/db/log_reader.h index c6a471cda..44db67702 100644 --- a/db/log_reader.h +++ b/db/log_reader.h @@ -54,6 +54,7 @@ class Reader { // The Reader will start reading at the first record located at physical // position >= initial_offset within the file. Reader(std::shared_ptr info_log, + // @lint-ignore TXT2 T25377293 Grandfathered in unique_ptr&& file, Reporter* reporter, bool checksum, uint64_t initial_offset, uint64_t log_num); diff --git a/hdfs/setup.sh b/hdfs/setup.sh index ac69b525d..f071b7e31 100644 --- a/hdfs/setup.sh +++ b/hdfs/setup.sh @@ -1,3 +1,4 @@ +# shellcheck disable=SC2148 export USE_HDFS=1 export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server:$JAVA_HOME/jre/lib/amd64:/usr/lib/hadoop/lib/native diff --git a/java/jdb_bench.sh b/java/jdb_bench.sh index 9665de785..0a07fa8e2 100755 --- a/java/jdb_bench.sh +++ b/java/jdb_bench.sh @@ -1,3 +1,4 @@ +# shellcheck disable=SC2148 PLATFORM=64 if [ `getconf LONG_BIT` != "64" ] then @@ -7,4 +8,5 @@ fi ROCKS_JAR=`find target -name rocksdbjni*.jar` echo "Running benchmark in $PLATFORM-Bit mode." +# shellcheck disable=SC2068 java -server -d$PLATFORM -XX:NewSize=4m -XX:+AggressiveOpts -Djava.library.path=target -cp "${ROCKS_JAR}:benchmark/target/classes" org.rocksdb.benchmark.DbBenchmark $@ diff --git a/java/rocksjni/compaction_filter_factory.cc b/java/rocksjni/compaction_filter_factory.cc index 06dc795ac..ae0b02224 100644 --- a/java/rocksjni/compaction_filter_factory.cc +++ b/java/rocksjni/compaction_filter_factory.cc @@ -34,4 +34,5 @@ void Java_org_rocksdb_AbstractCompactionFilterFactory_disposeInternal( auto* ptr_sptr_cff = reinterpret_cast *>(jhandle); delete ptr_sptr_cff; +// @lint-ignore TXT4 T25377293 Grandfathered in } \ No newline at end of file diff --git a/java/rocksjni/ingest_external_file_options.cc b/java/rocksjni/ingest_external_file_options.cc index 251a6e3c6..7bca967da 100644 --- a/java/rocksjni/ingest_external_file_options.cc +++ b/java/rocksjni/ingest_external_file_options.cc @@ -146,4 +146,5 @@ void Java_org_rocksdb_IngestExternalFileOptions_disposeInternal( auto* options = reinterpret_cast(jhandle); delete options; +// @lint-ignore TXT4 T25377293 Grandfathered in } \ No newline at end of file diff --git a/java/rocksjni/jnicallback.cc b/java/rocksjni/jnicallback.cc index 301f46229..f72eecd4c 100644 --- a/java/rocksjni/jnicallback.cc +++ b/java/rocksjni/jnicallback.cc @@ -49,4 +49,5 @@ JniCallback::~JniCallback() { releaseJniEnv(attached_thread); } +// @lint-ignore TXT4 T25377293 Grandfathered in } // namespace rocksdb \ No newline at end of file diff --git a/java/rocksjni/jnicallback.h b/java/rocksjni/jnicallback.h index c3068dec0..940ecf064 100644 --- a/java/rocksjni/jnicallback.h +++ b/java/rocksjni/jnicallback.h @@ -25,4 +25,5 @@ namespace rocksdb { }; } +// @lint-ignore TXT4 T25377293 Grandfathered in #endif // JAVA_ROCKSJNI_JNICALLBACK_H_ \ No newline at end of file diff --git a/java/rocksjni/rocks_callback_object.cc b/java/rocksjni/rocks_callback_object.cc index ddaf83b3f..c5d6c22d3 100644 --- a/java/rocksjni/rocks_callback_object.cc +++ b/java/rocksjni/rocks_callback_object.cc @@ -24,4 +24,5 @@ void Java_org_rocksdb_RocksCallbackObject_disposeInternal( // 2) Comparator -> BaseComparatorJniCallback + JniCallback -> ComparatorJniCallback // I think this is okay, as Comparator and JniCallback both have virtual destructors... delete reinterpret_cast(handle); +// @lint-ignore TXT4 T25377293 Grandfathered in } \ No newline at end of file diff --git a/java/rocksjni/statisticsjni.cc b/java/rocksjni/statisticsjni.cc index 584ab5aa6..3ac1e5b41 100644 --- a/java/rocksjni/statisticsjni.cc +++ b/java/rocksjni/statisticsjni.cc @@ -30,4 +30,5 @@ namespace rocksdb { return true; } +// @lint-ignore TXT4 T25377293 Grandfathered in }; \ No newline at end of file diff --git a/java/rocksjni/statisticsjni.h b/java/rocksjni/statisticsjni.h index 600d9a676..56186789a 100644 --- a/java/rocksjni/statisticsjni.h +++ b/java/rocksjni/statisticsjni.h @@ -30,4 +30,5 @@ namespace rocksdb { } // namespace rocksdb +// @lint-ignore TXT4 T25377293 Grandfathered in #endif // JAVA_ROCKSJNI_STATISTICSJNI_H_ \ No newline at end of file diff --git a/table/cuckoo_table_builder_test.cc b/table/cuckoo_table_builder_test.cc index 93daaca47..d896ed4b1 100644 --- a/table/cuckoo_table_builder_test.cc +++ b/table/cuckoo_table_builder_test.cc @@ -49,6 +49,7 @@ class CuckooBuilderTest : public testing::Test { uint64_t read_file_size; ASSERT_OK(env_->GetFileSize(fname, &read_file_size)); + // @lint-ignore TXT2 T25377293 Grandfathered in Options options; options.allow_mmap_reads = true; ImmutableCFOptions ioptions(options); diff --git a/tools/auto_sanity_test.sh b/tools/auto_sanity_test.sh index 54577ffb7..c98bd661c 100755 --- a/tools/auto_sanity_test.sh +++ b/tools/auto_sanity_test.sh @@ -1,3 +1,4 @@ +# shellcheck disable=SC2148 TMP_DIR="${TMPDIR:-/tmp}/rocksdb-sanity-test" if [ "$#" -lt 2 ]; then diff --git a/tools/benchmark.sh b/tools/benchmark.sh index 1a2c38439..b997b2c11 100755 --- a/tools/benchmark.sh +++ b/tools/benchmark.sh @@ -449,6 +449,7 @@ echo "===== Benchmark =====" # Run!!! IFS=',' read -a jobs <<< $1 +# shellcheck disable=SC2068 for job in ${jobs[@]}; do if [ $job != debug ]; then diff --git a/tools/benchmark_leveldb.sh b/tools/benchmark_leveldb.sh index 776996980..40c7733ce 100755 --- a/tools/benchmark_leveldb.sh +++ b/tools/benchmark_leveldb.sh @@ -151,6 +151,7 @@ echo "===== Benchmark =====" # Run!!! IFS=',' read -a jobs <<< $1 +# shellcheck disable=SC2068 for job in ${jobs[@]}; do if [ $job != debug ]; then diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 0c649722f..6a7222e5b 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -317,7 +317,7 @@ def whitebox_crash_main(args): cmd = gen_cmd(dict(cmd_params.items() + additional_opts.items() + {'db': dbname}.items())) - print "Running:" + ' '.join(cmd) + "\n" + print "Running:" + ' '.join(cmd) + "\n" # noqa: E999 T25377293 Grandfathered in popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) diff --git a/tools/ldb_test.py b/tools/ldb_test.py index 5d52d79c3..fa0ded438 100644 --- a/tools/ldb_test.py +++ b/tools/ldb_test.py @@ -229,7 +229,7 @@ class LDBTestCase(unittest.TestCase): self.assertRunFAIL("get --ttl a3") self.assertRunOK("checkconsistency", "OK") - def testInvalidCmdLines(self): + def testInvalidCmdLines(self): # noqa: F811 T25377293 Grandfathered in print "Running testInvalidCmdLines..." # db not specified self.assertRunFAILFull("put 0x6133 0x6233 --hex --create_if_missing") @@ -516,7 +516,7 @@ class LDBTestCase(unittest.TestCase): def testColumnFamilies(self): print "Running testColumnFamilies..." - dbPath = os.path.join(self.TMP_DIR, self.DB_NAME) + dbPath = os.path.join(self.TMP_DIR, self.DB_NAME) # noqa: F841 T25377293 Grandfathered in self.assertRunOK("put cf1_1 1 --create_if_missing", "OK") self.assertRunOK("put cf1_2 2 --create_if_missing", "OK") self.assertRunOK("put cf1_3 3 --try_load_options", "OK") diff --git a/tools/regression_test.sh b/tools/regression_test.sh index 72eb8bfab..69a53a470 100755 --- a/tools/regression_test.sh +++ b/tools/regression_test.sh @@ -465,4 +465,5 @@ function cleanup_test_directory { ############################################################################ +# shellcheck disable=SC2068 main $@ diff --git a/tools/rocksdb_dump_test.sh b/tools/rocksdb_dump_test.sh index 2cf8c060b..8d9c7f520 100755 --- a/tools/rocksdb_dump_test.sh +++ b/tools/rocksdb_dump_test.sh @@ -1,3 +1,4 @@ +# shellcheck disable=SC2148 TESTDIR=`mktemp -d ${TMPDIR:-/tmp}/rocksdb-dump-test.XXXXX` DUMPFILE="tools/sample-dump.dmp" diff --git a/tools/write_stress_runner.py b/tools/write_stress_runner.py index f69657832..b84dfd3ca 100644 --- a/tools/write_stress_runner.py +++ b/tools/write_stress_runner.py @@ -21,7 +21,7 @@ def generate_runtimes(total_runtime): def main(args): runtimes = generate_runtimes(int(args.runtime_sec)) - print "Going to execute write stress for " + str(runtimes) + print "Going to execute write stress for " + str(runtimes) # noqa: E999 T25377293 Grandfathered in first_time = True for runtime in runtimes: diff --git a/utilities/env_librados.cc b/utilities/env_librados.cc index 4a0b26273..753444da1 100644 --- a/utilities/env_librados.cc +++ b/utilities/env_librados.cc @@ -1485,4 +1485,5 @@ EnvLibrados* EnvLibrados::Default() { default_pool_name); return &default_env; } +// @lint-ignore TXT4 T25377293 Grandfathered in } \ No newline at end of file diff --git a/utilities/simulator_cache/sim_cache.cc b/utilities/simulator_cache/sim_cache.cc index 020cdaa3c..28d8c7a14 100644 --- a/utilities/simulator_cache/sim_cache.cc +++ b/utilities/simulator_cache/sim_cache.cc @@ -89,6 +89,7 @@ class CacheActivityLogger { log_line += key.ToString(true); log_line += " - "; AppendNumberTo(&log_line, size); + // @lint-ignore TXT2 T25377293 Grandfathered in log_line += "\n"; // line format: "ADD - - " diff --git a/utilities/simulator_cache/sim_cache_test.cc b/utilities/simulator_cache/sim_cache_test.cc index 4c175c947..4e9793817 100644 --- a/utilities/simulator_cache/sim_cache_test.cc +++ b/utilities/simulator_cache/sim_cache_test.cc @@ -193,6 +193,7 @@ TEST_F(SimCacheTest, SimCacheLogging) { ASSERT_EQ(add_num, num_block_entries); // Log things again but stop logging automatically after reaching 512 bytes + // @lint-ignore TXT2 T25377293 Grandfathered in int max_size = 512; ASSERT_OK(sim_cache->StartActivityLogging(log_file, env_, max_size)); for (int it = 0; it < 10; it++) { diff --git a/utilities/ttl/ttl_test.cc b/utilities/ttl/ttl_test.cc index dd1ef6e75..c404b9a98 100644 --- a/utilities/ttl/ttl_test.cc +++ b/utilities/ttl/ttl_test.cc @@ -638,6 +638,7 @@ TEST_F(TtlTest, ChangeTtlOnOpenDb) { OpenTtl(1); // T=0:Open the db with ttl = 2 SetTtl(3); + // @lint-ignore TXT2 T25377293 Grandfathered in PutValues(0, kSampleSize_); // T=0:Insert Set1. Delete at t=2 SleepCompactCheck(2, 0, kSampleSize_, true); // T=2:Set1 should be there CloseTtl();