Skip to content

Commit

Permalink
Upgrade rubocop to v1.47 (#165)
Browse files Browse the repository at this point in the history
* chore: upgrade rubocop to the latest(1.47.0)

* chore: set target ruby version for rubocop

chore(ci): correct lint workflow name, use checkout v3

docs: add changelog entry

* fix: rubocop complaints

* Added support for Ruby 3.2.x.

* fix: lock rubocop target ruby version to 2.6

---------

Co-authored-by: Daniel (dB.) Doubrovkine <dblock@dblock.org>
  • Loading branch information
crazyoptimist and dblock committed Mar 6, 2023
1 parent e56f02d commit 5560369
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
name: test
name: lint
on: [push, pull_request]
jobs:
lint:
name: RuboCop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: '3.1'
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
AllCops:
SuggestExtensions: false
TargetRubyVersion: 2.6

Metrics:
Enabled: false

Expand All @@ -12,4 +16,3 @@ Style/FrozenStringLiteralComment:
Enabled: false

inherit_from: .rubocop_todo.yml

135 changes: 121 additions & 14 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,173 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-11-16 09:56:54 -0500 using RuboCop version 0.81.0.
# on 2023-03-02 20:56:34 UTC using RuboCop version 1.47.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: EnforcedStyle.
# SupportedStyles: squiggly, active_support, powerpack, unindent
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'slack-ruby-bot-server.gemspec'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/HeredocIndentation:
Exclude:
- 'lib/slack-ruby-bot-server/info.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/RescueEnsureAlignment:
Exclude:
- 'lib/slack-ruby-bot-server/models/team/methods.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/AmbiguousOperator:
Exclude:
- 'spec/slack-ruby-bot-server/service_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
Lint/NonDeterministicRequireOrder:
# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/spec_helper.rb'
- 'lib/slack-ruby-bot-server/models/team/methods.rb'

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'lib/slack-ruby-bot-server.rb'

# Offense count: 1
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/slack-ruby-bot-server/info.rb'

# Offense count: 3
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
Naming/MethodParameterName:
Exclude:
- 'lib/slack-ruby-bot-server/models/team/activerecord.rb'
- 'lib/slack-ruby-bot-server/models/team/mongoid.rb'
- 'lib/slack-ruby-bot-server/service.rb'

# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: separated, grouped
Style/AccessorGrouping:
Exclude:
- 'lib/slack-ruby-bot-server/config.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'spec/database_adapters/activerecord/activerecord.rb'
- 'tasks/db.rake'

# Offense count: 18
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
# SupportedShorthandSyntax: always, never, either, consistent
Style/HashSyntax:
Exclude:
- 'lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb'
- 'lib/slack-ruby-bot-server/models/team/methods.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/HashTransformKeys:
Exclude:
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/HashTransformValues:
Exclude:
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'

# Offense count: 1
# Cop supports --auto-correct.
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, Autocorrect.
# SupportedStyles: module_function, extend_self, forbidden
Style/ModuleFunction:
Exclude:
- 'lib/slack-ruby-bot-server/config.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/MultilineWhenThen:
Exclude:
- 'Gemfile'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/slack-ruby-bot-server/service.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantAssignment:
Exclude:
- 'lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb'

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantBegin:
Exclude:
- 'lib/slack-ruby-bot-server/models/team/activerecord.rb'
- 'lib/slack-ruby-bot-server/models/team/mongoid.rb'
- 'lib/slack-ruby-bot-server/service.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantFileExtensionInRequire:
Exclude:
- 'lib/slack-ruby-bot-server/config/database_adapters/activerecord.rb'
- 'lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb'

# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'Rakefile'
- 'lib/slack-ruby-bot-server/api/middleware.rb'
- 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Style/SafeNavigation:
Exclude:
- 'lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SlicingWithRange:
Exclude:
- 'lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
### 2.1.0 (Next)

* [#163](https://github.com/slack-ruby/slack-ruby-bot-server/pull/163): Updated releasing documentation - [@crazyoptimist](https://github.com/crazyoptimist).
* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Added support for Rails 6.1 and 7.0 - [@maths22](https://github.com/maths22).
* [#168](https://github.com/slack-ruby/slack-ruby-bot-server/pull/168): Added support for Ruby 3.2.1 - [@dblock](https://github.com/dblock).
* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Added support for ActiveRecord 6.1 and 7.0 - [@maths22](https://github.com/maths22).
* [#165](https://github.com/slack-ruby/slack-ruby-bot-server/pull/165): Upgraded Rubocop to v1.47 - [@crazyoptimist](https://github.com/crazyoptimist).
* [#167](https://github.com/slack-ruby/slack-ruby-bot-server/pull/167): Added `once_and_every` timer - [@dblock](https://github.com/dblock).
* [#168](https://github.com/slack-ruby/slack-ruby-bot-server/pull/168): Added support for Ruby 3.2.1 - [@dblock](https://github.com/dblock).
* Your contribution here.

#### 2.0.1 (2023/02/20)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ group :development, :test do
gem 'rack-test'
gem 'rake'
gem 'rspec'
gem 'rubocop', '0.81.0'
gem 'rubocop', '1.47'
gem 'selenium-webdriver', '~> 4.1.0'
gem 'vcr'
gem 'webmock'
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
require 'rack/test'
require 'slack-ruby-bot-server/rspec'

Dir[File.join(__dir__, 'support', '**/*.rb')].each do |file|
Dir[File.join(__dir__, 'support', '**/*.rb')].sort.each do |file|
require file
end

SlackRubyBotServer::Service.logger.level = Logger::WARN

Dir[File.join(__dir__, 'database_adapters', SlackRubyBotServer::Config.database_adapter.to_s, '**/*.rb')].each do |file|
Dir[File.join(__dir__, 'database_adapters', SlackRubyBotServer::Config.database_adapter.to_s, '**/*.rb')].sort.each do |file|
require file
end

0 comments on commit 5560369

Please sign in to comment.