Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 726 Bytes

Too-Many-Constants.md

File metadata and controls

37 lines (27 loc) · 726 Bytes

Introduction

Too Many Constants is a case of Large Class.

Example

Given this configuration

TooManyConstants:
  max_constants: 3

and this code:

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, plus:

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