cpp:CommentedCode on doxygen blocks

Hello,

the rule cpp::CommentedCode gets triggered on the examples we have in the code blocks in doxygen. Here is an example:

https://sonarcloud.io/project/issues?id=simgrid&issues=AWgE-q9aUMkE2J58J-Is&open=AWgE-q9aUMkE2J58J-Is

It reads as follows:

/** @brief A C++ compatible [TrivialClock](http://en.cppreference.com/w/cpp/concept/TrivialClock) working with simulated-time.
 *
 * Blah blah blah blah
 *
 * @code{cpp}
 * using namespace std::chrono_literals; 
 * simgrid::s4u::actor::sleep_for(42s);
 * @endcode
 *
 */

Of course there is some commented code in the examples of code we put in the documentation.

Thanks again for your great tool,
Mt.

2 Likes

The same kind of problem also occurs with cpp:S1103 (don’t mix /* and //), as here:
https://sonarcloud.io/project/issues?id=simgrid&issues=AWgE-q-4UMkE2J58J-I5&open=AWgE-q-4UMkE2J58J-I5

/** Result of some (probably) asynchronous operation in the SimGrid kernel
 *
 * Blah blah bla
 *
 * Example of the API:
 *
 *  <pre>
 *  // Create a new process using the Worker code (returns a std::string)
 *  simgrid::kernel::Future<std::string> future =
 *     simgrid::kernel::createProcess("worker42", host, Worker(42));
 *
 *  // At this point, we just created the process so the result is not available.
 *  </pre>
 */

Do you prefer me to open two topics when I have two problems that look similar to me, or it’s OK to open only one topic as I did?

Thanks for this incredible service,
Mt.

Hi @mquinson,

we do plan to revisit C/C++ comment detection strategy, thank you for your feedback, we will keep in mind your reports while revisit. I cannot provide you with an ETA, you can follow the related ticket: CPP-104, the ticket was created a long time ago but we plan to look at it in a short time future.

Hi @mpaladin, thanks for considering this bug.

There is absolutely no urgency nor need for an ETA from my side. I’m a happy user of the sonarcloud for Open Source projects program. I feel like I’m paying my part with this feedback, but I can definitely live with this issue.

Thanks for all,
Mt

2 Likes

Thank you for your good feedback @mquinson!