Skip to content

Commit

Permalink
1213 rubocop gems (#1215)
Browse files Browse the repository at this point in the history
* [#1213] Remove bixby. Use rubocop
Install rubocop rails and performance gems

* bundle exec rubocop -a

* Generate new:
bundle exec  rubocop --auto-gen-config
  • Loading branch information
christinach authored Dec 24, 2024
1 parent c5b5491 commit 382a5aa
Show file tree
Hide file tree
Showing 193 changed files with 1,861 additions and 724 deletions.
10 changes: 6 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
inherit_gem:
bixby: bixby_default.yml

inherit_from: .rubocop_todo.yml

require:
- rubocop-rails
- rubocop-rspec
- rubocop-performance

AllCops:
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1
NewCops: enable

Exclude:
Expand Down
266 changes: 260 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,279 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2022-03-09 08:22:26 -0800 using RuboCop version 0.85.1.
# on 2024-12-24 15:33:39 UTC using RuboCop version 1.28.2.
# 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: 3
# Configuration parameters: CountComments.
# Offense count: 16
# Configuration parameters: IgnoredMethods.
Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/mailers/approve_request_mailer_spec.rb'
- 'spec/mailers/cancel_mailer_spec.rb'
- 'spec/mailers/change_request_mailer_spec.rb'
- 'spec/mailers/create_request_spec.rb'
- 'spec/mailers/deny_request_mailer_spec.rb'
- 'spec/models/delegate_spec.rb'
- 'spec/models/travel_request_spec.rb'
- 'spec/services/mail_for_action_spec.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'spec/services/staff_report_processor_spec.rb'

# Offense count: 1
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'spec/controllers/recurring_events_controller_spec.rb'

# Offense count: 2
# Configuration parameters: MaximumRangeSize.
Lint/MissingCopEnableDirective:
Exclude:
- 'app/controllers/common_request_controller.rb'
- 'spec/controllers/travel_requests_controller_spec.rb'

# Offense count: 17
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 27

# Offense count: 6
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 184
Max: 153

# Offense count: 20
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 15

# Offense count: 14
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
Naming/VariableNumber:
Exclude:
- 'spec/features/new_travel_request_spec.rb'
- 'spec/services/absent_staff_spec.rb'
- 'spec/services/event_attendees_spec.rb'

# Offense count: 1
# This cop supports unsafe auto-correction (--auto-correct-all).
Performance/InefficientHashSearch:
Exclude:
- 'app/models/staff_profile.rb'

# Offense count: 1
RSpec/AnyInstance:
Exclude:
- 'spec/requests/health_check_spec.rb'

# Offense count: 142
# Configuration parameters: Max.
# Offense count: 7
RSpec/Be:
Exclude:
- 'spec/models/travel_request_spec.rb'

# Offense count: 3
# This cop supports safe auto-correction (--auto-correct).
RSpec/ChangeByZero:
Exclude:
- 'spec/controllers/travel_requests_controller_spec.rb'
- 'spec/services/staff_report_processor_spec.rb'

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

# Offense count: 181
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 100

# Offense count: 2
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: method_call, block
RSpec/ExpectChange:
Exclude:
- 'spec/models/delegate_spec.rb'

# Offense count: 709
# This cop supports safe auto-correction (--auto-correct).
RSpec/FactoryBot/SyntaxMethods:
Enabled: false

# Offense count: 8
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/controllers/omniauth_callbacks_controller_spec.rb'
- 'spec/mailers/approve_request_mailer_spec.rb'
- 'spec/mailers/create_request_spec.rb'
- 'spec/mailers/deny_request_mailer_spec.rb'
- 'spec/requests/travel_requests_spec.rb'
- 'spec/services/approval_requests_list_spec.rb'
- 'spec/services/report_requests_list_spec.rb'
- 'spec/services/requests_list_spec.rb'

# Offense count: 2
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/controllers/travel_requests_controller_spec.rb'

# Offense count: 1
RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/services/staff_report_processor_spec.rb'

# Offense count: 237
RSpec/MultipleExpectations:
Max: 21

# Offense count: 152
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 19

# Offense count: 11
RSpec/NestedGroups:
Max: 5

# Offense count: 23
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
# SupportedStyles: inflected, explicit
RSpec/PredicateMatcher:
Exclude:
- 'spec/models/absence_request_spec.rb'
- 'spec/models/staff_profile_spec.rb'
- 'spec/models/travel_request_spec.rb'
- 'spec/services/balance_report_processor_spec.rb'

# Offense count: 4
# This cop supports unsafe auto-correction (--auto-correct-all).
# Configuration parameters: Whitelist, AllowedMethods, AllowedReceivers.
# Whitelist: find_by_sql
# AllowedMethods: find_by_sql
# AllowedReceivers: Gem::Specification
Rails/DynamicFindBy:
Exclude:
- 'app/decorators/report_list_decorator.rb'
- 'app/services/report_request_list.rb'
- 'app/services/staff_report_processor.rb'
- 'spec/services/ldap_spec.rb'

# Offense count: 7
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
Exclude:
- 'app/services/holidays.rb'
- 'app/services/location_loader.rb'
- 'app/services/recurring_event_loader.rb'
- 'config/environments/development.rb'
- 'spec/rails_helper.rb'
- 'spec/services/request_report_spec.rb'

# Offense count: 3
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/request.rb'
- 'app/models/user.rb'

# Offense count: 2
# Configuration parameters: Include.
# Include: app/controllers/**/*.rb, app/mailers/**/*.rb
Rails/LexicallyScopedActionFilter:
Exclude:
- 'app/controllers/absence_requests_controller.rb'
- 'app/controllers/travel_requests_controller.rb'

# Offense count: 2
# This cop supports unsafe auto-correction (--auto-correct-all).
Style/CaseLikeIf:
Exclude:
- 'app/decorators/report_list_decorator.rb'
- 'spec/factories/fire_event_safely.rb'

# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'app/controllers/users/omniauth_callbacks_controller.rb'

# Offense count: 50
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false

# Offense count: 2
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
EnforcedStyle: unannotated

# Offense count: 2
# This cop supports safe auto-correction (--auto-correct).
Style/GlobalStdStream:
Exclude:
- 'config/environments/production.rb'
- 'config/environments/staging.rb'

# Offense count: 1
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
Style/GuardClause:
Exclude:
- 'app/mailers/create_mailer.rb'

# Offense count: 4
# This cop supports safe auto-correction (--auto-correct).
Style/IfUnlessModifier:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/mailers/deny_mailer.rb'
- 'app/models/concerns/aasm_config.rb'
- 'config/deploy.rb'

# Offense count: 7
# This cop supports unsafe auto-correction (--auto-correct-all).
Style/MapToHash:
Exclude:
- 'app/decorators/report_list_decorator.rb'
- 'app/decorators/request_list_decorator.rb'

# Offense count: 3
# This cop supports unsafe auto-correction (--auto-correct-all).
# Configuration parameters: SafeForConstants.
Style/RedundantFetchBlock:
Exclude:
- 'config/puma.rb'

# Offense count: 2
# This cop supports unsafe auto-correction (--auto-correct-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'app/change_sets/absence_request_change_set.rb'
- 'app/decorators/request_decorator.rb'

# Offense count: 303
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 200
1 change: 1 addition & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Load DSL and set up stages
require "capistrano/setup"

Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ gem "health-monitor-rails", "~> 12.4"
gem "honeybadger"

group :development, :test do
gem "bixby"
gem "byebug", platforms: %i[mri mingw x64_mingw]
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rspec", require: false
end

group :development do
Expand Down
10 changes: 3 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ GEM
benchmark (0.4.0)
bigdecimal (3.1.8)
bindex (0.8.1)
bixby (5.0.2)
rubocop (= 1.28.2)
rubocop-ast
rubocop-performance
rubocop-rails
rubocop-rspec
bootsnap (1.18.4)
msgpack (~> 1.2)
builder (3.3.0)
Expand Down Expand Up @@ -412,7 +406,6 @@ PLATFORMS
DEPENDENCIES
aasm
bcrypt_pbkdf
bixby
bootsnap (>= 1.1.0)
byebug
capistrano-passenger
Expand Down Expand Up @@ -441,6 +434,9 @@ DEPENDENCIES
reform-rails
rspec-rails
rspec_junit_formatter
rubocop-performance
rubocop-rails
rubocop-rspec
selenium-webdriver
simplecov
timecop
Expand Down
5 changes: 3 additions & 2 deletions app/change_sets/absence_request_change_set.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

class AbsenceRequestChangeSet < RequestChangeSet
property :absence_type
property :hours_requested
property :start_date, populator: ->(options) { populate_date(field: "start_date", options: options) }
property :end_date, populator: ->(options) { populate_date(field: "end_date", options: options) }
property :start_date, populator: ->(options) { populate_date(field: "start_date", options:) }
property :end_date, populator: ->(options) { populate_date(field: "end_date", options:) }
property :start_time, default: Time.zone.parse("8:45 AM")
property :end_time, default: Time.zone.parse("5:00 PM")

Expand Down
1 change: 1 addition & 0 deletions app/change_sets/estimate_change_set.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class EstimateChangeSet < Reform::Form
property :id
property :cost_type
Expand Down
1 change: 1 addition & 0 deletions app/change_sets/event_request_change_set.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class EventRequestChangeSet < Reform::Form
property :start_date
property :end_date
Expand Down
1 change: 1 addition & 0 deletions app/change_sets/note_change_set.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class NoteChangeSet < Reform::Form
property :creator_id
property :content
Expand Down
4 changes: 3 additions & 1 deletion app/change_sets/travel_request_change_set.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class TravelRequestChangeSet < RequestChangeSet
property :travel_category
property :purpose
Expand All @@ -9,7 +10,8 @@ class TravelRequestChangeSet < RequestChangeSet
property :travel_dates
property :event_dates

collection :event_requests, form: EventRequestChangeSet, populator: EventRequestChangeSet::EventRequestPopulator, prepopulator: EventRequestChangeSet::EventRequestPrepopulator
collection :event_requests, form: EventRequestChangeSet, populator: EventRequestChangeSet::EventRequestPopulator,
prepopulator: EventRequestChangeSet::EventRequestPrepopulator
collection :estimates, form: EstimateChangeSet, populator: EstimateChangeSet::EstimatePopulator

validates :travel_category, inclusion: { in: TravelCategoryList.categories, allow_blank: true }
Expand Down
Loading

0 comments on commit 382a5aa

Please sign in to comment.