Skip to content

Commit

Permalink
Upgraded rubocop.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Jul 28, 2024
1 parent 52c9e8a commit 6a80b89
Show file tree
Hide file tree
Showing 55 changed files with 1,125 additions and 261 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ Lint/StructNewOverride:
Enabled: true

inherit_from: .rubocop_todo.yml

require:
- rubocop-capybara
- rubocop-rake
- rubocop-rspec
194 changes: 176 additions & 18 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-07-13 18:23:29 UTC using RuboCop version 1.31.2.
# on 2024-07-28 23:34:28 UTC using RuboCop version 1.65.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: 2
# Configuration parameters: EnforcedStyle.
# SupportedStyles: link_or_button, strict
Capybara/ClickLinkOrButtonStyle:
Exclude:
- 'spec/integration/update_cc_spec.rb'

# Offense count: 3
Capybara/SpecificActions:
Exclude:
- 'spec/integration/subscribe_spec.rb'
- 'spec/integration/update_cc_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleAlignWith, Severity.
Expand All @@ -32,11 +45,12 @@ Lint/EmptyBlock:
# 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:
- 'Rakefile.rb'
- 'slack-strava.rb'

# Offense count: 4
# 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:
- 'slack-strava/commands/help.rb'
Expand All @@ -45,7 +59,7 @@ Naming/HeredocDelimiterNaming:

# Offense count: 15
# 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:
- 'slack-strava/app.rb'
Expand All @@ -56,33 +70,177 @@ Naming/MethodParameterName:
- 'slack-strava/models/team.rb'
- 'slack-strava/models/user.rb'

# Offense count: 13
# Offense count: 14
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'spec/models/team_leaderboard_spec.rb'
- 'spec/models/user_spec.rb'

# Offense count: 1
# Offense count: 138
RSpec/AnyInstance:
Enabled: false

# Offense count: 185
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Enabled: false

# Offense count: 115
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CaseLikeIf:
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Exclude:
- 'slack-strava/models/user_activity.rb'
- 'spec/models/activity_fields_spec.rb'
- 'spec/models/activity_spec.rb'
- 'spec/models/club_activity_spec.rb'
- 'spec/models/map_types_spec.rb'
- 'spec/models/system_stats_spec.rb'
- 'spec/models/team_leaderboard_spec.rb'
- 'spec/models/team_spec.rb'
- 'spec/models/user_activity_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/slack-strava/app_spec.rb'
- 'spec/slack-strava/server_spec.rb'
- 'spec/slack-strava/service_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
# Configuration parameters: AutoCorrect.
RSpec/EmptyExampleGroup:
Exclude:
- 'slack-strava/api/middleware.rb'
- 'spec/models/athlete_spec.rb'

# Offense count: 160
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 32

# Offense count: 9
RSpec/ExpectInHook:
Exclude:
- 'spec/api/endpoints/credit_cards_endpoint_spec.rb'
- 'spec/models/team_spec.rb'
- 'spec/models/user_activity_spec.rb'
- 'spec/slack-strava/commands/resubscribe_spec.rb'
- 'spec/slack-strava/commands/unsubscribe_spec.rb'

# Offense count: 1
RSpec/IdenticalEqualityAssertion:
Exclude:
- 'spec/models/activity_spec.rb'

# Offense count: 30
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Exclude:
- 'spec/api/endpoints/status_endpoint_spec.rb'
- 'spec/api/endpoints/teams_endpoint_spec.rb'
- 'spec/models/system_stats_spec.rb'
- 'spec/models/team_leaderboard_spec.rb'
- 'spec/models/team_spec.rb'
- 'spec/models/team_stats_spec.rb'

# Offense count: 2
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
Style/GuardClause:
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'slack-strava/models/activity_fields.rb'
- 'slack-strava/models/user_activity.rb'
- 'spec/slack-strava/service_spec.rb'
- 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb'

# Offense count: 33
RSpec/LetSetup:
Enabled: false

# Offense count: 4
RSpec/MessageChain:
Exclude:
- 'spec/api/endpoints/slack_endpoint_spec.rb'
- 'spec/api/endpoints/status_endpoint_spec.rb'
- 'spec/models/activity_spec.rb'
- 'spec/models/user_activity_spec.rb'

# Offense count: 93
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 198
RSpec/MultipleExpectations:
Max: 11

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

# Offense count: 14
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/api/documentation_spec.rb'
- 'spec/api/endpoints/teams_endpoint_spec.rb'
- 'spec/slack-strava/app_spec.rb'

# Offense count: 97
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 7

# Offense count: 2
RSpec/RepeatedExample:
Exclude:
- 'spec/slack-strava/commands/set_spec.rb'

# Offense count: 18
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Enabled: false

# Offense count: 34
RSpec/StubbedMock:
Exclude:
- 'spec/api/endpoints/slack_endpoint_spec.rb'
- 'spec/api/endpoints/subscriptions_endpoint_spec.rb'
- 'spec/api/endpoints/teams_endpoint_spec.rb'
- 'spec/integration/subscribe_spec.rb'
- 'spec/integration/update_cc_spec.rb'
- 'spec/models/club_activity_spec.rb'
- 'spec/models/club_spec.rb'
- 'spec/models/user_activity_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/slack-strava/app_spec.rb'
- 'spec/slack-strava/commands/connect_spec.rb'
- 'spec/slack-strava/commands/disconnect_spec.rb'
- 'spec/slack-strava/commands/resubscribe_spec.rb'
- 'spec/slack-strava/commands/unsubscribe_spec.rb'
- 'spec/slack-strava/server_spec.rb'

# Offense count: 5
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
- 'spec/api/endpoints/subscriptions_endpoint_spec.rb'
- 'spec/api/endpoints/teams_endpoint_spec.rb'
- 'spec/models/user_spec.rb'

# Offense count: 1
RSpec/VoidExpect:
Exclude:
- 'spec/integration/homepage_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'slack-strava/api/middleware.rb'

# Offense count: 1
# Configuration parameters: MinBranchesCount.
Expand Down Expand Up @@ -139,7 +297,7 @@ Style/NestedTernaryOperator:

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, IgnoredMethods.
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
Expand All @@ -152,7 +310,7 @@ Style/OpenStructUse:
Exclude:
- 'slack-strava/api/endpoints/status_endpoint.rb'

# Offense count: 1
# Offense count: 2
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Expand Down Expand Up @@ -182,9 +340,9 @@ Style/StringConcatenation:
- 'slack-strava/api/helpers/error_helpers.rb'
- 'slack-strava/models/team.rb'

# Offense count: 165
# Offense count: 185
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 507
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ group :development, :test do
gem 'foreman'
gem 'rake', '~> 12.3'
gem 'rubocop'
gem 'rubocop-capybara'
gem 'rubocop-rake'
gem 'rubocop-rspec'
end
Expand Down
38 changes: 22 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ GEM
io-console (0.5.6)
irb (1.2.4)
reline (>= 0.0.1)
json (2.6.2)
json (2.7.2)
kaminari-core (1.2.1)
kaminari-grape (1.0.1)
grape
kaminari-core (~> 1.0)
language_server-protocol (3.17.0.3)
mailchimp_api_v3 (0.2.18)
rest-client (~> 2)
matrix (0.4.2)
Expand Down Expand Up @@ -158,9 +159,10 @@ GEM
faraday (>= 1.0.0)
faraday_middleware
hashie
parallel (1.22.1)
parser (3.1.2.0)
parallel (1.25.1)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
polylines (0.3.0)
public_suffix (5.1.1)
puma (6.4.2)
Expand Down Expand Up @@ -195,8 +197,8 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.2)
strscan
roar (1.1.0)
representable (~> 3.0.0)
rspec (3.9.0)
Expand All @@ -212,25 +214,28 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rubocop (1.31.2)
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.12.1)
rubocop (~> 1.31)
rubocop-rspec (3.0.3)
rubocop (~> 1.61)
ruby-enum (0.8.0)
i18n
ruby-progressbar (1.11.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
safe_yaml (1.0.5)
Expand Down Expand Up @@ -283,7 +288,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (2.2.0)
unicode-display_width (2.5.0)
vcr (6.0.0)
wannabe_bool (0.7.1)
webmock (3.8.3)
Expand Down Expand Up @@ -331,6 +336,7 @@ DEPENDENCIES
rake (~> 12.3)
rspec
rubocop
rubocop-capybara
rubocop-rake
rubocop-rspec
ruby-enum
Expand Down
2 changes: 1 addition & 1 deletion slack-strava/api/endpoints/requests/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Command < Request
attr_reader :action, :arg, :type, :channel_id, :channel_name, :user_id, :team_id, :text, :image_url, :response_url, :trigger_id, :submission, :message_ts

def initialize(params)
super(params)
super
if params.key?(:payload)
payload = params[:payload]
@action = payload[:callback_id]
Expand Down
2 changes: 1 addition & 1 deletion slack-strava/api/endpoints/requests/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Event < Request
attr_reader :challenge, :type, :team_id, :api_app_id, :event

def initialize(params)
super(params)
super
@challenge = params[:challenge]
if params.key?(:event)
@event = Hashie::Mash.new(params[:event])
Expand Down
Loading

0 comments on commit 6a80b89

Please sign in to comment.