Skip to content

Commit

Permalink
Merge pull request #129 from rainforestapp/reek-config
Browse files Browse the repository at this point in the history
Add .reek.yml
  • Loading branch information
grodowski authored Jul 13, 2022
2 parents c3da4f6 + 39d1f27 commit 107d892
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 9 deletions.
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org' do
# Specify your gem's dependencies in rf-stylez.gemspec
gemspec
end
source "https://rubygems.org"

gemspec
11 changes: 7 additions & 4 deletions bin/rf-stylez
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ require "bundler/setup"
require "rf/stylez"

command = ARGV.first
unless command == 'check-latest'
STDERR.puts('Usage: rf-stylez check-latest')
return
case command
when 'check-latest'
Rf::Stylez::UpdateCheck.check
when 'reek-config-path'
puts(Rf::Stylez.reek_config_path)
else
STDERR.puts('Usage: rf-stylez [check-latest][reek-config-path]')
end

Rf::Stylez::UpdateCheck.check
3 changes: 3 additions & 0 deletions lib/rf/stylez.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@

module Rf
module Stylez
def self.reek_config_path
File.expand_path("../../ruby/.reek.yml", __dir__)
end
end
end
2 changes: 1 addition & 1 deletion lib/rf/stylez/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Rf
module Stylez
VERSION = '0.14.0'
VERSION = '0.15.0'
end
end
1 change: 1 addition & 0 deletions rf-stylez.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'rubocop', '1.15.0'
spec.add_runtime_dependency 'rubocop-rails', '2.10.1'
spec.add_runtime_dependency 'rubocop-rspec', '2.3.0'
spec.add_runtime_dependency 'reek', '~> 6.1'
spec.add_runtime_dependency 'get_env', '~> 0.2.0'
spec.add_runtime_dependency 'semantic_versioning', '~> 0.2'
spec.add_runtime_dependency 'unparser', '~> 0.6'
Expand Down
62 changes: 62 additions & 0 deletions ruby/.reek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
### Generic smell configuration

# You can check all defaults at https://github.com/troessner/reek/blob/master/docs/defaults.reek.yml
detectors:
# IrresponsibleModule duplicates rubocop top-level comment rule
IrresponsibleModule:
enabled: false

NestedIterators:
max_allowed_nesting: 1

UtilityFunction:
public_methods_only: true

TooManyStatements:
max_statements: 10

TooManyMethods:
max_methods: 20

TooManyInstanceVariables:
max_instance_variables: 8

### Directory specific configuration

# You can configure smells on a per-directory base.
# E.g. the classic Rails case: controllers smell of NestedIterators (see /docs/Nested-Iterators.md) and
# helpers smell of UtilityFunction (see docs/Utility-Function.md)
#
# Note that we only allow configuration on a directory level, not a file level,
# so all paths have to point to directories.
# A Dir.glob pattern can be used.
directories:
"app/controllers":
NestedIterators:
max_allowed_nesting: 2
UnusedPrivateMethod:
enabled: false
InstanceVariableAssumption:
enabled: false
"app/helpers":
UtilityFunction:
enabled: false
"app/mailers":
InstanceVariableAssumption:
enabled: false
"app/models":
InstanceVariableAssumption:
enabled: false
"app/rack/api":
MissingSafeMethod:
exclude:
- validate_param!
InstanceVariableAssumption:
enabled: false

exclude_paths:
- db/
- script/
- bin/
- app/jobs/data_correction/

0 comments on commit 107d892

Please sign in to comment.