Skip to content

Commit

Permalink
Update rubocop to 1.35.0 (#332)
Browse files Browse the repository at this point in the history
- General bundle update.
- Update the docs too.
  • Loading branch information
BrianHawley authored Aug 17, 2022
1 parent b4bce16 commit 4b10722
Showing 6 changed files with 120 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
gem "activesupport", require: false
gem "parser"
gem "pry", require: false
gem "rubocop", "1.34.1", require: false
gem "rubocop", "1.35.0", require: false
gem "rubocop-i18n", require: false
gem "rubocop-graphql", require: false
gem "rubocop-minitest", require: false
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ GEM
concurrent-ruby (~> 1.0)
json (2.6.2)
method_source (1.0.0)
minitest (5.16.2)
minitest (5.16.3)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
@@ -39,14 +39,14 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (1.34.1)
rubocop (1.35.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.0, < 2.0)
rubocop-ast (>= 1.20.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
@@ -77,7 +77,7 @@ GEM
rubocop-thread_safety (0.4.4)
rubocop (>= 0.53.0)
ruby-progressbar (1.11.0)
test-prof (1.0.9)
test-prof (1.0.10)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unicode-display_width (2.2.0)
@@ -91,7 +91,7 @@ DEPENDENCIES
pry
rake
rspec
rubocop (= 1.34.1)
rubocop (= 1.35.0)
rubocop-graphql
rubocop-i18n
rubocop-minitest
1 change: 1 addition & 0 deletions config/contents/layout/line_length.md
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ are recommended to further format the broken lines.
(Many of these are enabled by default.)

* ArgumentAlignment
* ArrayAlignment
* BlockAlignment
* BlockDelimiters
* BlockEndNewline
17 changes: 8 additions & 9 deletions config/contents/lint/erb_new_arguments.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

This cop emulates the following Ruby warnings in Ruby 2.6.

```console
% cat example.rb
ERB.new('hi', nil, '-', '@output_buffer')
% ruby -rerb example.rb
example.rb:1: warning: Passing safe_level with the 2nd argument of
ERB.new is deprecated. Do not use it, and specify other arguments as
keyword arguments.
example.rb:1: warning: Passing trim_mode with the 3rd argument of
ERB.new is deprecated. Use keyword argument like
ERB.new(str, trim_mode:...) instead.
example.rb:1: warning: Passing eoutvar with the 4th argument of ERB.new
is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...)
instead.
example.rb:1: warning: Passing safe_level with the 2nd argument of ERB.new is
deprecated. Do not use it, and specify other arguments as keyword arguments.
example.rb:1: warning: Passing trim_mode with the 3rd argument of ERB.new is
deprecated. Use keyword argument like ERB.new(str, trim_mode:...) instead.
example.rb:1: warning: Passing eoutvar with the 4th argument of ERB.new is
deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.
```

Now non-keyword arguments other than first one are softly deprecated
and will be removed when Ruby 2.5 becomes EOL.
15 changes: 15 additions & 0 deletions config/contents/style/hash_syntax.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ The supported styles are:
* always - forces use of the 3.1 syntax (e.g. {foo:})
* never - forces use of explicit hash literal value
* either - accepts both shorthand and explicit use of hash literal value
* consistent - like "always", but will avoid mixing styles in a single hash

### Example: EnforcedStyle: ruby19 (default)
# bad
@@ -83,3 +84,17 @@ The supported styles are:

# good
{foo:, bar:}

### Example: EnforcedShorthandSyntax: consistent

# bad
{foo: , bar: bar}

# good
{foo:, bar:}

# bad
{foo: , bar: baz}

# good
{foo: foo, bar: baz}
90 changes: 90 additions & 0 deletions config/contents/style/magic_comment_format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Ensures magic comments are written consistently throughout your code base.
Looks for discrepancies in separators (`-` vs `_`) and capitalization for
both magic comment directives and values.

Required capitalization can be set with the `DirectiveCapitalization` and
`ValueCapitalization` configuration keys.

NOTE: If one of these configuration is set to nil, any capitalization is allowed.

### Example: EnforcedStyle: snake_case (default)
# The `snake_case` style will enforce that the frozen string literal
# comment is written in snake case. (Words separated by underscores)
# bad
# frozen-string-literal: true

module Bar
# ...
end

# good
# frozen_string_literal: false

module Bar
# ...
end

### Example: EnforcedStyle: kebab_case
# The `kebab_case` style will enforce that the frozen string literal
# comment is written in kebab case. (Words separated by hyphens)
# bad
# frozen_string_literal: true

module Baz
# ...
end

# good
# frozen-string-literal: true

module Baz
# ...
end

### Example: DirectiveCapitalization: lowercase (default)
# bad
# FROZEN-STRING-LITERAL: true

# good
# frozen-string-literal: true

### Example: DirectiveCapitalization: uppercase
# bad
# frozen-string-literal: true

# good
# FROZEN-STRING-LITERAL: true

### Example: DirectiveCapitalization: nil
# any capitalization is accepted

# good
# frozen-string-literal: true

# good
# FROZEN-STRING-LITERAL: true

### Example: ValueCapitalization: nil (default)
# any capitalization is accepted

# good
# frozen-string-literal: true

# good
# frozen-string-literal: TRUE

### Example: ValueCapitalization: lowercase
# when a value is not given, any capitalization is accepted

# bad
# frozen-string-literal: TRUE

# good
# frozen-string-literal: TRUE

### Example: ValueCapitalization: uppercase
# bad
# frozen-string-literal: true

# good
# frozen-string-literal: TRUE

0 comments on commit 4b10722

Please sign in to comment.