
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
53 lines
1.3 KiB
Plaintext
53 lines
1.3 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cpp]
|
|
----
|
|
try {
|
|
file.open("test.txt");
|
|
} catch (...) { // Noncompliant
|
|
// ...
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,cpp]
|
|
----
|
|
try {
|
|
file.open("test.txt");
|
|
} catch (std::ifstream::failure e) {
|
|
// ...
|
|
}
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
There are cases though where you want to catch all exceptions, because no exceptions should be allowed to escape the function, and generic ``++catch++`` handlers are excluded from the rule:
|
|
|
|
* In the main function
|
|
* In a class destructor
|
|
* In a ``++noexcept++`` function
|
|
* In an ``++extern "C"++`` function
|
|
|
|
Additionally, if the ``++catch++`` handler is throwing an exception (either the same as before, with ``++throw;++`` or a new one that may make more sense to the callers of the function), or is never exiting (because it calls a ``++noreturn++`` function, for instance ``++exit++``), then the accurate type of the exception usually does not matter any longer: this case is excluded too.
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|