Skip to content

Commit

Permalink
Bump RuboCop to 0.47.1 (#89)
Browse files Browse the repository at this point in the history
The change in the Dockerfile is motivated by this issue and it's
suggested workaround: ku1ik/rainbow#48

I generated the docs outside of docker because the rake task doesn't
currently work inside docker. I think that's fine.

The `Registry` change is to maintain parity with an internal RuboCop
refactoring that took place as part of this update.
  • Loading branch information
maxjacobson authored Feb 13, 2017
1 parent 1eec00b commit dbaeb02
Show file tree
Hide file tree
Showing 76 changed files with 1,208 additions and 72 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ WORKDIR /usr/src/app
COPY Gemfile /usr/src/app/
COPY Gemfile.lock /usr/src/app/

RUN gem install bundler && \
RUN gem update --system && \
gem install bundler && \
bundle install -j 4 && \
rm -fr /usr/share/ri

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source 'https://rubygems.org'
gem "activesupport", require: false
gem "parser", "~> 2.3.3.1"
gem "pry", require: false
gem "rubocop", "~> 0.45", require: false
gem "rubocop", "~> 0.47.1", require: false
gem "rubocop-migrations", require: false
gem "rubocop-rspec", require: false
gem "safe_yaml"
Expand Down
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rainbow (2.1.0)
rainbow (2.2.1)
rake (12.0.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
Expand All @@ -35,8 +35,8 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
rubocop (0.46.0)
parser (>= 2.3.1.1, < 3.0)
rubocop (0.47.1)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
Expand All @@ -51,7 +51,7 @@ GEM
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
unicode-display_width (1.1.2)
unicode-display_width (1.1.3)

PLATFORMS
ruby
Expand All @@ -62,10 +62,10 @@ DEPENDENCIES
pry
rake
rspec
rubocop (~> 0.45)
rubocop (~> 0.47.1)
rubocop-migrations
rubocop-rspec
safe_yaml

BUNDLED WITH
1.13.6
1.14.4
13 changes: 9 additions & 4 deletions config/contents/lint/ambiguous_operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ This cop checks for ambiguous operators in the first argument of a
method invocation without parentheses.

### Example:
array = [1, 2, 3]

# bad

# The `*` is interpreted as a splat operator but it could possibly be
# a `*` method invocation (i.e. `do_something.*(array)`).
do_something *array
# a `*` method invocation (i.e. `do_something.*(some_array)`).
do_something *some_array

### Example:

# good

# With parentheses, there's no ambiguity.
do_something(*array)
do_something(*some_array)
7 changes: 7 additions & 0 deletions config/contents/lint/ambiguous_regexp_literal.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ This cop checks for ambiguous regexp literals in the first argument of
a method invocation without parentheses.

### Example:

# bad

# This is interpreted as a method invocation with a regexp literal,
# but it could possibly be `/` method invocations.
# (i.e. `do_something./(pattern)./(i)`)
do_something /pattern/i

### Example:

# good

# With parentheses, there's no ambiguity.
do_something(/pattern/i)
18 changes: 18 additions & 0 deletions config/contents/lint/assignment_in_condition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This cop checks for assignments in the conditions of
if/while/until.

### Example:

# bad

if some_var = true
do_something
end

### Example:

# good

if some_var == true
do_something
end
32 changes: 27 additions & 5 deletions config/contents/lint/block_alignment.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
This cop checks whether the end keywords are aligned properly for do
end blocks.

Three modes are supported through the `AlignWith` configuration
parameter:
Three modes are supported through the `EnforcedStyleAlignWith`
configuration parameter:

`start_of_block` : the `end` shall be aligned with the
start of the line where the `do` appeared.
Expand All @@ -15,18 +15,40 @@ location. The autofixer will default to `start_of_line`.

### Example:

# either
# bad

foo.bar
.each do
baz
end

### Example:

# EnforcedStyleAlignWith: either (default)

# good

variable = lambda do |i|
i
end

# start_of_block
### Example:

# EnforcedStyleAlignWith: start_of_block

# good

foo.bar
.each do
baz
end

# start_of_line
### Example:

# EnforcedStyleAlignWith: start_of_line

# good

foo.bar
.each do
baz
Expand Down
14 changes: 14 additions & 0 deletions config/contents/lint/circular_argument_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,41 @@ arguments and optional ordinal arguments.
This cop mirrors a warning produced by MRI since 2.2.

### Example:

# bad

def bake(pie: pie)
pie.heat_up
end

### Example:

# good

def bake(pie:)
pie.refrigerate
end

### Example:

# good

def bake(pie: self.pie)
pie.feed_to(user)
end

### Example:

# bad

def cook(dry_ingredients = dry_ingredients)
dry_ingredients.reduce(&:+)
end

### Example:

# good

def cook(dry_ingredients = self.dry_ingredients)
dry_ingredients.combine
end
10 changes: 10 additions & 0 deletions config/contents/lint/condition_position.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ if/while/until.

### Example:

# bad

if
some_condition
do_something
end

### Example:

# good

if some_condition
do_something
end
29 changes: 29 additions & 0 deletions config/contents/lint/debugger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
This cop checks for calls to debugger or pry.

### Example:

# bad (ok during development)

# using pry
def some_method
binding.pry
do_something
end

### Example:

# bad (ok during development)

# using byebug
def some_method
byebug
do_something
end

### Example:

# good

def some_method
do_something
end
24 changes: 22 additions & 2 deletions config/contents/lint/def_end_alignment.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
This cop checks whether the end keywords of method definitions are
aligned properly.

Two modes are supported through the AlignWith configuration
Two modes are supported through the EnforcedStyleAlignWith configuration
parameter. If it's set to `start_of_line` (which is the default), the
`end` shall be aligned with the start of the line where the `def`
keyword is. If it's set to `def`, the `end` shall be aligned with the
`def` keyword.

### Example:

# bad

private def foo
end

### Example:

# EnforcedStyleAlignWith: start_of_line (default)

# good

private def foo
end

### Example:

# EnforcedStyleAlignWith: def

# good

private def foo
end
end
13 changes: 13 additions & 0 deletions config/contents/lint/deprecated_class_methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This cop checks for uses of the deprecated class method usages.

### Example:

# bad

File.exists?(some_path)

### Example:

# good

File.exist?(some_path)
26 changes: 19 additions & 7 deletions config/contents/lint/duplicate_case_condition.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ used in case 'when' expressions.

### Example:

# bad
case x
when 'first'
do_something
when 'first'
do_something_else
end
# bad

case x
when 'first'
do_something
when 'first'
do_something_else
end

### Example:

# good

case x
when 'first
do_something
when 'second'
do_something_else
end
14 changes: 14 additions & 0 deletions config/contents/lint/duplicate_methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@ This cop checks for duplicated instance (or singleton) method
definitions.

### Example:

# bad

def duplicated
1
end

def duplicated
2
end

### Example:

# good

def duplicated
1
end

def other_duplicated
2
end
11 changes: 10 additions & 1 deletion config/contents/lint/duplicated_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@ This cop checks for duplicated keys in hash literals.
This cop mirrors a warning in Ruby 2.2.

### Example:
hash = { food: 'apple', food: 'orange' }

# bad

hash = { food: 'apple', food: 'orange' }

### Example:

# good

hash = { food: 'apple', other_food: 'orange' }
Loading

0 comments on commit dbaeb02

Please sign in to comment.