This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Utility Function
A Utility Function is any instance method that has no dependency on the state of the instance.
Current Support in Reek
Currently Utility Function will warn about any method that:
- is non-empty
- does not override an inherited method
- calls at least one method on another object
- doesn’t use any of self’s instance variables
- doesn’t use any of self’s methods
Configuration
Reek’s Utility Function detector supports the Basic Smell Options, plus:
| Option | Value | Effect |
|---|---|---|
max_helper_calls |
integer | The maximum number of method calls to other objects allowed within a method. Defaults to 2. Since v1.1.3.16 |
Earlier versions of the UtilityFunction detector were too strict for some cases. In particular, a simple helper method of the form:
def lookup(key)
TOKENS[key]
end
would always be reported as a UtilityFunction in early versions of Reek. The option max_helper_calls now (since v1.1.3.16) by default requires a method to make at least two calls out of the current object in order to be considered a UtilityFunction.







