rspec/rules/S1845/python/rule.adoc
Fred Tingaud 51369b610e
Make sure that includes are always surrounded by empty lines (#2270)
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.
2023-06-22 10:38:01 +02:00

43 lines
1.1 KiB
Plaintext

== Why is this an issue?
Looking at the set of methods and fields in a ``++class++`` and finding two that differ only by capitalization is confusing to users of the class.
This situation may simply indicate poor naming. Method names should be action-oriented, and thus contain a verb, which is unlikely in the case where both a method and a field have the same name (with or without capitalization differences). However, renaming a public method could be disruptive to callers. Therefore renaming the member is the recommended action.
=== Noncompliant code example
[source,python]
----
class SomeClass:
lookUp = false
def lookup(): # Non-compliant; method name differs from field name only by capitalization
pass
----
=== Compliant solution
[source,python]
----
class SomeClass:
lookUp = false
def getLookUp():
pass
----
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[]