禁用“文档注释”;警告所选文件 [英] Disable "Documentation Comments" warning for selected files
问题描述
Xcode可以检查文档注释问题,并在出现不正确的情况时报告警告。例如,我已经使用CocoaPods将Facebook SDK添加到了我的项目中。在文件 FBError.h
的某个位置,有以下代码:
/ *!
@typedef NS_ENUM(NSInteger,FBErrorCategory)
@ abstract指示错误的Facebook SDK分类
@ discussion
* /
请注意, @discussion
参数为空,Xcode将相应地产生警告:
空段传递给'@discussion'命令
但是,Facebook SDK并不是我添加到项目中的唯一库,问题选项卡中还包含来自我安装的Pod的第三方文件中与其他文档相关的警告。 p>
我想知道如何对那些文件禁止这种警告。
您可以使用此代码段禁止显示警告:
#pragma clang诊断推送
#pragma clang诊断忽略了 -Wdocumentation
#import< YourHeader.h>
#pragma clang诊断程序弹出
有关详细信息,请参阅此cocoapod问题: https://github.com/CocoaPods/CocoaPods/issues/1481 (摘要来自那里)
Xcode has the ability to check for Documentation Comments issues and report warnings when something is not quite right. For instance, I've added Facebook SDK to my project using CocoaPods. At some point in the file FBError.h
there's the following code:
/*!
@typedef NS_ENUM (NSInteger, FBErrorCategory)
@abstract Indicates the Facebook SDK classification for the error
@discussion
*/
Note that the @discussion
parameter is empty, and Xcode will generate a warning accordingly:
Empty paragraph passed to '@discussion' command
However, Facebook SDK is not the only library I've added to my project, and the Issues tab is full of other documentation related warnings from 3rd party files, from the Pods I installed.
I'd like to know how to suppress this kind of warning for those files.
You can use this snippet to suppress the warnings:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#import <YourHeader.h>
#pragma clang diagnostic pop
see this cocoapod-issue for details: https://github.com/CocoaPods/CocoaPods/issues/1481 (snippet comes from there)
这篇关于禁用“文档注释”;警告所选文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!