如何让doxygen发出有关文件中没有doxygen文档/注释的文件的警告? 我使用doxygen v1.9.8(以1.13.1的测试,结果相同)来记录一个C项目,我希望它在文件缺少文档时警告我。 它确实警告我,如果它部分是文献...

问题描述 投票:0回答:1
设置

WARN_IF_UNDOCUMENTED

YES

    设置
  1. EXTRACT_ALL
    NO
  2. 预期的行为:
  3. 我希望doxygen警告没有文档的文件,尤其是在设置
    WARN_IF_UNDOCUMENTED = YES
    时。
    实际行为:
    doxygen默默地跳过文件,没有任何文档,也不会发出警告。
  4. 问题:
这种行为是预期的吗,还是我对doxygen进行了错误配置?如果是设计,我如何强制doxygen警告缺少文件级文档的文件?

下面的样本代码:

test_project/
├── src/
│   ├── documented_file.h
│   ├── partially_documented_file.c
│   ├── undocumented_file.h
│   ├── undocumented_file.c
├── Doxyfile

documented_file.h


/** * @file documented_file.h * @brief * @author Your Name * @date YYYY-MM-DD */ #ifndef DOCUMENTED_FILE_H #define DOCUMENTED_FILE_H /// A documented macro. #define DOCUMENTED_MACRO 42 /// A documented function declaration. void documented_function(); #endif // DOCUMENTED_FILE_H

-partlily_documented_file.c

/** * @file partially_documented_file.c * @brief * @author Your Name * @date YYYY-MM-DD */ #include "documented_file.h" /// A documented function implementation. void documented_function() { // Function logic here } // An undocumented function implementation. void undocumented_function() { // Function logic here }

Unnocumented_file.c
#include "undocumented_file.h"
void undocumented_function_in_header() {
   // Function logic here
}

unnocumented_file.h
#ifndef UNDOCUMENTED_FILE_H
#define UNDOCUMENTED_FILE_H
#define UNDOCUMENTED_MACRO 0
void undocumented_function_in_header();
#endif // UNDOCUMENTED_FILE_H

doxyfile

# General configuration
PROJECT_NAME = "Test Project"
OUTPUT_DIRECTORY = ./doxygen_output
INPUT = ./src
FILE_PATTERNS = *.c *.h
RECURSIVE = YES
# Warnings
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_NO_PARAMDOC = YES
WARN_LOGFILE = doxygen_warnings.log
# Output formats
GENERATE_HTML = YES
GENERATE_LATEX = NO
# Code extraction
EXTRACT_ALL = NO

输出:doxygen_warnings.log

/workspace/src/partially_documented_file.c:13: warning: Member undocumented_function() (function) of file partially_documented_file.c is not documented.
我想要的输出

/workspace/src/undocumented_file.c: warning: no documentation found for file undocumented_file.c /workspace/src/undocumented_file.h: warning: no documentation found for file undocumented_file.h /workspace/src/partially_documented_file.c:13: warning: Member undocumented_function() (function) of file partially_documented_file.c is not documented.

运行我使用VSCODE任务和Docker
dockerfile

# Use an official Ubuntu image FROM ubuntu:latest # Install Doxygen and Graphviz RUN apt-get update && \ apt-get install -y doxygen graphviz && \ rm -rf /var/lib/apt/lists/* # Set the working directory in the container WORKDIR /workspace # Default command to run Doxygen when container starts CMD ["doxygen", "/workspace/Doxyfile"]
.vscode/task.json

{ "version": "2.0.0", "tasks": [ { "label": "Run Doxygen in Docker", "type": "shell", "command": "docker", "args": [ "run", "--rm", "-v", "${workspaceFolder}:/workspace", "doxygen-container", "doxygen", "/workspace/Doxyfile" ], "group": "build", "problemMatcher": [] } ] }
    

多氧需要至少具有
@file filename.ext
(或

\file

)标签。此标签不一定要放在文件中,但必须在Doxygen-Scope中的某个地方。或者您需要将

EXTRACT_ALL

设置为
YES
。但这带来了其他缺点。请参阅:

多氧特殊命令:文件

我的解决方案是用专用脚本扫描文件,并检查文件中是否位于文件中。如果没有,我会在Doxygen能够在任何丢失的文档上报告之前返回文件需要标签的警告消息。
我的python解决方案:
c warnings doxygen
1个回答
0
投票


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.