github / codeql-coding-standards

This repository contains CodeQL queries and libraries which support various Coding Standards.
MIT License
129 stars 59 forks source link

`A2-7-3`: missing documentation when there's a comment after doxygen grouping #718

Open fjatWbyT opened 2 months ago

fjatWbyT commented 2 months ago

Affected rules

Description

It appears that adding a comment after the closing characters of a member grouping triggers alerts for the methods inside.

Example


/// @brief Member group b.
struct memgrpb {
  /// @brief Group with comment at the end.
  ///@{
  void memgrpb_func0();
  void memgrpb_func1();
  ///@} End of group
};

/// @brief Member group d.
struct memgrpd {
  /// @brief Group without comment at the end.
  ///@{
  void memgrpd_func0();
  void memgrpd_func1();
  ///@}
};

memgrpb_func1 and memgrpb_func0 are evaluated with missing documentation (in contrast with the functions in memgrpd) on query cpp/autosar/src/rules/A2-7-3/UndocumentedUserDefinedType.ql.

Related to #391.

lcartey commented 1 month ago

The patterns on these lines need to be expanded to support different form of group close: https://github.com/github/codeql-coding-standards/blob/18a3f35baed04bdf60ab4e0ddb90d22a26632f16/cpp/autosar/src/rules/A2-7-3/UndocumentedUserDefinedType.ql#L29-L31

At the moment this uses the simple matches(...) predicate, but we may need to move to regular expressions to catch more cases.