rspec/rules/S1481/python/rule.adoc

52 lines
848 B
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:47:33 +02:00
include::../description.adoc[]
=== Noncompliant code example
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,python]
2020-06-30 12:47:33 +02:00
----
def hello(name):
message = "Hello " + name # Noncompliant
print(name)
for i in range(10):
foo()
----
=== Compliant solution
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,python]
2020-06-30 12:47:33 +02:00
----
def hello(name):
message = "Hello " + name
print(message)
for _ in range(10):
foo()
----
=== Exceptions
2020-06-30 12:47:33 +02:00
``++_++`` will not raise an issue for this rule. The following examples are compliant:
2020-06-30 12:47:33 +02:00
----
for _ in range(10):
do_something()
username, login, _ = auth
2020-06-30 12:47:33 +02:00
do_something_else(username, login)
----
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[]