Skip to content

Commit

Permalink
Update rubocop to 1.41.0 (#2288)
Browse files Browse the repository at this point in the history
* Update rubocop to 1.40.0

* Update rubocop_todo

* Rotate Danger token.

* Preparing for release, 1.7.0.

* Preparing for next development iteration, 1.7.1.

* rubocop 1.41.0

* Drop support to ruby 2.5
Update actions/checkout to v3

* Add drop support in CHANGELOG.md

* Rerun rubocop --auto-gen-config

* Split CHANGELOG lines.

* Attempt to trigger on all pull_request.

* Increase fetch depth.

Co-authored-by: Daniel (dB.) Doubrovkine <dblock@dblock.org>
  • Loading branch information
ericproulx and dblock authored Dec 22, 2022
1 parent 095c6e8 commit 5e8cd2a
Show file tree
Hide file tree
Showing 19 changed files with 153 additions and 57 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
name: danger
on:
pull_request:
types: [opened, reopened, edited, synchronize]

on: pull_request

jobs:
danger:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: RuboCop
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -25,7 +25,6 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.5
- 2.6
- 2.7
- "3.0"
Expand Down Expand Up @@ -61,7 +60,7 @@ jobs:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6
SuggestExtensions: false
Exclude:
- vendor/**/*
Expand Down
163 changes: 128 additions & 35 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-01-02 10:41:35 UTC using RuboCop version 1.23.0.
# on 2022-12-21 16:30:41 UTC using RuboCop version 1.41.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include.
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/DeprecatedAttributeAssignment:
Exclude:
- 'grape.gemspec'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequireMFA:
Exclude:
- 'grape.gemspec'

# Offense count: 1
# Configuration parameters: IgnoredMethods.
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/grape/dsl/routing_spec.rb'
Expand Down Expand Up @@ -47,40 +55,39 @@ Lint/EmptyClass:
- 'spec/grape/entity_spec.rb'
- 'spec/grape/middleware/stack_spec.rb'

# Offense count: 7
# Offense count: 6
Lint/MissingSuper:
Exclude:
- 'lib/grape/api/instance.rb'
- 'lib/grape/exceptions/base.rb'
- 'lib/grape/exceptions/validation_array_errors.rb'
- 'lib/grape/namespace.rb'
- 'lib/grape/path.rb'
- 'lib/grape/router/pattern.rb'
- 'lib/grape/validations/validators/base.rb'

# Offense count: 43
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
# Offense count: 41
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 43

# Offense count: 6
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# IgnoredMethods: refine
# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 182
Max: 27

# Offense count: 9
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 298
Max: 295

# Offense count: 30
# Configuration parameters: IgnoredMethods.
# Offense count: 28
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 15

# Offense count: 68
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/MethodLength:
Max: 32

Expand All @@ -94,8 +101,8 @@ Metrics/ModuleLength:
Metrics/ParameterLists:
MaxOptionalParameters: 4

# Offense count: 27
# Configuration parameters: IgnoredMethods.
# Offense count: 25
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 15

Expand All @@ -111,7 +118,7 @@ Naming/MemoizedInstanceVariableName:

# Offense count: 5
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/grape/endpoint.rb'
Expand All @@ -120,7 +127,7 @@ Naming/MethodParameterName:
- 'spec/grape/api_spec.rb'

# Offense count: 18
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
Naming/VariableNumber:
Expand All @@ -147,8 +154,18 @@ RSpec/AnyInstance:
- 'spec/grape/api_spec.rb'
- 'spec/grape/middleware/base_spec.rb'

# Offense count: 332
# Configuration parameters: Prefixes.
# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: be_a, be_kind_of
RSpec/ClassCheck:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/endpoint_spec.rb'
- 'spec/grape/middleware/base_spec.rb'

# Offense count: 345
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Enabled: false
Expand All @@ -167,19 +184,29 @@ RSpec/DescribeClass:
- 'spec/grape/validations/instance_behaivour_spec.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/EmptyExampleGroup:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/dsl/configuration_spec.rb'
- 'spec/grape/validations/attributes_iterator_spec.rb'

# Offense count: 499
# Offense count: 507
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 57

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
# DisallowedExamples: works
RSpec/ExampleWording:
Exclude:
- 'spec/grape/integration/global_namespace_function_spec.rb'
- 'spec/grape/validations_spec.rb'

# Offense count: 7
# Cop supports --auto-correct.
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExpectActual:
Exclude:
- 'spec/routing/**/*'
Expand All @@ -192,7 +219,7 @@ RSpec/ExpectInHook:
- 'spec/grape/api_spec.rb'
- 'spec/grape/validations/validators/values_spec.rb'

# Offense count: 41
# Offense count: 43
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Expand Down Expand Up @@ -233,7 +260,7 @@ RSpec/MessageChain:
Exclude:
- 'spec/grape/middleware/formatter_spec.rb'

# Offense count: 135
# Offense count: 138
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
Expand All @@ -244,24 +271,42 @@ RSpec/MissingExampleGroupArgument:
Exclude:
- 'spec/grape/middleware/exception_spec.rb'

# Offense count: 755
# Offense count: 766
RSpec/MultipleExpectations:
Max: 16

# Offense count: 32
# Offense count: 38
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 10

# Offense count: 2116
# Configuration parameters: IgnoreSharedExamples.
# Offense count: 2145
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Enabled: false

# Offense count: 161
# Offense count: 171
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 6

# Offense count: 18
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Exclude:
- 'spec/grape/api_remount_spec.rb'
- 'spec/grape/api_spec.rb'
- 'spec/grape/entity_spec.rb'
- 'spec/grape/validations_spec.rb'

# Offense count: 6
# This cop supports unsafe autocorrection (--autocorrect-all).
RSpec/Rails/HaveHttpStatus:
Exclude:
- 'spec/grape/api_spec.rb'

# Offense count: 12
RSpec/RepeatedDescription:
Exclude:
Expand Down Expand Up @@ -343,11 +388,28 @@ Style/CombinableLoops:
- 'spec/grape/endpoint_spec.rb'

# Offense count: 2
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods.
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
EnforcedStyle: template

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, DirectiveCapitalization, ValueCapitalization.
# SupportedStyles: snake_case, kebab_case
# SupportedCapitalizations: lowercase, uppercase
Style/MagicCommentFormat:
Exclude:
- 'lib/grape/util/cache.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/MapToHash:
Exclude:
- 'lib/grape/dsl/request_response.rb'
- 'spec/grape/endpoint_spec.rb'

# Offense count: 12
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Expand All @@ -365,9 +427,40 @@ Style/OptionalBooleanParameter:
- 'lib/grape/validations/types/primitive_coercer.rb'
- 'lib/grape/validations/types/set_coercer.rb'

# Offense count: 144
# Cop supports --auto-correct.
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# Offense count: 28
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantConstantBase:
Exclude:
- 'spec/grape/api/invalid_format_spec.rb'
- 'spec/grape/api_spec.rb'
- 'spec/grape/dsl/logger_spec.rb'
- 'spec/grape/endpoint/declared_spec.rb'
- 'spec/grape/endpoint_spec.rb'
- 'spec/grape/middleware/formatter_spec.rb'
- 'spec/grape/validations/validators/coerce_spec.rb'
- 'spec/grape/validations/validators/default_spec.rb'
- 'spec/integration/multi_json/json_spec.rb'
- 'spec/integration/multi_xml/xml_spec.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Style/SafeNavigation:
Exclude:
- 'lib/grape/endpoint.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SlicingWithRange:
Exclude:
- 'lib/grape/dsl/inside_route.rb'
- 'lib/grape/request.rb'
- 'lib/grape/router/attribute_translator.rb'

# Offense count: 168
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 215
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Features

* [#2288](https://github.com/ruby-grape/grape/pull/2288): Droped support for Ruby 2.5 - [@ericproulx](https://github.com/ericproulx).
* [#2288](https://github.com/ruby-grape/grape/pull/2288): Updated rubocop to 1.41.0 - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

#### Fixes
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '1.25.1'
gem 'rubocop', '1.41.0'
gem 'rubocop-ast'
gem 'rubocop-performance', require: false
gem 'rubocop-rspec', require: false
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/multi_json.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ group :development, :test do
gem 'bundler'
gem 'hashie'
gem 'rake'
gem 'rubocop', '1.25.1'
gem 'rubocop', '1.41.0'
gem 'rubocop-ast'
gem 'rubocop-performance', require: false
gem 'rubocop-rspec', require: false
Expand Down
Loading

0 comments on commit 5e8cd2a

Please sign in to comment.