Sha256: 92dfa147e50d567fd36ef7b0fb0706ff3497539685d4088851296caad5203ba4
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 KB
Contents
# Uncommunicative Parameter Name ## Introduction An `Uncommunicative Parameter Name` is a parameter name that doesn't communicate its intent well enough. Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names. ## Current Support in Reek `Uncommunicative Parameter Name` checks for: * 1-character names * any name ending with a number * camelCaseVariableNames ## 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-4.0.1 | docs/Uncommunicative-Parameter-Name.md |
reek-4.0.0 | docs/Uncommunicative-Parameter-Name.md |