☰
  • 首页
  • 规则分类
  • 项目介绍
search
•••

数据成员的数量应在规定范围之内

5.1.17 ID_tooManyFields
目录 › next › previous

类或联合体的数据成员过多意味着一个逻辑或功能单位承担了过多的职责,违反了模块化设计理念,是难以维护的。

示例:

class C
{
    // ... 3000 members ...
    // Who has the courage to read?
};

union U
{
    // ... 3000 members ...
    // Here is hell!
};

配置

maxClassFieldsCount: 类数据成员的数量上限,超过则报出 maxUnionFieldsCount: 联合体数据成员的数量上限,超过则报出

参考

CWE-1093
Copyright©2024 360 Security Technology Inc., Licensed under the Apache-2.0 license.