github-actions[bot] commented on code in PR #24229: URL: https://github.com/apache/doris/pull/24229#discussion_r1339601986
########## be/src/olap/special_dir.h: ########## @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <string> + +#include "common/status.h" +#include "io/fs/file_system.h" +#include "olap/olap_common.h" + +namespace doris { + +class SpecialDir { +public: + SpecialDir(const std::string& path); + ~SpecialDir(); + + const std::string& path() const { return _path; } Review Comment: warning: function 'path' should be marked [[nodiscard]] [modernize-use-nodiscard] ```suggestion [[nodiscard]] const std::string& path() const { return _path; } ``` ########## be/src/olap/special_dir.cpp: ########## @@ -0,0 +1,67 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "olap/special_dir.h" + +#include <string> + +#include "io/fs/file_reader_writer_fwd.h" +#include "io/fs/file_writer.h" +#include "io/fs/local_file_system.h" +#include "io/fs/path.h" +#include "olap/utils.h" // for check_dir_existed + +namespace doris { +using namespace ErrorCode; + +static const char* const kTestFilePath = ".testfile"; + +SpecialDir::SpecialDir(const std::string& path) + : _path(path), + _fs(io::LocalFileSystem::create(path)), + _available_bytes(0), + _capacity_bytes(0), + _is_used(true) {} + +SpecialDir::~SpecialDir() {} Review Comment: warning: use '= default' to define a trivial destructor [modernize-use-equals-default] ```suggestion SpecialDir::~SpecialDir() = default; ``` ########## be/src/olap/special_dir.h: ########## @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <string> + +#include "common/status.h" +#include "io/fs/file_system.h" +#include "olap/olap_common.h" + +namespace doris { + +class SpecialDir { +public: + SpecialDir(const std::string& path); + ~SpecialDir(); + + const std::string& path() const { return _path; } + + const io::FileSystemSPtr& fs() const { return _fs; } Review Comment: warning: function 'fs' should be marked [[nodiscard]] [modernize-use-nodiscard] ```suggestion [[nodiscard]] const io::FileSystemSPtr& fs() const { return _fs; } ``` ########## be/src/olap/special_dir.h: ########## @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <string> + +#include "common/status.h" +#include "io/fs/file_system.h" +#include "olap/olap_common.h" + +namespace doris { + +class SpecialDir { +public: + SpecialDir(const std::string& path); + ~SpecialDir(); + + const std::string& path() const { return _path; } + + const io::FileSystemSPtr& fs() const { return _fs; } + + void get_dir_info(SpecialDirInfo* special_dir_info) { Review Comment: warning: method 'get_dir_info' can be made const [readability-make-member-function-const] ```suggestion void get_dir_info(SpecialDirInfo* special_dir_info) const { ``` ########## be/src/olap/special_dir.h: ########## @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <string> + +#include "common/status.h" +#include "io/fs/file_system.h" +#include "olap/olap_common.h" + +namespace doris { + +class SpecialDir { +public: + SpecialDir(const std::string& path); + ~SpecialDir(); + + const std::string& path() const { return _path; } + + const io::FileSystemSPtr& fs() const { return _fs; } + + void get_dir_info(SpecialDirInfo* special_dir_info) { + special_dir_info->path = _path; + special_dir_info->capacity = _capacity_bytes; + special_dir_info->available = _available_bytes; + special_dir_info->is_used = _is_used; + return; + } Review Comment: warning: redundant return statement at the end of a function with a void return type [readability-redundant-control-flow] ```suggestion } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
