AUTOSAR C++14 Rule A2-8-1
A header file name should reflect the logical entity for which it provides declarations.
Since R2021a
Description
Rule Definition
A header file name should reflect the logical entity for which it provides declarations.
Rationale
A header file name that matches the name of the entity that is declared in that file
makes your #include directives clearer and your code more
readable.
Polyspace Implementation
Polyspace® checks the header file name against the name of relevant declared types such
as class or struct, or namespace
names. If the names do not match, Polyspace flags the first character on the first line of the header file.
The name comparison is case insensitive. For instance,
myheadermatchesmyHeader.The name comparison ignores:
The underscore character '
_'. For instance,myheadermatchesmy_Header.Prefix characters '
C', 'M', 'T', or suffix character 'T'. The comparison ignores either the prefix or suffix characters, but not both. For instance,myheadermatchesCmyHeaderandmyHeader_T, but notCmyHeader_T.The hyphen character '
-' in file names. For instance, a file namedmy-header.hmatches astructnamed_myHeader.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
| Group: Lexical conventions |
| Category: Required, Non-automated |
Version History
Introduced in R2021a