rspec/rules/S2317/python/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
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.
2023-05-25 14:18:12 +02:00

41 lines
830 B
Plaintext

== Why is this an issue?
Use of the ``++exec++`` statement could be dangerous, and should be avoided. Moreover, the ``++exec++`` statement was removed in Python 3.0. Instead, the built-in ``++exec()++`` function can be used.
=== Noncompliant code example
[source,python]
----
exec 'print 1' # Noncompliant
----
=== Compliant solution
[source,python]
----
exec('print 1')
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use the "exec()" function instead.
'''
== Comments And Links
(visible only on this page)
=== on 25 Feb 2019, 17:14:43 Tibor Blenessy wrote:
Changing this to code smell, as this rule is mostly about migration towards Python 3. The security aspect of this rule is covered in hotspot RSPEC-1523
endif::env-github,rspecator-view[]