1

Pylint 有许多指标来确保代码可读且不太复杂。

[DESIGN]

# Maximum number of arguments for function / method.
max-args=5

# Maximum number of attributes for a class (see R0902).
max-attributes=7

# Maximum number of boolean expressions in an if statement.
max-bool-expr=5

# Maximum number of branch for function / method body.
max-branches=12

# Maximum number of locals for function / method body.
max-locals=15

# Maximum number of parents for a class (see R0901).
max-parents=7

# Maximum number of public methods for a class (see R0904).
max-public-methods=20

# Maximum number of return / yield for function / method body.
max-returns=6

# Maximum number of statements in function / method body.
max-statements=50

# Minimum number of public methods for a class (see R0903).
min-public-methods=2

这些最大数字背后的基本原理(或一些文献)是什么?

特别是,我想知道

  • 函数/方法的最大参数数 (5)
  • 函数/方法体的最大分支数 (12)
  • 函数/方法体的最大本地数 (15)

谢谢

4

0 回答 0