From 5682f6cc5c63bab3872ce144ba4ff631a5d88180 Mon Sep 17 00:00:00 2001 From: Justin Marsh Date: Tue, 6 Feb 2024 15:58:50 +0100 Subject: [PATCH] make rubocop happy --- .rubocop.yml | 4 - Gemfile.lock | 291 ++++++++++-------- app/controllers/sprints_controller.rb | 2 +- app/jobs/slack_set_status_job.rb | 4 +- app/models/leave.rb | 2 +- app/models/time_entry.rb | 2 +- bin/rails | 6 +- bin/rake | 4 +- bin/rspec | 14 +- bin/setup | 18 +- config/initializers/assets.rb | 2 +- config/initializers/scheduler.rb | 2 + ...0_create_solid_queue_tables.solid_queue.rb | 32 +- db/seeds.rb | 2 +- spec/models/leave_spec.rb | 2 + spec/models/slack_spec.rb | 2 +- spec/models/sprint_feedback_spec.rb | 1 + spec/models/task_spec.rb | 4 +- spec/models/user_spec.rb | 1 + spec/presenters/leave_presenter_spec.rb | 4 + 20 files changed, 222 insertions(+), 177 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 017ea2ae..09de17d3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,10 +14,6 @@ RSpec: Naming/MemoizedInstanceVariableName: Enabled: true -# TODO: Move this to Shimmer -Performance/RedundantMerge: - MaxKeyValuePairs: 1 - RSpec/ExpectChange: Enabled: true EnforcedStyle: block diff --git a/Gemfile.lock b/Gemfile.lock index 72d067dd..9932d021 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,29 +75,29 @@ GEM minitest (>= 5.1) mutex_m tzinfo (~> 2.0) - addressable (2.8.1) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) annotate (3.2.0) activerecord (>= 3.2, < 8.0) rake (>= 10.4, < 14.0) ast (2.4.2) - autoprefixer-rails (10.4.7.0) + autoprefixer-rails (10.4.16.0) execjs (~> 2) - aws-eventstream (1.2.0) - aws-partitions (1.782.0) - aws-sdk-core (3.176.1) - aws-eventstream (~> 1, >= 1.0.2) + aws-eventstream (1.3.0) + aws-partitions (1.887.0) + aws-sdk-core (3.191.0) + aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.5) + aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.64.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (1.77.0) + aws-sdk-core (~> 3, >= 3.191.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.122.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-s3 (1.143.0) + aws-sdk-core (~> 3, >= 3.191.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.4) - aws-sigv4 (1.6.0) + aws-sigv4 (~> 1.8) + aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -107,8 +107,8 @@ GEM multi_json (~> 1) statsd-ruby (~> 1.1) base64 (0.2.0) - bcrypt (3.1.18) - better_html (2.0.1) + bcrypt (3.1.20) + better_html (2.0.2) actionview (>= 6.0) activesupport (>= 6.0) ast (~> 2.0) @@ -117,50 +117,51 @@ GEM smart_properties bigdecimal (3.1.6) bindex (0.8.1) - bootsnap (1.16.0) + bootsnap (1.18.3) msgpack (~> 1.2) builder (3.2.4) - capybara (3.38.0) + capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) - nokogiri (~> 1.8) + nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - capybara-screenshot-diff (1.7.1) - actionpack (>= 6.0, < 8) + capybara-screenshot-diff (1.8.3) + actionpack (>= 6.1, < 8) capybara (>= 2, < 4) chunky_png (~> 1.3) - chartkick (5.0.1) + chartkick (5.0.5) chunky_png (1.4.0) coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.2.0) + concurrent-ruby (1.2.3) connection_pool (2.4.1) - countries (5.3.1) + countries (5.7.1) unaccent (~> 0.3) - crack (0.4.5) + crack (0.4.6) + bigdecimal rexml crass (1.0.6) - cuprite (0.14.3) + cuprite (0.15) capybara (~> 3.0) - ferrum (~> 0.13.0) + ferrum (~> 0.14.0) date (3.3.4) - debug (1.7.1) - irb (>= 1.5.0) - reline (>= 0.3.1) + debug (1.9.1) + irb (~> 1.10) + reline (>= 0.3.8) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.9.0) + devise (4.9.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.5.0) + diff-lcs (1.5.1) document_serializable (0.1.0) activesupport virtus @@ -173,26 +174,32 @@ GEM erubi (1.12.0) et-orbi (1.2.7) tzinfo - execjs (2.8.1) - faker (3.2.0) + execjs (2.9.1) + faker (3.2.3) i18n (>= 1.8.11, < 2) - ferrum (0.13) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (3.1.0) + net-http + ferrum (0.14) addressable (~> 2.5) concurrent-ruby (~> 1.1) webrick (~> 1.7) websocket-driver (>= 0.6, < 0.8) - ffi (1.15.5) + ffi (1.16.3) formatador (1.1.0) - friendly_id (5.5.0) + friendly_id (5.5.1) activerecord (>= 4.0.0) fugit (1.9.0) et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) - globalid (1.1.0) - activesupport (>= 5.0) - groupdate (6.2.0) - activesupport (>= 5.2) - guard (2.18.0) + globalid (1.2.1) + activesupport (>= 6.1) + groupdate (6.4.0) + activesupport (>= 6.1) + guard (2.18.1) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) lumberjack (>= 1.0.12, < 2.0) @@ -206,25 +213,25 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - hashdiff (1.0.1) - highline (2.1.0) + hashdiff (1.1.0) + highline (3.0.1) httparty (0.21.0) mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) - i18n-tasks (1.0.12) + i18n-tasks (1.0.13) activesupport (>= 4.0.2) ast (>= 2.1.0) better_html (>= 1.0, < 3.0) erubi highline (>= 2.0.0) i18n - parser (>= 2.2.3.0) + parser (>= 3.2.2.1) rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - icalendar (2.8.0) + icalendar (2.10.1) ice_cube (~> 0.16) ice_cube (0.16.4) ice_nine (0.11.2) @@ -235,11 +242,12 @@ GEM actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) - io-console (0.6.0) - irb (1.6.2) - reline (>= 0.3.0) + io-console (0.7.2) + irb (1.11.1) + rdoc + reline (>= 0.4.2) jmespath (1.6.2) - jsbundling-rails (1.1.1) + jsbundling-rails (1.3.0) railties (>= 6.0.0) json (2.7.1) kaminari (1.2.2) @@ -259,13 +267,14 @@ GEM addressable (~> 2.8) letter_opener (1.8.1) launchy (>= 2.2, < 3) + lint_roller (1.1.0) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lumberjack (1.2.8) + lumberjack (1.2.10) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -275,18 +284,21 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_magick (4.12.0) - mini_mime (1.1.2) - minitest (5.17.0) + mini_mime (1.1.5) + minitest (5.22.0) mission_control-jobs (0.1.1) importmap-rails rails (~> 7.1) stimulus-rails turbo-rails - msgpack (1.6.0) + msgpack (1.7.2) multi_json (1.15.0) multi_xml (0.6.0) + multipart-post (2.3.0) mutex_m (0.2.0) nenv (0.3.0) + net-http (0.4.1) + uri net-imap (0.4.10) date net-protocol @@ -296,31 +308,35 @@ GEM timeout net-smtp (0.4.0.1) net-protocol - newrelic_rpm (8.16.0) - nio4r (2.5.9) - nokogiri (1.14.2-arm64-darwin) + netrc (0.11.0) + newrelic_rpm (9.7.1) + nio4r (2.7.0) + nokogiri (1.16.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.14.2-x86_64-darwin) + nokogiri (1.16.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.14.2-x86_64-linux) + nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - oj (3.14.1) + oj (3.16.3) + bigdecimal (>= 3.0) orm_adapter (0.5.0) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) racc - pg (1.4.5) + pg (1.5.4) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (5.0.1) - puma (6.3.0) + psych (5.1.2) + stringio + public_suffix (5.0.4) + puma (6.4.2) nio4r (~> 2.0) - pundit (2.3.0) + pundit (2.3.1) activesupport (>= 3.0.0) pundit-matchers (3.1.2) rspec-core (~> 3.12) @@ -329,17 +345,17 @@ GEM rspec-support (~> 3.12) raabro (1.4.0) racc (1.7.3) - rack (2.2.6.2) - rack-session (1.0.2) - rack (< 3) - rack-test (2.0.2) + rack (3.0.9) + rack-session (2.0.0) + rack (>= 3.0.0) + rack-test (2.1.0) rack (>= 1.3) rack_session_access (0.2.0) builder (>= 2.0.0) rack (>= 1.0.0) - rackup (1.0.0) - rack (< 3) - webrick + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) rails (7.1.3) actioncable (= 7.1.3) actionmailbox (= 7.1.3) @@ -361,7 +377,7 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - rails-i18n (7.0.6) + rails-i18n (7.0.8) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) railties (7.1.3) @@ -373,68 +389,75 @@ GEM thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) + rdoc (6.6.2) + psych (>= 4.0.0) regexp_parser (2.9.0) - reline (0.3.2) + reline (0.4.2) io-console (~> 0.5) - responders (3.1.0) + responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rexml (3.2.6) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.1) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.3) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (6.0.1) + rspec-support (~> 3.13.0) + rspec-rails (6.1.1) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.11) - rspec-expectations (~> 3.11) - rspec-mocks (~> 3.11) - rspec-support (~> 3.11) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.12.0) - rubocop (1.44.1) + rspec-support (3.13.0) + rubocop (1.59.0) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.0.0) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.24.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.17.0) + rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-performance (1.15.2) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.17.4) + rubocop-factory_bot (2.25.1) + rubocop (~> 1.41) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.18.1) - rubocop (~> 1.33) + rubocop-rspec (2.26.1) + rubocop (~> 1.40) rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) ruby-progressbar (1.13.0) - ruby-vips (2.1.4) + ruby-vips (2.2.0) ffi (~> 1.12) ruby2_keywords (0.0.5) rufus-scheduler (3.9.1) @@ -447,10 +470,10 @@ GEM sprockets (> 3.0) sprockets-rails tilt - sentry-rails (5.8.0) + sentry-rails (5.16.1) railties (>= 5.0) - sentry-ruby (~> 5.8.0) - sentry-ruby (5.8.0) + sentry-ruby (~> 5.16.1) + sentry-ruby (5.16.1) concurrent-ruby (~> 1.0, >= 1.0.2) serviceworker-rails (0.6.0) railties (>= 3.1) @@ -458,41 +481,56 @@ GEM shimmer (0.0.34) sitemap_generator (6.3.0) builder (~> 3.0) - slim (4.1.0) - temple (>= 0.7.6, < 0.9) - tilt (>= 2.0.6, < 2.1) - slim-rails (3.6.2) + slim (5.2.1) + temple (~> 0.10.0) + tilt (>= 2.1.0) + slim-rails (3.6.3) actionpack (>= 3.1) railties (>= 3.1) slim (>= 3.0, < 6.0, != 5.0.0) smart_properties (1.17.0) - solid_queue (0.1.2) - rails (>= 7.0.3.1) - sprockets (4.2.0) + solid_queue (0.2.1) + rails (~> 7.1) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - standard (1.24.3) + standard (1.33.0) language_server-protocol (~> 3.17.0.2) - rubocop (= 1.44.1) - rubocop-performance (= 1.15.2) + lint_roller (~> 1.0) + rubocop (~> 1.59.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.3) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.3.1) + lint_roller (~> 1.1) + rubocop-performance (~> 1.20.2) statsd-ruby (1.5.0) - stimulus-rails (1.2.1) + stimulus-rails (1.3.3) railties (>= 6.0.0) - temple (0.8.2) + stringio (3.1.0) + temple (0.10.3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (1.3.0) thread_safe (0.3.6) - tilt (2.0.11) + tilt (2.3.0) time_will_tell (0.1.0) railties (>= 3.2) timeout (0.4.1) - translate_client (0.0.1) - turbo-rails (1.3.3) + translate_client (0.0.2) + activesupport + faraday + faraday-multipart + launchy + netrc + thor + turbo-rails (1.5.0) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) @@ -500,29 +538,30 @@ GEM concurrent-ruby (~> 1.0) unaccent (0.4.0) unicode-display_width (2.5.0) + uri (0.13.0) virtus (2.0.0) axiom-types (~> 0.1) coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) warden (1.2.9) rack (>= 2.0.9) - web-console (4.2.0) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.18.1) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.7.0) - websocket-driver (0.7.5) + webrick (1.8.1) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) yael (0.0.3) - zeitwerk (2.6.7) + zeitwerk (2.6.13) PLATFORMS arm64-darwin-22 diff --git a/app/controllers/sprints_controller.rb b/app/controllers/sprints_controller.rb index 35055765..688be50e 100644 --- a/app/controllers/sprints_controller.rb +++ b/app/controllers/sprints_controller.rb @@ -25,7 +25,7 @@ def new def create @sprint = authorize Sprint.new(sprint_attributes) User.sprinter.each do |user| - @sprint.sprint_feedbacks.build user: user + @sprint.sprint_feedbacks.build user: end if @sprint.save ui.navigate_to sprints_path diff --git a/app/jobs/slack_set_status_job.rb b/app/jobs/slack_set_status_job.rb index cf80272d..07df39e3 100644 --- a/app/jobs/slack_set_status_job.rb +++ b/app/jobs/slack_set_status_job.rb @@ -4,8 +4,6 @@ class SlackSetStatusJob < ApplicationJob queue_as :notification def perform - Leave.approved.starts_today.each do |leave| - leave.set_slack_status! - end + Leave.approved.starts_today.each(&:set_slack_status!) end end diff --git a/app/models/leave.rb b/app/models/leave.rb index 6c66ff22..5b2dd4a1 100644 --- a/app/models/leave.rb +++ b/app/models/leave.rb @@ -78,7 +78,7 @@ def notify_user_on_slack_about_status_change def set_slack_status! emoji = Leave::Presenter.new(self).slack_emoji - user.slack_profile.set_status(type: type, emoji:, until_date: leave_during.max) + user.slack_profile.set_status(type:, emoji:, until_date: leave_during.max) end delegate :to_ics, to: :presenter diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index aeeabfbb..d179fcc9 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -35,7 +35,7 @@ def assign_task number = notes.scan(/#(\d+)/).flatten.first return if number.nil? - task = Task.find_by(project_id: project_id, issue_number: number) + task = Task.find_by(project_id:, issue_number: number) return if task.nil? update! task_id: task.id diff --git a/bin/rails b/bin/rails index a31728ab..228ae2c7 100755 --- a/bin/rails +++ b/bin/rails @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # frozen_string_literal: true -APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' -require 'rails/commands' +APP_PATH = File.expand_path("../config/application", __dir__).freeze +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake index c1999550..e436ea54 100755 --- a/bin/rake +++ b/bin/rake @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require_relative '../config/boot' -require 'rake' +require_relative "../config/boot" +require "rake" Rake.application.run diff --git a/bin/rspec b/bin/rspec index 58d85dd9..74127061 100755 --- a/bin/rspec +++ b/bin/rspec @@ -8,11 +8,11 @@ # this file is here to facilitate running it. # -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', - Pathname.new(__FILE__).realpath) +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) -bundle_binstub = File.expand_path('bundle', __dir__) +bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ @@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this end end -require 'rubygems' -require 'bundler/setup' +require "rubygems" +require "bundler/setup" -load Gem.bin_path('rspec-core', 'rspec') +load Gem.bin_path("rspec-core", "rspec") diff --git a/bin/setup b/bin/setup index d7475dcb..aaf9aa02 100755 --- a/bin/setup +++ b/bin/setup @@ -1,10 +1,10 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require 'fileutils' +require "fileutils" # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__).freeze def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -15,9 +15,9 @@ FileUtils.chdir APP_ROOT do # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") puts "\n== Installing node modules ==" system! "yarn install" @@ -28,13 +28,13 @@ FileUtils.chdir APP_ROOT do # end puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" - if system('overmind status') + if system("overmind status") puts "\n== Restarting running processes ==" - system! 'overmind restart' + system! "overmind restart" end end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 3e350c0c..93ba9690 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -11,4 +11,4 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. -Rails.application.config.assets.precompile += %w[application.js] +Rails.application.config.assets.precompile += ["application.js"] diff --git a/config/initializers/scheduler.rb b/config/initializers/scheduler.rb index a0d9f952..55b73aeb 100644 --- a/config/initializers/scheduler.rb +++ b/config/initializers/scheduler.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rufus-scheduler" scheduler = Rufus::Scheduler.new diff --git a/db/migrate/20240206101250_create_solid_queue_tables.solid_queue.rb b/db/migrate/20240206101250_create_solid_queue_tables.solid_queue.rb index 6d8c4f61..763d63ac 100644 --- a/db/migrate/20240206101250_create_solid_queue_tables.solid_queue.rb +++ b/db/migrate/20240206101250_create_solid_queue_tables.solid_queue.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This migration comes from solid_queue (originally 20231211200639) class CreateSolidQueueTables < ActiveRecord::Migration[7.0] def change @@ -13,42 +15,42 @@ def change t.timestamps - t.index [ :queue_name, :finished_at ], name: "index_solid_queue_jobs_for_filtering" - t.index [ :scheduled_at, :finished_at ], name: "index_solid_queue_jobs_for_alerting" + t.index [:queue_name, :finished_at], name: "index_solid_queue_jobs_for_filtering" + t.index [:scheduled_at, :finished_at], name: "index_solid_queue_jobs_for_alerting" end create_table :solid_queue_scheduled_executions do |t| - t.references :job, index: { unique: true }, null: false + t.references :job, index: {unique: true}, null: false t.string :queue_name, null: false t.integer :priority, default: 0, null: false t.datetime :scheduled_at, null: false t.datetime :created_at, null: false - t.index [ :scheduled_at, :priority, :job_id ], name: "index_solid_queue_dispatch_all" + t.index [:scheduled_at, :priority, :job_id], name: "index_solid_queue_dispatch_all" end create_table :solid_queue_ready_executions do |t| - t.references :job, index: { unique: true }, null: false + t.references :job, index: {unique: true}, null: false t.string :queue_name, null: false t.integer :priority, default: 0, null: false t.datetime :created_at, null: false - t.index [ :priority, :job_id ], name: "index_solid_queue_poll_all" - t.index [ :queue_name, :priority, :job_id ], name: "index_solid_queue_poll_by_queue" + t.index [:priority, :job_id], name: "index_solid_queue_poll_all" + t.index [:queue_name, :priority, :job_id], name: "index_solid_queue_poll_by_queue" end create_table :solid_queue_claimed_executions do |t| - t.references :job, index: { unique: true }, null: false + t.references :job, index: {unique: true}, null: false t.bigint :process_id t.datetime :created_at, null: false - t.index [ :process_id, :job_id ] + t.index [:process_id, :job_id] end create_table :solid_queue_blocked_executions do |t| - t.references :job, index: { unique: true }, null: false + t.references :job, index: {unique: true}, null: false t.string :queue_name, null: false t.integer :priority, default: 0, null: false t.string :concurrency_key, null: false @@ -56,17 +58,17 @@ def change t.datetime :created_at, null: false - t.index [ :expires_at, :concurrency_key ], name: "index_solid_queue_blocked_executions_for_maintenance" + t.index [:expires_at, :concurrency_key], name: "index_solid_queue_blocked_executions_for_maintenance" end create_table :solid_queue_failed_executions do |t| - t.references :job, index: { unique: true }, null: false + t.references :job, index: {unique: true}, null: false t.text :error t.datetime :created_at, null: false end create_table :solid_queue_pauses do |t| - t.string :queue_name, null: false, index: { unique: true } + t.string :queue_name, null: false, index: {unique: true} t.datetime :created_at, null: false end @@ -83,13 +85,13 @@ def change end create_table :solid_queue_semaphores do |t| - t.string :key, null: false, index: { unique: true } + t.string :key, null: false, index: {unique: true} t.integer :value, default: 1, null: false t.datetime :expires_at, null: false, index: true t.timestamps - t.index [ :key, :value ], name: "index_solid_queue_semaphores_on_key_and_value" + t.index [:key, :value], name: "index_solid_queue_semaphores_on_key_and_value" end add_foreign_key :solid_queue_blocked_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade diff --git a/db/seeds.rb b/db/seeds.rb index a2a1fdf8..baf28a88 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -55,7 +55,7 @@ sprints.each do |sprint| user.sprint_feedbacks.create!( - sprint: sprint, + sprint:, daily_nerd_count: Faker::Number.between(from: 0, to: sprint.working_days), tracked_hours: Faker::Number.between(from: 20, to: sprint.working_days * 8.0), billable_hours: Faker::Number.between(from: 10, to: sprint.working_days * 6.0), diff --git a/spec/models/leave_spec.rb b/spec/models/leave_spec.rb index 8e1eeb8b..b68a4025 100644 --- a/spec/models/leave_spec.rb +++ b/spec/models/leave_spec.rb @@ -119,6 +119,7 @@ allow(leave).to receive(:notify_hr_on_slack_about_new_request) end end + it "notifies slack about sick leave for sick type" do single_day_sick_leave.handle_incoming_request @@ -149,6 +150,7 @@ allow(leave).to receive(:set_slack_status!) end end + it "sets slack status if leave is during today and approved" do holiday.approved! travel_to holiday.leave_during.min diff --git a/spec/models/slack_spec.rb b/spec/models/slack_spec.rb index 6cf8d68a..dc269aba 100644 --- a/spec/models/slack_spec.rb +++ b/spec/models/slack_spec.rb @@ -15,7 +15,7 @@ stub_request(:get, "https://slack.com/api/users.lookupByEmail?email=someone@nerdgeschoss.de") .to_return(status: 200, body: {error: "not_found"}.to_json, headers: {"Content-Type": "application/json"}) expect(slack.retrieve_users_slack_id_by_email("jon@nerdgeschoss.de")).to eq "15" - expect(slack.retrieve_users_slack_id_by_email("someone@nerdgeschoss.de")).to eq nil + expect(slack.retrieve_users_slack_id_by_email("someone@nerdgeschoss.de")).to be_nil end it "sends a message to a channel" do diff --git a/spec/models/sprint_feedback_spec.rb b/spec/models/sprint_feedback_spec.rb index 63a37023..16b25d04 100644 --- a/spec/models/sprint_feedback_spec.rb +++ b/spec/models/sprint_feedback_spec.rb @@ -48,6 +48,7 @@ feedback.user.leaves.create! type: :paid, title: "Holidays", days: ["2023-01-25"] feedback.user.leaves.create! type: :sick, title: "Sick", days: ["2023-01-27"] end + it "takes all leave types into account" do expect(feedback.working_day_count).to eq feedback.sprint.working_days - 3 end diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb index c74c9965..5919d3bc 100644 --- a/spec/models/task_spec.rb +++ b/spec/models/task_spec.rb @@ -82,7 +82,7 @@ Task.sync_with_github - expect(Task.exists?(task.id)).to eq false + expect(Task.exists?(task.id)).to be false end it "does not delete tasks that are not in the list if they are done" do @@ -90,7 +90,7 @@ Task.sync_with_github - expect(Task.exists?(task.id)).to eq true + expect(Task.exists?(task.id)).to be true end it "only updates finished_storypoints" do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 5e7a766f..12d11657 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -55,6 +55,7 @@ context "notified about a message" do let(:john) { users(:john_no_slack) } + it "updates the slack id on first use" do expect(john).to have_attributes email: "john-no-slack@example.com", slack_id: nil allow(Slack.instance).to receive(:retrieve_users_slack_id_by_email).with("john-no-slack@example.com").and_return("slack-15") diff --git a/spec/presenters/leave_presenter_spec.rb b/spec/presenters/leave_presenter_spec.rb index cfed8385..9567d460 100644 --- a/spec/presenters/leave_presenter_spec.rb +++ b/spec/presenters/leave_presenter_spec.rb @@ -12,6 +12,7 @@ context "slack emoji" do describe "for paid leave" do let(:leave) { holiday } + it "returns the palm tree emoji" do expect(presenter.slack_emoji).to eq ":beach_with_umbrella:" end @@ -31,6 +32,7 @@ describe "for sick leave" do let(:leave) { single_day_sick_leave } + it "returns the sick emoji" do expect(presenter.slack_emoji).to eq ":face_with_thermometer:" end @@ -52,6 +54,7 @@ context "unicode emoji" do describe "for paid leave" do let(:leave) { holiday } + it "returns the beach with umbrella emoji" do expect(presenter.unicode_emoji).to eq "\u{1F3D6}" end @@ -83,6 +86,7 @@ describe "for sick leave" do let(:leave) { single_day_sick_leave } + it "returns the face with thermometer emoji" do expect(presenter.unicode_emoji).to eq "\u{1F912}" end