rspec/rules/S2327/rpg/rule.adoc

42 lines
939 B
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
When multiple, adjacent ``++MONITOR++`` statements have duplicate ``++ON-ERROR++`` blocks, they should be merged to consolidate the ``++ON-ERROR++`` logic for cleaner, more readable code. Note that this applies even when there is intervening code outside any ``++MONITOR++`` block.
2020-06-30 12:48:07 +02:00
== Noncompliant Code Example
----
/free
monitor;
// do something...
on-error;
CALLP HandleError(*param);
endmon;
// do un-monitored thing
monitor;
// do something else...
on-error; // Noncompliant
CALLP HandleError(*param);
endmon;
/end-free
----
== Compliant Solution
----
/free
monitor;
// do something...
// do un-monitored thing
// do something else...
on-error;
CALLP HandleError(*param);
endmon;
----
ifdef::env-github,rspecator-view[]
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]