Sha256: f9e57d0e5b7bd8faced0891c5d185f6a6d6591422ad7009a7c1a6895ebacf942

Contents?: true

Size: 1.43 KB

Versions: 15

Compression:

Stored size: 1.43 KB

Contents

# Rake Task

## Introduction

`reek`  provides a Rake task that runs `reek` on a set of source files. In its most simple form you just include something like that in your Rakefile:

```Ruby
require 'reek/rake/task'

Reek::Rake::Task.new do |t|
  t.fail_on_error = false
end
```

In its most simple form, that's it.

When you now run:

```Bash
rake -T
```

you should see

```Bash
rake reek  # Check for code smells
```

## Configuration via task

An more sophisticated rake task that would make use of all available configuration options could look like this:

```Ruby
Reek::Rake::Task.new do |t|
  t.name          = 'custom_rake' # Whatever name you want. Defaults to "reek".
  t.config_file   = 'config/config.reek' # Defaults to nothing.
  t.source_files  = 'vendor/**/*.rb' # Glob pattern to match source files. Defaults to lib/**/*.rb
  t.reek_opts     = '-U'  # Defaults to ''. You can pass all the options here in that are shown by "reek -h"
  t.fail_on_error = false # Defaults to true
  t.verbose       = true  # Defaults to false
end
```

## Configuration via environment variables

You can overwrite the following attributes by environment variables:

- "reek_opts" by using REEK_OPTS
- "config_file" by using REEK_CFG
- "source_files" by using REEK_SRC

An example rake call using environment variables could look like this:

```Bash
REEK_CFG="config/custom.reek" REEK_OPTS="-s" rake reek
```

See also: [Reek-Driven-Development](Reek-Driven-Development.md)

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
reek-3.5.0 docs/Rake-Task.md
reek-3.4.1 docs/Rake-Task.md
reek-3.4.0 docs/Rake-Task.md
reek-3.3.1 docs/Rake-Task.md
reek-3.3.0 docs/Rake-Task.md
reek-3.2.1 docs/Rake-Task.md
reek-3.2 docs/Rake-Task.md
reek-3.1 docs/Rake-Task.md
reek-3.0.4 docs/Rake-Task.md
reek-3.0.3 docs/Rake-Task.md
reek-3.0.2 docs/Rake-Task.md
reek-3.0.1 docs/Rake-Task.md
reek-3.0.0 docs/Rake-Task.md
reek-2.2.1 docs/Rake-Task.md
reek-2.2.0 docs/Rake-Task.md