rspec/rules/S1185/flex/rule.adoc

56 lines
1.2 KiB
Plaintext

== Why is this an issue?
Overriding a method just to call the same method from the super class without performing any other actions is useless and misleading.
=== Noncompliant code example
[source,flex]
----
override public function doSomething() : void
{
super.doSomething();
}
override public function isLegal(action:Action) : Boolean
{
return super.isLegal(action);
}
----
=== Compliant solution
[source,flex]
----
override public function doSomething() : void
{
super.doSomething(); // Compliant - not simply forwarding the call
doSomethingElse();
}
override public function isLegal(action:Action) : Boolean
{
return super.isLegal(new Action(...)); // Compliant - not simply forwarding the call
}
[Deprecated(replacement="isAuthorized")]
override public function isLegal(action:Action) : Boolean
{
return super.isLegal(action); // Compliant as there is a metadata
}
----
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[]