code review - chunhualiao/public-docs GitHub Wiki

Put results into comments

For Doxygen-style comments, there isn't a built-in tag specifically for code review comments, but you can use existing tags effectively to document them. Here are some commonly used options:

  1. @note – Use this to highlight review comments that provide additional information about the code.

    /**
     * @note This function uses a naive approach and may need optimization.
     */
    
  2. @warning – If a review comment identifies a potential issue or risk.

    /**
     * @warning This implementation is not thread-safe.
     */
    
  3. @todo – If the review suggests changes that should be addressed in the future.

    /**
     * @todo Refactor this function to improve performance.
     */
    
  4. @bug – If the review identifies an actual defect.

    /**
     * @bug Edge cases with negative numbers are not handled correctly.
     */
    
  5. @deprecated – If a function or feature is marked for replacement.

    /**
     * @deprecated Use newFunction() instead.
     */
    
  6. Custom Tags – Doxygen allows custom sectioning. You can define something like:

    /**
     * @code_review Needs better error handling.
     */
    

    However, custom tags might not be recognized by all tools unless explicitly configured.

For best practices, a combination of @todo, @warning, and @note often works well.