Sha256: fb25cb7e8a3ea1fce69859a483be8dc203babea15711f1807319938d168e07fd

Contents?: true

Size: 802 Bytes

Versions: 49

Compression:

Stored size: 802 Bytes

Contents

# Attribute

## Introduction

A class that publishes a setter for an instance variable invites
client classes to become too intimate with its inner workings, and in
particular with its representation of state.

The same holds to a lesser extent for getters, but Reek doesn't flag those.

## Example

Given:

```Ruby
class Klass
  attr_accessor :dummy
end
```

Reek would emit the following warning:

```
reek test.rb

test.rb -- 1 warning:
  [2]:Attribute: Klass#dummy is a writable attribute
```

## Support in Reek

This detector it raises a warning for every public `attr_writer`,
`attr_accessor`, and `attr` with the writable flag set to `true`.

Reek does not raise warnings for read-only attributes.

## Configuration

_Attribute_ supports only the [Basic Smell Options](Basic-Smell-Options.md).

Version data entries

49 entries across 47 versions & 2 rubygems

Version Path
reek-5.6.0 docs/Attribute.md
reek-5.5.0 docs/Attribute.md
reek-5.4.1 docs/Attribute.md
reek-5.4.0 docs/Attribute.md
reek-5.3.2 docs/Attribute.md
reek-5.3.1 docs/Attribute.md
reek-5.3.0 docs/Attribute.md
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/docs/Attribute.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/Attribute.md
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/reek-5.2.0/docs/Attribute.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/Attribute.md
reek-5.2.0 docs/Attribute.md
reek-5.1.0 docs/Attribute.md
reek-5.0.2 docs/Attribute.md
reek-5.0.1 docs/Attribute.md
reek-5.0.0 docs/Attribute.md
reek-4.8.2 docs/Attribute.md
reek-4.8.1 docs/Attribute.md
reek-4.8.0 docs/Attribute.md
reek-4.7.3 docs/Attribute.md