
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
58 lines
2.3 KiB
Plaintext
58 lines
2.3 KiB
Plaintext
== Why is this an issue?
|
|
|
|
The name of each section should be unique within a program because section names cannot be qualified. Often code with duplicate section names will not compile. When it does, sections with duplicate names are ignored, meaning those sections are dead code. Even if dead code were not an anti-pattern on its own, having two sections with the same name will inevitably lead to maintenance mistakes. Therefore duplicative section names should be changed, or the extra sections should be removed.
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Rename this section, it is the nth instance of "xxx".
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 25 Aug 2014, 20:13:51 Ann Campbell wrote:
|
|
\[~pierre-yves.nicolas], what happens if they're not unique?
|
|
|
|
=== on 26 Aug 2014, 16:02:12 Pierre-Yves Nicolas wrote:
|
|
The behavior may depend on the compiler: I suppose that either the compiler generates an error, or one of the sections is chosen arbitrarily.
|
|
|
|
=== on 28 Aug 2014, 17:55:42 Ann Campbell wrote:
|
|
\[~pierre-yves.nicolas] I'm really reluctant to write this rule not knowing what the negative consequence is. Do you have any way of testing? I've tried unsuccessfully to research this, and since you say Open Cobol's not quite the same as what our customers are using, I'm thinking it wouldn't offer valid experimental proof (even if I could figure out the syntax to keep it from choking on "SECTION").
|
|
|
|
=== on 29 Aug 2014, 08:53:53 Pierre-Yves Nicolas wrote:
|
|
After a few experiments, I can confirm that the behavior depends on the compiler:
|
|
|
|
* Some compilers generate an error.
|
|
* One compiler only generates a warning: ``++'SECTION1' previously defined as section-name. This definition ignored.++``
|
|
|
|
=== on 4 Sep 2014, 13:25:16 Ann Campbell wrote:
|
|
Please read this over & see if
|
|
|
|
* the description seems sufficient
|
|
* you think we need code samples. If so, please help me out. I have yet to figure out the correct syntax to declare a section.
|
|
|
|
=== on 4 Sep 2014, 13:37:51 Pierre-Yves Nicolas wrote:
|
|
The description is fine.
|
|
|
|
I don't think we need code samples for that rule.
|
|
|
|
A trivial example of non-compliant code would be:
|
|
|
|
----
|
|
procedure division.
|
|
section1 section.
|
|
...
|
|
section1 section.
|
|
...
|
|
----
|
|
|
|
endif::env-github,rspecator-view[]
|