Skip to content

Commit ce919ec

Browse files
committed
Rubocop fixes
1 parent e01bed8 commit ce919ec

File tree

9 files changed

+22
-3
lines changed

9 files changed

+22
-3
lines changed

app/jobs/better_together/metrics/rich_text_external_link_checker_queue_job.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
module BetterTogether
44
module Metrics
5+
# Queues jobs that check external links found inside ActionText rich content.
6+
# Subclasses of RichTextLinkCheckerQueueJob should implement the specifics
7+
# for how individual link check jobs are performed.
58
class RichTextExternalLinkCheckerQueueJob < RichTextLinkCheckerQueueJob
69
protected
710

app/jobs/better_together/metrics/rich_text_internal_link_checker_queue_job.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
module BetterTogether
44
module Metrics
5+
# Queues jobs that check internal links found inside ActionText rich content.
6+
# This job narrows the collection to internal links and may delay processing
7+
# to reduce immediate load on the application.
58
class RichTextInternalLinkCheckerQueueJob < RichTextLinkCheckerQueueJob
69
protected
710

app/jobs/better_together/metrics/rich_text_link_checker_queue_job.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
module BetterTogether
44
module Metrics
5+
# Base queueing job that distributes RichText link check work across hosts.
6+
# It groups RichText links by host and schedules child jobs with delays to
7+
# avoid overloading external hosts or the application.
58
class RichTextLinkCheckerQueueJob < MetricsJob
69
def perform
710
records_size = model_collection.size

app/models/better_together/content/link.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
module BetterTogether
44
module Content
5+
# Represents a persisted link discovered in rich content. Stores metadata
6+
# about the link (host, scheme, validity) and associates to RichText
7+
# metrics records.
58
class Link < ApplicationRecord
69
has_many :rich_text_links, class_name: 'BetterTogether::Metrics::RichTextLink', inverse_of: :link
710
has_many :rich_texts, through: :rich_text_links

app/models/better_together/links.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# frozen_string_literal: true
22

33
module BetterTogether
4+
# Namespace helper for links-related tables. Ensures a consistent
5+
# table name prefix for models placed under BetterTogether::Links.
46
module Links
57
def self.table_name_prefix
68
'better_together_links_'

app/models/better_together/metrics/rich_text_link.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
module BetterTogether
44
module Metrics
5+
# Tracks occurrences of links found inside ActionText rich content and
6+
# associates them with the original Link record and owning rich text.
57
class RichTextLink < ApplicationRecord
68
belongs_to :link, class_name: 'BetterTogether::Content::Link'
79
belongs_to :rich_text, class_name: 'ActionText::RichText'
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# frozen_string_literal: true
22

3+
# Migration to create the persistent links table used by the
4+
# BetterTogether rich text link metrics system.
35
class CreateBetterTogetherContentLinks < ActiveRecord::Migration[7.1]
6+
# rubocop:disable Metrics/MethodLength
47
def change
58
create_bt_table :links, prefix: :better_together_content do |t|
69
t.string :link_type, null: false, index: true
710
t.string :url, null: false, index: true
811
t.string :scheme
912
t.string :host, index: true
10-
# Data re: the link itself
1113
t.boolean :external, index: true
1214
t.boolean :valid_link, index: true
1315
t.datetime :last_checked_at, index: true
1416
t.string :latest_status_code, index: true
1517
t.text :error_message
1618
end
1719
end
20+
# rubocop:enable Metrics/MethodLength
1821
end

db/migrate/20241125190948_create_better_together_metrics_rich_text_links.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# frozen_string_literal: true
22

3+
# Migration to create the RichText link join table used for metrics and
4+
# associations between ActionText content and discovered links.
35
class CreateBetterTogetherMetricsRichTextLinks < ActiveRecord::Migration[7.1]
46
def change
57
create_bt_table :rich_text_links, prefix: :better_together_metrics do |t|
68
t.bt_references :link, foreign_key: { to_table: :better_together_content_links }
7-
# Data re: the RichText and record
89
t.bt_references :rich_text, foreign_key: { to_table: :action_text_rich_texts }
910
t.bt_references :rich_text_record, polymorphic: true, index: { name: 'by_rich_text_link_record' }
1011
t.bt_position # index in the RichText links array

lib/tasks/quality_assurance.rake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ namespace :better_together do
117117
task check: :environment do
118118
BetterTogether::Metrics::RichTextInternalLinkCheckerQueueJob.new
119119
BetterTogether::Metrics::RichTextExternalLinkCheckerQueueJob.new
120-
byebug
121120
end
122121

123122
def determine_link_type(uri, internal_link)

0 commit comments

Comments
 (0)