`A16-2-2`: Consider `TypeMention`s for useless includes

Open
#422 0 comments 0 reactions 1 assignee View on GitHub

@knewbury01 is already working on this.

Since Mar 15, 2024.

Assessment

This issue has not been assessed yet.

Description

Difficulty-Medium false positive/false negative Impact-Low Standard-AUTOSAR user-report
Affected rules
  • A16-2-2
Description

Types that only appear in template parameters or template arguments are not currently considered when determining whether an include is useless. We should consider reviewing TypeMentions to determine whether an include is useless.

Example
#include <type_traits>

template <typename T, std::enable_if_t<std::is_integral<T>::value, int> = 0>
T add(T t) {
  return t + 1;
}

void test() {
  add<int>(10);
}
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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.