
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.
66 lines
1.8 KiB
Plaintext
66 lines
1.8 KiB
Plaintext
== Why is this an issue?
|
|
|
|
``++break++`` and ``++continue++`` are unstructured control flow statements which make code harder to read. Additionally, more recent versions of Python raise a SyntaxError when modules containing ``++break++`` or ``++continue++`` outside of a loop are imported.
|
|
|
|
|
|
Therefore, these statements should not be used outside of loops.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python]
|
|
----
|
|
narg=len(sys.argv)
|
|
if narg == 1:
|
|
print('@Usage: input_filename nelements nintervals')
|
|
break
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
if narg == 1:
|
|
print('@Usage: input_filename nelements nintervals')
|
|
sys.exit()
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Remove this "xxx" statement
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== is related to: S910
|
|
|
|
=== on 4 Nov 2014, 15:59:14 Ann Campbell wrote:
|
|
pylint:E0103
|
|
|
|
=== on 9 May 2016, 15:41:47 Evgeny Mandrikov wrote:
|
|
I don't know any C/{cpp} compiler, which will allow to use "continue" outside of loop and "break" outside of switch and loop, hence not applicable.
|
|
|
|
=== on 9 May 2016, 15:44:26 Evgeny Mandrikov wrote:
|
|
Note that PC-Lint error codes from 1 to 199 for C and from 1001 to 1199 for {cpp} are syntax errors.
|
|
|
|
=== on 16 May 2016, 17:06:00 Ann Campbell wrote:
|
|
\[~evgeny.mandrikov] I guess this means that PC-Lint doesn't expect compilable code?
|
|
|
|
=== on 16 May 2016, 17:14:19 Evgeny Mandrikov wrote:
|
|
\[~ann.campbell.2] I suppose that it expects for proper analysis in general, but when this is not the case it generates more precise "parse error".
|
|
|
|
=== on 16 May 2016, 17:50:32 Ann Campbell wrote:
|
|
For the record PC-Lint rules in these ranges are Syntax errors: 1-199, 1001-1199.
|
|
|
|
endif::env-github,rspecator-view[]
|