rspec/rules/S3806/cfamily/rule.adoc
Fred Tingaud d3cfe19d7e
Fix broken or dangerous backquotes
Co-authored-by: Marco Borgeaud <89914223+marco-antognini-sonarsource@users.noreply.github.com>
2023-10-30 10:33:56 +01:00

39 lines
1.1 KiB
Plaintext

== Why is this an issue?
The way an ``++#include++`` directive finds an actual file is implementation-defined, and in practice, it slightly differs in different systems.
Therefore, a good practice is to identify the files to include in the most straightforward way possible to reduce the risk of inconsistent behaviors.
This rule raises an issue when:
* The case of the file in the ``++#include++`` directive does not match the case of the file on the disk (the inclusion would not work on a case-sensitive OS),
* The file name in the ``++#include++`` directive contains trailing spaces (they would be ignored on Windows but considered on Unix).
=== Noncompliant code example
[source,cpp]
----
#include "Foo.h" // Noncompliant if the actual file name is "foo.h"
#include "bar.h " // Noncompliant, trailing space
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Change this path so that it matches the exact file name: "{actual path name}".
=== Highlighting
The path
endif::env-github,rspecator-view[]