检测长度太长的函数(>100行)?

时间:2021-04-20 18:33:47

Is there any way to detect the functions in my Node App that are longer than 100 lines? Im using JSHint but it doesnt have any option to detect it.

有没有办法检测我的节点App中超过100行的功能?我使用的是JSHint,但它没有任何选择来检测它。

2 个解决方案

#1


1  

You can't do such a thing with jslint, according to the docs :

根据文件,你不能用jslint做这样的事:

Warning This option has been deprecated and will be removed in the next major release of JSHint. JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, check out the JSCS project. This option lets you set the maximum length of a line.

警告此选项已被弃用,将在JSHint的下一个主要版本中删除。JSHint将其范围限制在代码正确性问题上。如果您想执行与代码样式相关的规则,请查看JSCS项目。这个选项允许您设置一行的最大长度。

the poperty maxlen is deprecated you don't have to rely on it

poperty maxlen被弃用,您不必依赖它。

#2


1  

You can use eslint and use the max-statements option to allow a maximum number of lines in a function
Link : https://eslint.org/docs/rules/max-statements

您可以使用eslint并使用max-statements选项来允许函数链接中的最大行数:https://eslint.org/docs/rules/max-statements

#1


1  

You can't do such a thing with jslint, according to the docs :

根据文件,你不能用jslint做这样的事:

Warning This option has been deprecated and will be removed in the next major release of JSHint. JSHint is limiting its scope to issues of code correctness. If you would like to enforce rules relating to code style, check out the JSCS project. This option lets you set the maximum length of a line.

警告此选项已被弃用,将在JSHint的下一个主要版本中删除。JSHint将其范围限制在代码正确性问题上。如果您想执行与代码样式相关的规则,请查看JSCS项目。这个选项允许您设置一行的最大长度。

the poperty maxlen is deprecated you don't have to rely on it

poperty maxlen被弃用,您不必依赖它。

#2


1  

You can use eslint and use the max-statements option to allow a maximum number of lines in a function
Link : https://eslint.org/docs/rules/max-statements

您可以使用eslint并使用max-statements选项来允许函数链接中的最大行数:https://eslint.org/docs/rules/max-statements