diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5a96af48bbd9d..7d9db3da0e200 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,16 +12,16 @@ files: >- )$ repos: - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v15.0.7 + rev: v17.0.5 hooks: - id: clang-format - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: mixed-line-ending - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.6 hooks: - id: codespell args: diff --git a/src/rgw/driver/sfs/sfs_lc.cc b/src/rgw/driver/sfs/sfs_lc.cc index d171c103ccc70..fb6013beb3d7e 100644 --- a/src/rgw/driver/sfs/sfs_lc.cc +++ b/src/rgw/driver/sfs/sfs_lc.cc @@ -57,7 +57,8 @@ int SFSLifecycle::get_next_entry( int SFSLifecycle::set_entry(const std::string& oid, LCEntry& entry) { rgw::sal::sfs::sqlite::SQLiteLifecycle sqlite_lc(store->db_conn); rgw::sal::sfs::sqlite::DBOPLCEntry db_entry{ - oid, entry.get_bucket(), entry.get_start_time(), entry.get_status()}; + oid, entry.get_bucket(), entry.get_start_time(), entry.get_status() + }; sqlite_lc.store_entry(db_entry); return 0; } @@ -96,7 +97,8 @@ int SFSLifecycle::get_head( int SFSLifecycle::put_head(const std::string& oid, LCHead& head) { rgw::sal::sfs::sqlite::SQLiteLifecycle sqlite_lc(store->db_conn); rgw::sal::sfs::sqlite::DBOPLCHead db_head{ - oid, head.get_marker(), head.get_start_date()}; + oid, head.get_marker(), head.get_start_date() + }; sqlite_lc.store_head(db_head); return 0; } diff --git a/src/rgw/driver/sfs/sqlite/retry.h b/src/rgw/driver/sfs/sqlite/retry.h index 0bd6996bb9df4..07c0af100a25c 100644 --- a/src/rgw/driver/sfs/sqlite/retry.h +++ b/src/rgw/driver/sfs/sqlite/retry.h @@ -89,7 +89,7 @@ class RetrySQLiteBusy { return std::nullopt; }; - /// successful returns true if fn finished successful, possilby + /// successful returns true if fn finished successful, possibly /// after retries bool successful() { return m_successful; }; /// failed_error returns the non-critical error code of the last diff --git a/src/rgw/driver/sfs/types.cc b/src/rgw/driver/sfs/types.cc index 3f4bee8207259..d8761dd689e44 100644 --- a/src/rgw/driver/sfs/types.cc +++ b/src/rgw/driver/sfs/types.cc @@ -87,7 +87,8 @@ Object* Object::create_from_db_version( .size = version.size, .etag = version.etag, .mtime = version.mtime, - .delete_at = version.delete_time}; + .delete_at = version.delete_time + }; result->attrs = version.attrs; return result; } @@ -106,7 +107,8 @@ Object* Object::create_from_db_version( .size = sqlite::get_size(version), .etag = sqlite::get_etag(version), .mtime = sqlite::get_mtime(version), - .delete_at = sqlite::get_delete_time(version)}; + .delete_at = sqlite::get_delete_time(version) + }; result->attrs = sqlite::get_attrs(version); return result; } @@ -164,7 +166,8 @@ Object* Object::try_fetch_from_database( .size = version->size, .etag = version->etag, .mtime = version->mtime, - .delete_at = version->delete_time}; + .delete_at = version->delete_time + }; result->attrs = version->attrs; return result; diff --git a/src/rgw/rgw_sal_sfs.cc b/src/rgw/rgw_sal_sfs.cc index 633f1e586b9be..02d652bc26ec8 100644 --- a/src/rgw/rgw_sal_sfs.cc +++ b/src/rgw/rgw_sal_sfs.cc @@ -592,7 +592,8 @@ SFStore::custom_metric_fns() { perfcounter_type_d::PERFCOUNTER_U64, "sfs_sqlite_connection_count", static_cast(sqlite_fds) ); - }}; + } + }; return fns; } diff --git a/src/rgw/rgw_status_frontend.cc b/src/rgw/rgw_status_frontend.cc index 2d441c547f6b2..411258ba08eae 100644 --- a/src/rgw/rgw_status_frontend.cc +++ b/src/rgw/rgw_status_frontend.cc @@ -155,8 +155,8 @@ RGWStatusFrontend::RGWStatusFrontend( acceptor( ioc, {net::ip::make_address(conf->get_val("bind", "127.0.0.1")), - static_cast(std::stoi(conf->get_val("port", "9090")) - )} + static_cast(std::stoi(conf->get_val("port", "9090"))) + } ), socket(ioc), server_thread(this) {} diff --git a/src/test/rgw/sfs/test_rgw_sfs_object_state_machine.cc b/src/test/rgw/sfs/test_rgw_sfs_object_state_machine.cc index 8bea72fe18f8d..517d5640ea970 100644 --- a/src/test/rgw/sfs/test_rgw_sfs_object_state_machine.cc +++ b/src/test/rgw/sfs/test_rgw_sfs_object_state_machine.cc @@ -268,7 +268,8 @@ TEST_F( const std::array objects = { bucket->create_version(rgw_obj_key("foo", "version1")), bucket->create_version(rgw_obj_key("foo", "version2")), - bucket->create_version(rgw_obj_key("foo", "version3"))}; + bucket->create_version(rgw_obj_key("foo", "version3")) + }; ASSERT_EQ(database_object_state(objects[0]), ObjectState::OPEN); ASSERT_EQ(database_object_state(objects[1]), ObjectState::OPEN); ASSERT_EQ(database_object_state(objects[2]), ObjectState::OPEN); @@ -292,7 +293,8 @@ TEST_F( const std::array objects = { bucket->create_version(rgw_obj_key("foo", "version1")), bucket->create_version(rgw_obj_key("foo", "version2")), - bucket->create_version(rgw_obj_key("foo", "version3"))}; + bucket->create_version(rgw_obj_key("foo", "version3")) + }; ASSERT_TRUE(objects[0]->metadata_finish(store.get(), true)); ASSERT_EQ(database_object_state(objects[0]), ObjectState::COMMITTED); ASSERT_EQ(database_object_state(objects[1]), ObjectState::OPEN); diff --git a/src/test/rgw/sfs/test_rgw_sfs_retry.cc b/src/test/rgw/sfs/test_rgw_sfs_retry.cc index 05a9ef7239ec4..bfd27f2982078 100644 --- a/src/test/rgw/sfs/test_rgw_sfs_retry.cc +++ b/src/test/rgw/sfs/test_rgw_sfs_retry.cc @@ -44,7 +44,8 @@ TEST_F(TestSFSRetrySQLite, retry_non_crit_till_failure) { TEST_F(TestSFSRetrySQLiteDeathTest, crit_aborts) { GTEST_FLAG_SET(death_test_style, "threadsafe"); auto exception = std::system_error{ - SQLITE_CORRUPT, sqlite_orm::get_sqlite_error_category()}; + SQLITE_CORRUPT, sqlite_orm::get_sqlite_error_category() + }; RetrySQLiteBusy uut([&]() { throw exception; return 0; diff --git a/src/test/rgw/sfs/test_rgw_sfs_sfs_bucket.cc b/src/test/rgw/sfs/test_rgw_sfs_sfs_bucket.cc index bf849a27ea4a0..bcef63c3283ec 100644 --- a/src/test/rgw/sfs/test_rgw_sfs_sfs_bucket.cc +++ b/src/test/rgw/sfs/test_rgw_sfs_sfs_bucket.cc @@ -1471,7 +1471,8 @@ TEST_F(TestSFSBucket, ListNamespaceMultipartsBasics) { .object_name = "object_name", .path_uuid = uuid, .meta_str = "metastr", - .mtime = now}; + .mtime = now + }; int id = multipart.insert(mpop); ASSERT_GE(id, 0); diff --git a/src/test/rgw/sfs/test_rgw_sfs_sqlite_list.cc b/src/test/rgw/sfs/test_rgw_sfs_sqlite_list.cc index 6139ad52cb89b..e04fde77a6b6c 100644 --- a/src/test/rgw/sfs/test_rgw_sfs_sqlite_list.cc +++ b/src/test/rgw/sfs/test_rgw_sfs_sqlite_list.cc @@ -395,7 +395,8 @@ TEST_F(TestSFSList, versions__there_is_latest_with_multiple_versions) { ), create_test_versionedobject( obj1.uuid, gen_rand_alphanumeric(cct.get(), 23) - )}; + ) + }; for (size_t i = 0; i < vers_obj1.size(); i++) { vers_obj1[i].object_state = rgw::sal::sfs::ObjectState::COMMITTED; vers_obj1[i].commit_time = ceph::real_time(std::chrono::seconds(i)); @@ -410,7 +411,8 @@ TEST_F(TestSFSList, versions__there_is_latest_with_multiple_versions) { ), create_test_versionedobject( obj2.uuid, gen_rand_alphanumeric(cct.get(), 23) - )}; + ) + }; for (size_t i = 0; i < vers_obj2.size(); i++) { vers_obj2[i].object_state = rgw::sal::sfs::ObjectState::COMMITTED; vers_obj2[i].commit_time = ceph::real_time(std::chrono::seconds(i + 10)); @@ -548,7 +550,8 @@ TEST_F(TestSFSList, roll_up_example) { make_dentry_with_name("photos/2006/January/sample.jpg"), make_dentry_with_name("photos/2006/February/sample2.jpg"), make_dentry_with_name("photos/2006/February/sample3.jpg"), - make_dentry_with_name("photos/2006/February/sample4.jpg")}; + make_dentry_with_name("photos/2006/February/sample4.jpg") + }; const auto expected_still_exists = objects[0]; std::map prefixes; std::vector out; @@ -577,7 +580,8 @@ TEST_F(TestSFSList, roll_up_no_such_delim_in_equals_out) { const auto uut = make_uut(); const std::vector objects{ make_dentry_with_name("prefix/aaa"), make_dentry_with_name("prefix/bbb"), - make_dentry_with_name("prefix/ccc")}; + make_dentry_with_name("prefix/ccc") + }; const auto expected_still_exists = objects[0]; std::map prefixes; std::vector out; @@ -595,7 +599,8 @@ TEST_F(TestSFSList, roll_up_multi_delim_group_by_first) { const std::vector objects{ make_dentry_with_name("prefix/aaa/1"), make_dentry_with_name("prefix/bbb/2"), - make_dentry_with_name("prefix/ccc/3")}; + make_dentry_with_name("prefix/ccc/3") + }; std::map prefixes; std::vector out; @@ -611,7 +616,8 @@ TEST_F(TestSFSList, roll_up_multi_prefixes) { const auto uut = make_uut(); const std::vector objects{ make_dentry_with_name("a/1"), make_dentry_with_name("b/2"), - make_dentry_with_name("c/3")}; + make_dentry_with_name("c/3") + }; std::map prefixes; std::vector out; @@ -630,7 +636,8 @@ TEST_F(TestSFSList, roll_up_empty_delimiter_prefix_is_copy) { const auto uut = make_uut(); const std::vector objects{ make_dentry_with_name("a"), make_dentry_with_name("b"), - make_dentry_with_name("c")}; + make_dentry_with_name("c") + }; std::map prefixes; std::vector out; @@ -647,7 +654,8 @@ TEST_F(TestSFSList, roll_up_starts_after_prefix) { const std::vector objects{ make_dentry_with_name("prefix/xxx"), make_dentry_with_name("prefix/yyy/0"), - make_dentry_with_name("something/else")}; + make_dentry_with_name("something/else") + }; std::map prefixes; std::vector out; @@ -667,7 +675,8 @@ TEST_F(TestSFSList, roll_up_a_multichar_delimiters_work) { make_dentry_with_name("photosDeLiM2006DeLiMJanuaryDeLiMsample.jpg"), make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample2.jpg"), make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample3.jpg"), - make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample4.jpg")}; + make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample4.jpg") + }; const auto expected_still_exists = objects[0]; std::map prefixes; std::vector out; @@ -686,7 +695,8 @@ TEST_F(TestSFSList, roll_up_delim_must_follow_prefix) { const std::vector objects{ make_dentry_with_name("prefix"), make_dentry_with_name("prefixDELIM"), make_dentry_with_name("prefixDELIMsomething"), - make_dentry_with_name("prefixSOMETHING")}; + make_dentry_with_name("prefixSOMETHING") + }; std::map prefixes; std::vector out; diff --git a/src/test/rgw/sfs/test_rgw_sfs_sqlite_users.cc b/src/test/rgw/sfs/test_rgw_sfs_sqlite_users.cc index ca0936c83f62f..4dc43fa9615a9 100644 --- a/src/test/rgw/sfs/test_rgw_sfs_sqlite_users.cc +++ b/src/test/rgw/sfs/test_rgw_sfs_sqlite_users.cc @@ -397,7 +397,8 @@ TEST_F(TestSFSSQLiteUsers, StoreListUsers) { ASSERT_EQ(userIds.size(), 3); std::vector users_vector{ std::make_move_iterator(userIds.begin()), - std::make_move_iterator(userIds.end())}; + std::make_move_iterator(userIds.end()) + }; ASSERT_EQ(users_vector[0], "test1"); ASSERT_EQ(users_vector[1], "test2"); ASSERT_EQ(users_vector[2], "test3"); @@ -647,7 +648,8 @@ TEST_F(TestSFSSQLiteUsers, StoreRemoveUser) { ASSERT_EQ(userIds.size(), 3); std::vector users_vector{ std::make_move_iterator(userIds.begin()), - std::make_move_iterator(userIds.end())}; + std::make_move_iterator(userIds.end()) + }; ASSERT_EQ(users_vector[0], "test1"); ASSERT_EQ(users_vector[1], "test2"); ASSERT_EQ(users_vector[2], "test3"); @@ -665,7 +667,8 @@ TEST_F(TestSFSSQLiteUsers, StoreRemoveUser) { ASSERT_EQ(userIds.size(), 2); std::vector users_after_remove_vector{ std::make_move_iterator(userIds.begin()), - std::make_move_iterator(userIds.end())}; + std::make_move_iterator(userIds.end()) + }; ASSERT_EQ(users_after_remove_vector[0], "test1"); ASSERT_EQ(users_after_remove_vector[1], "test3"); } diff --git a/src/test/rgw/sfs/test_rgw_sfs_wal_checkpoint.cc b/src/test/rgw/sfs/test_rgw_sfs_wal_checkpoint.cc index b682ed3eef5ea..19fd51bb14aaf 100644 --- a/src/test/rgw/sfs/test_rgw_sfs_wal_checkpoint.cc +++ b/src/test/rgw/sfs/test_rgw_sfs_wal_checkpoint.cc @@ -134,7 +134,7 @@ TEST_F(TestSFSWALCheckpoint, test_wal_checkpoint) { init_store(); // Using our SFS checkpoint mechanism, the WAL may exceed - // 16MB while writing, because the trunacte checkpoints + // 16MB while writing, because the truncate checkpoints // don't always succeed, but it shouldn't go over by much. // We're allowing 32MB here for some extra wiggle room // just in case.