Sha256: 870337faff4c5f2596e287da12dc28a0e390b5bb01375badf52cff126f93379d

Contents?: true

Size: 726 Bytes

Versions: 47

Compression:

Stored size: 726 Bytes

Contents

## Introduction

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

## Example

Given this configuration

```yaml
TooManyConstants:
  max_constants: 3
```

and this code:

```Ruby
class Smelly
  CONST_1 = :dummy
  CONST_2 = :dummy
  CONST_3 = :dummy
  CONST_4 = :dummy
end
```

Reek would emit the following warning:

```
test.rb -- 1 warning:
  [1]:TooManyConstants: Smelly has 4 constants
```
## Configuration

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

| Option                   | Value   | Effect  |
| -------------------------|---------|---------|
| `max_constants` | integer | The maximum number of constants that are permitted. Defaults to 5 |

Version data entries

47 entries across 45 versions & 2 rubygems

Version Path
reek-6.0.3 docs/Too-Many-Constants.md
reek-6.0.2 docs/Too-Many-Constants.md
reek-6.0.1 docs/Too-Many-Constants.md
reek-6.0.0 docs/Too-Many-Constants.md
reek-5.6.0 docs/Too-Many-Constants.md
reek-5.5.0 docs/Too-Many-Constants.md
reek-5.4.1 docs/Too-Many-Constants.md
reek-5.4.0 docs/Too-Many-Constants.md
reek-5.3.2 docs/Too-Many-Constants.md
reek-5.3.1 docs/Too-Many-Constants.md
reek-5.3.0 docs/Too-Many-Constants.md
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/docs/Too-Many-Constants.md
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/docs/Too-Many-Constants.md
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/docs/Too-Many-Constants.md
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/docs/Too-Many-Constants.md
reek-5.2.0 docs/Too-Many-Constants.md
reek-5.1.0 docs/Too-Many-Constants.md
reek-5.0.2 docs/Too-Many-Constants.md
reek-5.0.1 docs/Too-Many-Constants.md
reek-5.0.0 docs/Too-Many-Constants.md