Netbeans 7.4引入了“最大10行"每个方法规则.该规则从何而来? [英] Netbeans 7.4 introduces "10 lines max" per method rule. Where does this rule come from?

查看:89
本文介绍了Netbeans 7.4引入了“最大10行"每个方法规则.该规则从何而来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NetBeans 7.4 测试版当前可公开下载,并且默认情况下引入了奇怪的警告规则:

NetBeans 7.4 beta is currently available for public download, and it introduces a weird warning rule by default:

方法长度为16行(允许10行)

Method length is 16 lines (10 allowed)

我的问题是:这是否是公认的代码约定规则,可以在某处以某种方式证明? NetBeans支持人员/开发人员说这不是错误,但没有说明为什么它们只允许10行,以及该规则的确切来源.

My question is: Is this an accepted code convention rule, that can be proven somehow, somewhere ? NetBeans support/devs say it's not a bug, but don't give a statement why they only allow 10 lines, and where exactly this rule has its origin.

推荐答案

您可以在NetBeans选项(位于工具->选项->编辑器中的复选框列表中"太多行"部分下的提示标签.

You can change the maximum method/function length warning behavior in NetBeans options (it's under Tools->Options->Editor, in the Hints tab, under "Too Many Lines" section in the checkboxes list).

您可以在其中设置最大行数,警告方式等.

There you can set the maximum number of lines, how you would like to be warned, etc.

我相信该规则是NetBeans开发人员引入的,因为在团队中工作时,QA用于检查"代码的自动化工具会标记长方法声明/函数主体.不幸的是,代码分析师"对自动化工具的使用正在增加,而他们对背后原因的理解仍然有限.我并不是说您的函数应该长几百行-这是完全错误的,但是作为编码法则是硬编码的数字-来吧!

I believe that the rule was introduced by NetBeans developers because when working in teams, the automated tools that QAs use to "inspect" code flag long method declarations/functions bodies. Unfortunately, the use of automated tools by "code analysts" is on the rise, whilst their understanding of the reasons behind that are still limited. I do not say that your functions should be hundreds of lines long - that's just plain wrong, but a hard-coded number as a coding law - come on!

这篇关于Netbeans 7.4引入了“最大10行"每个方法规则.该规则从何而来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆