Skip to content

Rubocop 0.50.0 #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FROM ruby:2.3-alpine
FROM ruby:2.4-alpine

WORKDIR /usr/src/app
COPY Gemfile /usr/src/app/
COPY Gemfile.lock /usr/src/app/

RUN gem install bundler && \
bundle install -j 4 && \
rm -fr /usr/share/ri
RUN adduser -u 9000 -D app

RUN apk --update add git
COPY Gemfile Gemfile.lock /usr/src/app/

RUN gem install bundler && \
bundle install -j 4 --without=test && \
chown -R app:app /usr/local/bundle && \
rm -fr ~/.gem ~/.bundle ~/.wh..gem

RUN adduser -u 9000 -D app
COPY . /usr/src/app
RUN chown -R app:app /usr/src/app
RUN chown -R app:app .

USER app

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.4.0"
gem "pry", require: false
gem "rubocop", "~> 0.45", require: false
gem "rubocop", "~> 0.50.0", require: false
gem "rubocop-migrations", require: false
gem "rubocop-rspec", require: false
gem "safe_yaml"
Expand Down
69 changes: 35 additions & 34 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.0.1)
activesupport (5.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
ast (2.3.0)
coderay (1.1.1)
concurrent-ruby (1.0.3)
diff-lcs (1.2.5)
i18n (0.7.0)
method_source (0.8.2)
minitest (5.10.1)
coderay (1.1.2)
concurrent-ruby (1.0.5)
diff-lcs (1.3)
i18n (0.8.6)
method_source (0.9.0)
minitest (5.10.3)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
powerpack (0.1.1)
pry (0.10.4)
pry (0.11.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rainbow (2.1.0)
rake (12.0.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
method_source (~> 0.9.0)
rainbow (2.2.2)
rake
rake (12.1.0)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
rspec-support (~> 3.6.0)
rspec-mocks (3.6.0)
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)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rubocop (0.50.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-migrations (0.1.2)
rubocop (~> 0.41)
rubocop-rspec (1.8.0)
rubocop (>= 0.42.0)
ruby-progressbar (1.8.1)
rubocop-rspec (1.18.0)
rubocop (>= 0.50.0)
ruby-progressbar (1.9.0)
safe_yaml (1.0.4)
slop (3.6.0)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (0.3.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
unicode-display_width (1.1.2)
unicode-display_width (1.3.0)

PLATFORMS
ruby
Expand All @@ -62,7 +63,7 @@ DEPENDENCIES
pry
rake
rspec
rubocop (~> 0.45)
rubocop (~> 0.50.0)
rubocop-migrations
rubocop-rspec
safe_yaml
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ image:
docker build --rm -t $(IMAGE_NAME) .

test: image
docker run --rm $(IMAGE_NAME) sh -c "cd /usr/src/app && bundle exec rake"
docker run --rm $(IMAGE_NAME) sh -c "cd /usr/src/app && bundle install --with=test && bundle exec rake"

docs: image
docker run --rm \
--user root \
--workdir /usr/src/app \
--volume $(PWD):/usr/src/app \
$(IMAGE_NAME) sh -c "bundle exec rake docs:scrape"
$(IMAGE_NAME) sh -c "apk --update add git && bundle exec rake docs:scrape"
12 changes: 8 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# frozen_string_literal: true

require "rspec/core/rake_task"

Rake.add_rakelib "lib/tasks"
RSpec::Core::RakeTask.new(:spec)
task default: :spec

begin
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)
task default: :spec
rescue LoadError
end
22 changes: 22 additions & 0 deletions config/contents/bundler/insecure_protocol_source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The symbol argument `:gemcutter`, `:rubygems` and `:rubyforge`
are deprecated. So please change your source to URL string that
'https://rubygems.org' if possible, or 'http://rubygems.org' if not.

This autocorrect will replace these symbols with 'https://rubygems.org'.
Because it is secure, HTTPS request is strongly recommended. And in
most use cases HTTPS will be fine.

However, it don't replace all `sources` of `http://` with `https://`.
For example, when specifying an internal gem server using HTTP on the
intranet, a use case where HTTPS can not be specified was considered.
Consider using HTTP only if you can not use HTTPS.

### Example:
# bad
source :gemcutter
source :rubygems
source :rubyforge

# good
source 'https://rubygems.org' # strongly recommended
source 'http://rubygems.org'
9 changes: 8 additions & 1 deletion config/contents/bundler/ordered_gems.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Gems in consecutive lines should be alphabetically sorted
Gems should be alphabetically sorted within groups.

### Example:
# bad
gem 'rubocop'
Expand All @@ -11,4 +12,10 @@ Gems in consecutive lines should be alphabetically sorted
# good
gem 'rubocop'

gem 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
21 changes: 21 additions & 0 deletions config/contents/lint/ambiguous_block_association.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This cop checks for ambiguous block association with method
when param passed without parentheses.

### Example:

# bad
some_method a { |val| puts val }

### Example:

# good
# With parentheses, there's no ambiguity.
some_method(a) { |val| puts val }

# good
# Operator methods require no disambiguation
foo == bar { |b| b.baz }

# good
# Lambda arguments require no disambiguation
foo = ->(bar) { bar.baz }
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
18 changes: 18 additions & 0 deletions config/contents/lint/boolean_symbol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This cop checks for `:true` and `:false` symbols.
In most cases it would be a typo.

### Example:

# bad
:true

# good
true

### Example:

# bad
:false

# good
false
Loading