`DIR-15-8-1`: move assignment self-assignment false positive
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với cpp/misra/src/rules/DIR-15-8-1/CopyAndMoveAssignmentsShallHandleSelfAssignment.ql và chạy nó trên ví dụ main.cpp được cung cấp để tái hiện cảnh báo trên toán tử gán di chuyển. Xem xét cách quy tắc xử lý phép tự gán bằng move-and-swap, sau đó xác minh rằng mẫu hợp lệ này không còn được báo cáo, trong khi các vi phạm DIR-15-8-1 dự kiến vẫn được phát hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Affected rules
DIR-15-8-1
Description
Using the "move-and-swap idiom" proposed in the directive's example as a solution to address potential issues with self-assignment leads to an alert.
Example
#include <utility>
class resource_manager {
public:
resource_manager() = default;
~resource_manager() = default;
resource_manager(resource_manager const&) = delete;
resource_manager(resource_manager&&) = default;
resource_manager& operator=(resource_manager const&) = delete;
resource_manager& operator=(resource_manager&& other) & noexcept {
resource_manager temp{std::move(other)};
std::swap(resource_, temp.resource_);
return *this;
}
private:
using resource = int;
resource resource_;
};
int main() {}
I am getting a
"DIR-15-8-1: User-provided copy assignment operators and move assignment operators shall handle self-assignment","User-provided copy assignment operators and move assignment operators shall handle self-assignment.","error","User defined copy or user defined move does not handle self-assignment correctly.","/main.cpp","10","23","10","31"
when analyzing with cpp/misra/src/rules/DIR-15-8-1/CopyAndMoveAssignmentsShallHandleSelfAssignment.ql.
- Ngôn ngữ chính
- CodeQL
- Star
- 227
- Fork
- 82
- Merge trung bình
- 6 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 9
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Đang mởfalse positive/false negative
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
github/codeql-coding-standards#1175 ·
Tất cả issue của github/codeql-coding-standards
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
use-agent-os/agent-os#3314 ·
-
Implement GitHub Issue templates Đang mởdocumentation low-priority templates
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
jesseray718/openroot#87 ·
-
factory-active factory-automatic task-bug-reproduction-cannot-reproduce task-identify-harness-labels-done task-identify-issue-type-done
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
danielmiessler/LifeOS#2218 ·
-
in-progress proposal
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
uibcdf/molsyssuite#36 ·