【发布时间】:2012-05-16 02:54:21
【问题描述】:
我目前正在使用codenarc plugin,我想为其自定义 codenarc 规则集属性以检查我的代码的正确缩进。
有人试过吗?
请帮忙。
谢谢!
【问题讨论】:
我目前正在使用codenarc plugin,我想为其自定义 codenarc 规则集属性以检查我的代码的正确缩进。
有人试过吗?
请帮忙。
谢谢!
【问题讨论】:
CodeNarc(当前)不包括任何检查/强制代码缩进的规则。虽然欢迎您贡献一份!
您可以在以下位置查看所有规则的列表: http://codenarc.sourceforge.net/codenarc-rule-index.html
格式规则描述在: http://codenarc.sourceforge.net/codenarc-rules-formatting.html
克里斯
【讨论】:
使用Indentation 规则。这包含在rulesets/formatting.xml 中。这将检查类、字段和方法声明以及语句的缩进(仅空格;不是制表符)。默认为每个缩进级别 4 个空格,这可以通过 spacesPerIndentLevel 属性进行配置。详情请见this page。
启用规则后,默认 HTML 报告中的违规行为报告如下: Example report showing violations of the 'Indentation' rule.
【讨论】: