Sha256: fa7efaf0733824568d3919e77b285962cec9b3c906621fc081af2f86df6237f1

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 KB

Contents

## Introduction

`Too Many Methods` is a special case of `LargeClass`. 

## Example

Given this configuration

```yaml
TooManyMethods:
  max_methods: 3
```

and this code:

```Ruby
class TooManyMethods
  def one; end
  def two; end
  def three; end
  def four; end
end
```

Reek would emit the following warning:

```
test.rb -- 1 warning:
  [1]:TooManyMethods has at least 4 methods (TooManyMethods)
```
## Current Support in Reek

Reek counts all the methods it can find in a `class` - instance *and* class methods. So given `max_methods` from above is 4, this:

```Ruby
class TooManyMethods
  class << self
    def one; end
    def two; end
  end

  def three; end
  def four; end
end
```

would cause Reek to emit the same warning as in the example above.

## Configuration

Reek's `Too Many Methods` detector offers the [Basic Smell Options](Basic-Smell-Options.md), plus:

| Option         | Value       | Effect  |
| ---------------|-------------|---------|
| max_methods     | integer | The maximum number of methods that are permitted. Defaults to 15 |

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
reek-4.0.1 docs/Too-Many-Methods.md
reek-4.0.0 docs/Too-Many-Methods.md
reek-4.0.0.pre1 docs/Too-Many-Methods.md
reek-3.11 docs/Too-Many-Methods.md
reek-3.10.2 docs/Too-Many-Methods.md
reek-3.10.1 docs/Too-Many-Methods.md
reek-3.10.0 docs/Too-Many-Methods.md
reek-3.9.1 docs/Too-Many-Methods.md
reek-3.9.0 docs/Too-Many-Methods.md
reek-3.8.3 docs/Too-Many-Methods.md
reek-3.8.2 docs/Too-Many-Methods.md
reek-3.8.1 docs/Too-Many-Methods.md
reek-3.8.0 docs/Too-Many-Methods.md
reek-3.7.1 docs/Too-Many-Methods.md
reek-3.7.0 docs/Too-Many-Methods.md
reek-3.6.1 docs/Too-Many-Methods.md
reek-3.6.0 docs/Too-Many-Methods.md