Avoid including files other than header files | CAST Appmarq

Avoid including files other than header files


Rule Definition
If a file includes a file that does not have a header extension this either means: - That naming conventions have not been respected, therefore making it harder to understand the program etc. - That code is duplicated at several locations breaking the encapsulation rules

Remediation
Either rename the included file (and where it is referenced) or review.

Violation Code Sample
// File1.cpp
#include "file2.cpp" <-- This is incorrect, include the header file!
#include "file3.zzz" <-- This is incorrect, rename the file to .h
Fixed Code Sample
// File1.cpp
#include "file2.h"
#include "file3.h"

Related Technologies
C++

Health Factor

  Total Quality Index


Technical Criterion
Programming Practices - File Organization Conformity

About CAST Appmarq

CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.

Benchmark Statistics

Global Compliance

94.91%

Total Violations
14,848
Total Opportunities
291,837
Average Violations / App.
86.33
The compliance score represents 1 minus the ratio between the number of times a rule has been violated compared to the number of opportunities in a set of applications that the rule could have been violated.

Industry Insights

Financial Services

92.06%

Software ISV

96.60%

Manufacturing

92.74%