Miscellaneous-NoPublicDataMembers¶
Do not declare non-const data members public
Required inputs: IR
Example
class C
{
private:
std::string m_member;
public:
const std::string& member()
{
return m_member;
}
void member(const std::string& new_value)
{
assert(new_value.size() > 0);
m_member = new_value;
}
};
See Also
Rule Miscellaneous-NoReferenceToPrivateDataMemberPossible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
protected_field |
Protected non-const data member. |
None |
False |
public_field |
Public non-const data member. |
None |
False |
Options¶
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
allow_protected_members¶
allow_protected_members : bool = True
allowed¶
allowed
Specifies allowed fields as pairs (class name pattern, field name pattern).Example: (re.compile('.*'), re.compile('x')) to allow x in all classes.Type: list[typing.Tuple[typing.Union[typing.Pattern[str], typing.Callable[[bauhaus.ir.Node], bool]], typing.Union[typing.Pattern[str], typing.Callable[[bauhaus.ir.Node], bool]]]]
Default:
[]
ignore_const_members¶
ignore_const_members : bool = True
ignore_pod¶
ignore_pod : bool = True
ignore_structs¶
ignore_structs : bool = True
ignore_templates¶
ignore_templates : bool = False