From 337e83e3ad4c12d9ef8ab7c5ac6a0a4d8012055f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 04:07:17 +0000 Subject: [PATCH 1/2] Bump rubocop from 1.76.1 to 1.76.2 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.76.1 to 1.76.2. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.76.1...v1.76.2) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.76.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 35681c9b7..f62e1064a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -472,7 +472,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.4) - rubocop (1.76.1) + rubocop (1.76.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -480,7 +480,7 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.45.0, < 2.0) + rubocop-ast (>= 1.45.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.45.1) @@ -942,7 +942,7 @@ CHECKSUMS rspec-mocks (3.13.5) sha256=e4338a6f285ada9fe56f5893f5457783af8194f5d08884d17a87321d5195ea81 rspec-rails (8.0.1) sha256=0c3700b10ab6d7c648c4cd554023d8c2b5b07e7f01205f7608f0c511cf686505 rspec-support (3.13.4) sha256=184b1814f6a968102b57df631892c7f1990a91c9a3b9e80ef892a0fc2a71a3f7 - rubocop (1.76.1) sha256=e15a2d750794cf2157d2de8b1b403dfa71b8dc3957a22ae6043b1bdf21e7e0e7 + rubocop (1.76.2) sha256=ae44f172ba0bbe3d623c927111798f85a7879bcc88e544d08f51f62c19f45633 rubocop-ast (1.45.1) sha256=94042e49adc17f187ba037b33f941ba7398fede77cdf4bffafba95190a473a3e rubocop-capybara (2.22.1) sha256=ced88caef23efea53f46e098ff352f8fc1068c649606ca75cb74650970f51c0c rubocop-factory_bot (2.27.1) sha256=9d744b5916778c1848e5fe6777cc69855bd96548853554ec239ba9961b8573fe From e2f0ded472d66ce8341edf8b5bcd9485369fdf4c Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sun, 22 Jun 2025 14:57:31 +0200 Subject: [PATCH 2/2] Fix Rubocop offenses --- app/helpers/statistics_helper.rb | 10 +++++----- app/models/event/synchronized_editor.rb | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/statistics_helper.rb b/app/helpers/statistics_helper.rb index 1a7e6e8d9..60b68e46e 100644 --- a/app/helpers/statistics_helper.rb +++ b/app/helpers/statistics_helper.rb @@ -71,21 +71,21 @@ def exercise_statistics { key: 'submissions_per_minute', name: t('statistics.entries.exercises.submissions_per_minute'), - data: (Submission.where(created_at: DateTime.now - 1.hour..).count.to_f / 60).round(2), + data: (Submission.where(created_at: (DateTime.now - 1.hour)..).count.to_f / 60).round(2), unit: '/min', url: statistics_graphs_path, }, { key: 'autosaves_per_minute', name: t('statistics.entries.exercises.autosaves_per_minute'), - data: (Submission.where(created_at: DateTime.now - 1.hour..).where(cause: 'autosave').count.to_f / 60).round(2), + data: (Submission.where(created_at: (DateTime.now - 1.hour)..).where(cause: 'autosave').count.to_f / 60).round(2), unit: '/min', }, { key: 'container_requests_per_minute', name: t('statistics.entries.exercises.container_requests_per_minute'), # This query is actually quite expensive since we do not have an index on the created_at column. - data: (Testrun.where(created_at: DateTime.now - 1.hour..).count.to_f / 60).round(2), + data: (Testrun.where(created_at: (DateTime.now - 1.hour)..).count.to_f / 60).round(2), unit: '/min', }, { @@ -118,12 +118,12 @@ def user_activity_live_data { key: 'active_in_last_hour', name: t('statistics.entries.contributors.currently_active'), - data: Submission.where(created_at: DateTime.now - 5.minutes..).distinct.select(:contributor_id, :contributor_type).count, + data: Submission.where(created_at: (DateTime.now - 5.minutes)..).distinct.select(:contributor_id, :contributor_type).count, }, { key: 'submissions_per_minute', name: t('statistics.entries.exercises.submissions_per_minute'), - data: (Submission.where(created_at: DateTime.now - 1.hour..).count.to_f / 60).round(2), + data: (Submission.where(created_at: (DateTime.now - 1.hour)..).count.to_f / 60).round(2), unit: '/min', axis: 'right', }, diff --git a/app/models/event/synchronized_editor.rb b/app/models/event/synchronized_editor.rb index b0d82b61d..71026f7e5 100644 --- a/app/models/event/synchronized_editor.rb +++ b/app/models/event/synchronized_editor.rb @@ -91,12 +91,12 @@ def self.data_attribute(event, delta) event.presence if event.present? # TODO: As of now, we are storing the `session_id` most of the times. Intended? end private_class_method :data_attribute -end -private + private -def lines_not_nil - if lines.nil? - errors.add(:lines, 'cannot be nil') + def lines_not_nil + if lines.nil? + errors.add(:lines, 'cannot be nil') + end end end