
## Review A dedicated reviewer checked the rule description successfully for: - [ ] logical errors and incorrect information - [ ] information gaps and missing content - [ ] text style and tone - [ ] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
57 lines
950 B
Plaintext
57 lines
950 B
Plaintext
== Why is this an issue?
|
|
|
|
:operationName: method
|
|
|
|
include::../description.adoc[]
|
|
|
|
== How to fix it
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,ruby,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
def shouldNotBeEmpty() # Noncompliant - method is empty
|
|
end
|
|
|
|
def notImplemented() # Noncompliant - method is empty
|
|
end
|
|
|
|
def emptyOnPurpose() # Noncompliant - method is empty
|
|
end
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,ruby,diff-id=1,diff-type=compliant]
|
|
----
|
|
def shouldNotBeEmpty()
|
|
doSomething()
|
|
end
|
|
|
|
def notImplemented()
|
|
raise NotImplementedError, 'notImplemented() cannot be performed because ...'
|
|
end
|
|
|
|
def emptyOnPurpose()
|
|
# comment explaining why the method is empty
|
|
end
|
|
----
|
|
|
|
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[]
|