Skip to content

Commit

Permalink
Change devtools, flay, flog, reek and rubocop thresholds
Browse files Browse the repository at this point in the history
* Add rubocop configuration that will exclude vendor
* Fix code to pass rubocop
  • Loading branch information
dkubb authored and sferik committed Dec 24, 2013
1 parent c18b1e6 commit 00a66c6
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AllCops:
Includes:
- 'Gemfile'
Excludes:
- 'Gemfile.devtools'
- 'vendor/**'
1 change: 1 addition & 0 deletions config/devtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
unit_test_timeout: 0.1
fail_on_branch:
- "master"
- "devtools"
4 changes: 2 additions & 2 deletions config/flay.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
threshold: 0
total_score: 0
threshold: 7
total_score: 32
2 changes: 1 addition & 1 deletion config/flog.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
threshold: 0
threshold: 23.7
16 changes: 11 additions & 5 deletions config/reek.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
Attribute:
enabled: true
exclude: []
exclude:
- Memoizable::MethodBuilder
BooleanParameter:
enabled: true
exclude: []
Expand All @@ -18,7 +19,8 @@ DataClump:
min_clump_size: 2
DuplicateMethodCall:
enabled: true
exclude: []
exclude:
- Memoizable::Memory#fetch # double-checked lock requires duplicate code
max_calls: 1
allow_calls: []
FeatureEnvy:
Expand All @@ -40,7 +42,9 @@ LongYieldList:
max_params: 2
NestedIterators:
enabled: true
exclude: []
exclude:
- Memoizable::Memory#fetch # uses nested blocks
- Memoizable::MethodBuilder#create_memoized_method
max_allowed_nesting: 1
ignore_iterators: []
NilCheck:
Expand All @@ -52,7 +56,8 @@ RepeatedConditional:
max_ifs: 1
TooManyInstanceVariables:
enabled: true
exclude: []
exclude:
- Memoizable::MethodBuilder
max_instance_variables: 3
TooManyMethods:
enabled: true
Expand All @@ -61,8 +66,9 @@ TooManyMethods:
TooManyStatements:
enabled: true
exclude:
- Memoizable::MethodBuilder#initialize
- each
max_statements: 2
max_statements: 5
UncommunicativeMethodName:
enabled: true
exclude: []
Expand Down
9 changes: 1 addition & 8 deletions config/rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
AllCops:
Includes:
- '**/*.rake'
- 'Gemfile'
- 'Gemfile.devtools'
Excludes:
- '**/vendor/**'
- '**/benchmarks/**'
inherit_from: ../.rubocop.yml

# Avoid parameter lists longer than five parameters.
ParameterLists:
Expand Down
5 changes: 3 additions & 2 deletions spec/integration/serializable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Serializable
include Memoizable

def random_number
rand(10000)
rand(10_000)
end
memoize :random_number
end
Expand All @@ -17,7 +17,8 @@ def random_number
end

before do
serializable.random_number # Call the memoized method to trigger lazy memoization
# Call the memoized method to trigger lazy memoization
serializable.random_number
end

it 'is serializable with Marshal' do
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/memoizable/memory_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# encoding: utf-8

require 'spec_helper'

describe Memoizable::Memory do
let(:memory) { Memoizable::Memory.new }

context "serialization" do
context 'serialization' do
let(:deserialized) { Marshal.load(Marshal.dump(memory)) }

it 'is serializable with Marshal' do
Expand Down

0 comments on commit 00a66c6

Please sign in to comment.