
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
52 lines
1.1 KiB
Plaintext
52 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
When the names of parameters in a function/method call match the names of the method arguments, it contributes to clearer, more readable code. However, when the names match, but are passed in a different order than the function/method arguments, it indicates a mistake in the parameter order which will likely lead to unexpected results.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,python]
|
|
----
|
|
def move_point(coord, speed):
|
|
new_x = coord[0] + speed[0]
|
|
new_y = coord[1] + speed[1]
|
|
return (new_x, new_y)
|
|
|
|
coord = (3, 4)
|
|
speed = (1, 2)
|
|
|
|
move_point(speed, coord) # Noncompliant
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,python]
|
|
----
|
|
def move_point(coord, speed):
|
|
new_x = coord[0] + speed[0]
|
|
new_y = coord[1] + speed[1]
|
|
return (new_x, new_y)
|
|
|
|
coord = (3, 4)
|
|
speed = (1, 2)
|
|
|
|
move_point(coord, speed)
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|