README.md in reek-6.1.4 vs README.md in reek-6.2.0

- old
+ new

@@ -33,20 +33,20 @@ - [Miscellaneous](#miscellaneous) - [More information](#more-information) ## Overview -* [![Build Status](https://secure.travis-ci.org/troessner/reek.svg?branch=master)](https://travis-ci.org/troessner/reek?branch=master) +* ![Downloads](https://img.shields.io/badge/Downloads-%3E24_million-blue) +* ![Build Status](https://github.com/troessner/reek/actions/workflows/ruby.yml/badge.svg?branch=master) * [![Gem Version](https://badge.fury.io/rb/reek.svg)](https://badge.fury.io/rb/reek) -* ![](http://img.shields.io/github/tag/troessner/reek.svg) -* ![](http://img.shields.io/badge/license-MIT-brightgreen.svg) +* ![Git Tag](http://img.shields.io/github/tag/troessner/reek.svg) +* ![Licence](http://img.shields.io/badge/license-MIT-brightgreen.svg) * [![Inline docs](https://inch-ci.org/github/troessner/reek.png)](https://inch-ci.org/github/troessner/reek) * [![Code Climate](https://codeclimate.com/github/troessner/reek/badges/gpa.svg)](https://codeclimate.com/github/troessner/reek) * [![codebeat](https://codebeat.co/badges/42fed4ff-3e55-4aed-8ecc-409b4aa539b3)](https://codebeat.co/projects/github-com-troessner-reek) -* ![](http://ruby-gem-downloads-badge.herokuapp.com/reek?type=total) -* ![](http://ruby-gem-downloads-badge.herokuapp.com/reek?label=downloads-current-version) + ## Quickstart Reek is a tool that examines Ruby classes, modules and methods and reports any [Code Smells](docs/Code-Smells.md) it finds. @@ -54,25 +54,25 @@ [Code Smells](docs/Code-Smells.md) and Reek check out [this blog post](https://blog.codeship.com/how-to-find-ruby-code-smells-with-reek/) or [that one](https://troessner.svbtle.com/the-latest-and-greatest-additions-to-reek). There is also [this talk](https://www.youtube.com/watch?v=pazYe7WRWRU) from [RubyConfBY](http://rubyconference.by/) (there is also a [slide deck](http://talks.chastell.net/rubyconf-by-lt-2016/) if you prefer that). Install it via rubygems: -```Bash +```bash gem install reek ``` and run it like this: -```Bash +```bash reek [options] [dir_or_source_file]* ``` ## Example Imagine a source file `demo.rb` containing: -```Ruby +```ruby # Smelly class class Smelly # This will reek of UncommunicativeMethodName def x y = 10 # This will reek of UncommunicativeVariableName @@ -109,11 +109,11 @@ language and business logic. That said, an example might help you get going. Have a look at this sample of a Ruby on Rails model (be aware that this is truncated, not working code): -```Ruby +```ruby class ShoppingCart < ActiveRecord::Base has_many :items def gross_price items.sum { |item| item.net + item.tax } @@ -138,11 +138,11 @@ ``` Fixing this is pretty straightforward. Put the gross price calculation for a single item where it belongs, which would be the `Item` class: -```Ruby +```ruby class ShoppingCart < ActiveRecord::Base has_many :items def gross_price items.sum { |item| item.gross_price } @@ -163,37 +163,37 @@ ## Sources There are multiple ways you can have Reek work on sources, the most common one just being -```Bash +```bash reek lib/ ``` If you don't pass any source arguments to Reek it just takes the current working directory as source. So -```Bash +```bash reek ``` is the exact same thing as being explicit: -```Bash +```bash reek . ``` Additionally you can pipe code to Reek like this: -```Bash +```bash echo "class C; def m; end; end" | reek ``` This would print out: -```Bash +```bash $stdin -- 3 warnings: [1]:C has no descriptive comment (IrresponsibleModule) [1]:C has the name 'C' (UncommunicativeModuleName) [1]:C#m has the name 'm' (UncommunicativeMethodName) ``` @@ -217,20 +217,20 @@ [Unused Private Method](docs/Unused-Private-Method.md) is disabled by default because it is [kind of controversial](https://github.com/troessner/reek/issues/844) which means you have to explicitly activate it in your configuration via -```Yaml +```yaml UnusedPrivateMethod: enabled: true ``` [Utility Function](docs/Utility-Function.md) is a [controversial detector](https://github.com/troessner/reek/issues/681) as well that can turn out to be really unforgiving. As a consequence, we made it possible to disable it for non-public methods like this: -```Yaml +```yaml --- UtilityFunction: public_methods_only: true ``` @@ -238,11 +238,11 @@ ### Command-line interface For a basic overview, run -```Ruby +```ruby reek --help ``` For a summary of those CLI options see [Command-Line Options](docs/Command-Line-Options.md). @@ -326,11 +326,11 @@ # Directories and files below will not be scanned at all exclude_paths: - lib/legacy - lib/rake/legacy_tasks - - lib/smelly.rb + - lib/smelly.rb ``` As you see above, Reek's configuration consists of 3 different sections denoted by 3 different keys: * detectors @@ -393,20 +393,20 @@ In case you need to suppress a smell warning and you can't or don't want to use configuration files for whatever reasons you can also use special source code comments like this: -```Ruby +```ruby # This method smells of :reek:NestedIterators def smelly_method foo foo.each {|bar| bar.each {|baz| baz.qux}} end ``` You can even pass in smell specific configuration settings: -```Ruby +```ruby # :reek:NestedIterators { max_allowed_nesting: 2 } def smelly_method foo foo.each {|bar| bar.each {|baz| baz.qux}} end ``` @@ -430,11 +430,11 @@ Sure you could manually disable smell warnings like shown above but depending on the size of your codebase this might not be an option. Fortunately Reek provides a 'todo' flag which you can use to generate a configuration that will suppress all smell warnings for the current codebase: -```Bash +```bash reek --todo lib/ ``` This will create the file '.reek.yml' in your current working directory. @@ -445,11 +445,11 @@ If for whatever reasons you decide to put '.reek.yml' somewhere else where Reek won't pick it up automatically you need to tell Reek explicitly to do so via: -```Bash +```bash reek -c whatever/.reek.yml lib/ ``` It's important to understand that the number one use case of the `--todo` flag is to be run once at the beginning of the introduction of Reek to ease the transition. @@ -459,11 +459,11 @@ As a consequence, running Reek with the `--todo` flag again will not overwrite an existing '.reek.yml' and instead abort execution. It also will not take **any** other configuration file you might have into account. This means that when you run -```Bash +```bash reek -c other_configuration.reek --todo lib/ ``` `other_configuration.reek` will simply be ignored. @@ -472,11 +472,11 @@ ## Usage Besides the obvious -```Bash +```bash reek [options] [dir_or_source_file]* ``` there are quite a few other ways how to use Reek in your projects: @@ -521,11 +521,11 @@ ``` You can also use Pry while running the tests by adding the following at the point where you want to start debugging: -```Ruby +```ruby require 'pry' binding.pry ``` Have a look at our [Developer API](docs/API.md) for more inspiration. @@ -567,10 +567,10 @@ ## Working with Rails Making Reek "Rails"-friendly is fairly simple since we support directory specific configurations (`directory directives` in Reek talk). Just add this to your configuration file: -```Yaml +```yaml directories: "app/controllers": IrresponsibleModule: enabled: false NestedIterators: