AUTOSAR C++14 Rule A2-8-2
An implementation file name should reflect the logical entity for which it provides definitions.
Since R2021a
Description
Rule Definition
An implementation file name should reflect the logical entity for which it provides definitions.
Rationale
An implementation file name that matches the name of the entity that is defined in that file makes your project structure clearer and your code more readable.
Polyspace Implementation
Polyspace® checks the implementation file name against the name of relevant defined 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 implementation file.
The name comparison is case insensitive. For instance,
myclass
matchesmyClass
.The name comparison ignores:
The underscore character '
_
'. For instance,myclass
matchesmy_Class
.Prefix characters '
C
', 'M
', 'T
', or suffix character 'T
'. The comparison ignores either the prefix or suffix characters, but not both. For instance,myclass
matchesCmyClass
andmyClass_T
, but notCmyClass_T
.The hyphen character '
-
' in file names. For instance, a file namedmy-class.cpp
matches aclass
namedmyClass_
.
Polyspace does not check the file where you implement main()
.
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: Advisory, Non-automated |
Version History
Introduced in R2021a