Sha256: 7550964b0133b9e80358da29aa91d4fd6575c0b245a076ac63533e5f2f340f38

Contents?: true

Size: 1.01 KB

Versions: 53

Compression:

Stored size: 1.01 KB

Contents

## Introduction

_Too Many Methods_ is a case of [Large Class](Large-Class.md).

## Example

Given this configuration

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

and this code:

```Ruby
class Smelly
  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: Smelly has at least 4 methods
```
## 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 Smelly
  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

53 entries across 51 versions & 2 rubygems

Version Path
reek-4.3.0 docs/Too-Many-Methods.md
reek-4.2.5 docs/Too-Many-Methods.md
reek-4.2.4 docs/Too-Many-Methods.md
reek-4.2.3 docs/Too-Many-Methods.md
reek-4.2.2 docs/Too-Many-Methods.md
reek-4.2.1 docs/Too-Many-Methods.md
reek-4.2.0 docs/Too-Many-Methods.md
reek-4.1.1 docs/Too-Many-Methods.md
reek-4.1.0 docs/Too-Many-Methods.md
reek-4.0.5 docs/Too-Many-Methods.md
reek-4.0.4 docs/Too-Many-Methods.md
reek-4.0.3 docs/Too-Many-Methods.md
reek-4.0.2 docs/Too-Many-Methods.md