`RULE-10-0-1`: Structured bindings should not be reported as violations

Open Beginner friendly
#1,172 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp
Domain
devtools

Research direction

Find the implementations and tests for RULE-10-0-1 and M8-0-1, then inspect how variable declarations are classified. Use Variable.isStructuredBinding to identify the shown C++ case, and verify that the structured-binding example is no longer reported while other violations remain covered by tests.

Written by the indexing model from the issue text.

Description

false positive/false negative Stardard-MISRA-C++
Affected rules
  • RULE-10-0-1
  • M8-0-1
Description

The examples for rule 10-0-1 specifically say that structured bindings are not a violation.

We can detect these with Variable.isStructuredBinding.

Example
void example_function(std::pair<int, long> p) {
  auto [i, l] = p; // COMPLIANT[False positive]
}
Dominant language
CodeQL
Stars
227
Forks
82
Avg merge
6d 7h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/codeql-coding-standards

All issues in github/codeql-coding-standards

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.