Sha256: 366a422984c3ce98b12687ad8d5c4af60ec08ad50ff028a3804dcf9f9ff6cae2

Contents?: true

Size: 1.51 KB

Versions: 32

Compression:

Stored size: 1.51 KB

Contents

# Uncommunicative Parameter Name

## Introduction

An _Uncommunicative Parameter Name_ is a parameter name that doesn't
communicate its intent well enough. This code smell is a case of
[Uncommunicative Name](Uncommunicative-Name.md).

## Current Support in Reek

_Uncommunicative Parameter Name_ checks for:

* single-character names
* any name ending with a number
* camelCaseParameterNames

## Configuration

Reek's _Uncommunicative Parameter Name_ detector supports the [Basic Smell Options](Basic-Smell-Options.md), plus:

| Option   | Value       | Effect  |
| ---------|-------------|---------|
| `reject` | array of regular expressions or strings | The set of patterns / names that Reek uses to check for bad names. Defaults to `[/^.$/, /[0-9]$/, /[A-Z]/, /^_/]. |
| `accept` | array of regular expressions or strings | The set of patterns / names that Reek will accept (and not report) even if they match one of the `reject` expressions. |


An example configuration could look like this:

```Yaml
---
UncommunicativeParameterName:
  accept:
    - !ruby/regexp /x/
    - arg1
  reject:
    - !ruby/regexp /foobar/
```

Applying a configuration to a source file like this:

```Ruby
def omg(x); x; end # Should not be reported
def omg(arg1); arg1; end # Should not be reported
def omg(foobar); foobar; end # Should be reported
```

Reek would report:

```
smelly.rb -- 1 warning:
  [3]:UncommunicativeParameterName: omg has the parameter name 'foobar' [https://github.com/troessner/reek/blob/master/docs/Uncommunicative-Parameter-Name.md]
```

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
reek-4.8.1 docs/Uncommunicative-Parameter-Name.md
reek-4.8.0 docs/Uncommunicative-Parameter-Name.md
reek-4.7.3 docs/Uncommunicative-Parameter-Name.md
reek-4.7.2 docs/Uncommunicative-Parameter-Name.md
reek-4.7.1 docs/Uncommunicative-Parameter-Name.md
reek-4.7.0 docs/Uncommunicative-Parameter-Name.md
reek-4.6.2 docs/Uncommunicative-Parameter-Name.md
reek-4.6.1 docs/Uncommunicative-Parameter-Name.md
reek-4.6.0 docs/Uncommunicative-Parameter-Name.md
reek-4.5.6 docs/Uncommunicative-Parameter-Name.md
reek-4.5.5 docs/Uncommunicative-Parameter-Name.md
reek-4.5.4 docs/Uncommunicative-Parameter-Name.md
reek-4.5.3 docs/Uncommunicative-Parameter-Name.md
reek-4.5.2 docs/Uncommunicative-Parameter-Name.md
reek-4.5.1 docs/Uncommunicative-Parameter-Name.md
reek-4.5.0 docs/Uncommunicative-Parameter-Name.md
reek-4.4.2 docs/Uncommunicative-Parameter-Name.md
reek-4.4.1 docs/Uncommunicative-Parameter-Name.md
reek-4.4.0 docs/Uncommunicative-Parameter-Name.md
reek-4.3.0 docs/Uncommunicative-Parameter-Name.md