1

我们继承了一个包含许多裸 if 语句的代码库,如下所示:

if (some_condition)
    do_something();

我们的房子风格禁止这样做,所以我希望(如果可能的话)它是一个编译器警告。我可以在 XCode 中做到这一点,如果可以,怎么做?

4

2 回答 2

3

特洛伊木马是对的,没有办法得到警告。您可以通过-Weverything在“其他警告标志”中输入“构建设置”来检查。

Uncrustify是一个非常好的代码美化器,适用于许多语言,包括 Objective-C。对于您想要的 if 语句,配置需要一些时间来设置:

# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
mod_full_brace_if                        = force
于 2012-05-09T11:15:55.467 回答
0

这可以通过 ObjClean http://objclean.com/index.php来完成

于 2016-06-07T16:01:07.210 回答