repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/models/application_record.rb | app/models/application_record.rb | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/models/status_change.rb | app/models/status_change.rb | # frozen_string_literal: true
class StatusChange < ApplicationRecord
belongs_to :check
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/models/check.rb | app/models/check.rb | # frozen_string_literal: true
# @attr [string] name name
# @attr [string] cron cron schedule format
# @attr [datetime] created_at when the record was created in database
# @attr [datetime] updated_at when the record was last updated in database
# @attr [string] url URL to ping for healthchecking
# @attr [string] statu... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/lib/ciao/renderers/replace_renderer.rb | app/lib/ciao/renderers/replace_renderer.rb | # frozen_string_literal: true
module Ciao
module Renderers
class ReplaceRenderer < Base
CHECK_NAME_PLACEHOLDER = "__name__"
STATUS_AFTER_PLACEHOLDER = "__status_after__"
STATUS_BEFORE_PLACEHOLDER = "__status_before__"
URL_PLACEHOLDER = "__url__"
CHECK_URL_PLACEHOLDER = "__check_url_... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/lib/ciao/renderers/base.rb | app/lib/ciao/renderers/base.rb | # frozen_string_literal: true
module Ciao
module Renderers
class Base
def initialize(template)
@template = template
end
def render(_data)
raise NotImplementedError,
"You can not call Ciao::Renderers::Base#render directly"
end
end
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/lib/ciao/notifications/mail_notification.rb | app/lib/ciao/notifications/mail_notification.rb | # frozen_string_literal: true
module Ciao
module Notifications
class MailNotification < Base
def notify(payload_data = {})
CheckMailer.with(payload_data).change_status_mail.deliver
end
end
class MailNotificationTlsExpires < Base
def notify(payload_data = {})
CheckMailer... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/lib/ciao/notifications/base.rb | app/lib/ciao/notifications/base.rb | # frozen_string_literal: true
module Ciao
module Notifications
class Base
def initialize(endpoint = nil,
payload_template = nil,
payload_renderer_cls = Ciao::Renderers::ReplaceRenderer)
@endpoint = endpoint
@payload_renderer = payload_renderer_cls.new(payload_template)
... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/lib/ciao/notifications/webhook_notification.rb | app/lib/ciao/notifications/webhook_notification.rb | # frozen_string_literal: true
module Ciao
module Notifications
class WebhookNotification < Base
def notify(payload_data = {})
uri = URI.parse(@endpoint)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Post.new(
ur... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/lib/ciao/parsers/webhook_parser.rb | app/lib/ciao/parsers/webhook_parser.rb | # frozen_string_literal: true
module Ciao
module Parsers
class WebhookParser
WEBHOOKS_ENDPOINT_PREFIX = "CIAO_WEBHOOK_ENDPOINT_"
WEBHOOKS_PAYLOAD_PREFIX = "CIAO_WEBHOOK_PAYLOAD_"
WEBHOOKS_PAYLOAD_TLS_EXPIRES_PREFIX = "CIAO_WEBHOOK_PAYLOAD_TLS_EXPIRES_"
WEBHOOKS_ENDPOINT_FORMAT = "#{WEBHO... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/mailers/check_mailer.rb | app/mailers/check_mailer.rb | # frozen_string_literal: true
# Mailer to send mails about checkhealth updates/changes.
# `From:`, `To:` and other SMTP options are configured at config/environments/production.rb
class CheckMailer < ApplicationMailer
# Sends mail to inform the receiver about a
# healthcheck status change
# @param name [String] ... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/mailers/application_mailer.rb | app/mailers/application_mailer.rb | # frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base
layout "mailer"
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/channels/application_cable/channel.rb | app/channels/application_cable/channel.rb | # frozen_string_literal: true
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/channels/application_cable/connection.rb | app/channels/application_cable/connection.rb | # frozen_string_literal: true
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/seeds.rb | db/seeds.rb | # frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name:... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/schema.rb | db/schema.rb | # frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define yo... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190511005035_create_checks.rb | db/migrate/20190511005035_create_checks.rb | # frozen_string_literal: true
class CreateChecks < ActiveRecord::Migration[6.0]
def change
create_table :checks do |t|
t.string :name
t.text :description
t.string :cron
t.timestamps
end
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20230613114013_add_tls_expires_in_days_to_checks.rb | db/migrate/20230613114013_add_tls_expires_in_days_to_checks.rb | # frozen_string_literal: true
class AddTlsExpiresInDaysToChecks < ActiveRecord::Migration[6.1]
def change
add_column :checks, :tls_expires_in_days, :integer
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20230615063542_add_tls_job_to_checks.rb | db/migrate/20230615063542_add_tls_job_to_checks.rb | # frozen_string_literal: true
class AddTlsJobToChecks < ActiveRecord::Migration[6.1]
def change
add_column :checks, :tls_job, :string
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190511125018_add_active_to_checks.rb | db/migrate/20190511125018_add_active_to_checks.rb | # frozen_string_literal: true
class AddActiveToChecks < ActiveRecord::Migration[6.0]
def change
add_column :checks, :active, :boolean
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190511134031_add_job_to_checks.rb | db/migrate/20190511134031_add_job_to_checks.rb | # frozen_string_literal: true
class AddJobToChecks < ActiveRecord::Migration[6.0]
def change
add_column :checks, :job, :string
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20230613104350_add_tls_expires_at_to_checks.rb | db/migrate/20230613104350_add_tls_expires_at_to_checks.rb | # frozen_string_literal: true
class AddTlsExpiresAtToChecks < ActiveRecord::Migration[6.1]
def change
add_column :checks, :tls_expires_at, :datetime
add_index :checks, :tls_expires_at
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190511124347_add_url_to_checks.rb | db/migrate/20190511124347_add_url_to_checks.rb | # frozen_string_literal: true
class AddUrlToChecks < ActiveRecord::Migration[6.0]
def change
add_column :checks, :url, :string
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20221114215533_create_status_changes.rb | db/migrate/20221114215533_create_status_changes.rb | # frozen_string_literal: true
class CreateStatusChanges < ActiveRecord::Migration[6.1]
def change
create_table :status_changes do |t|
t.string :status
t.references :check, null: false, foreign_key: true
t.timestamps
end
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190513131721_add_next_contact_at_to_checks.rb | db/migrate/20190513131721_add_next_contact_at_to_checks.rb | # frozen_string_literal: true
class AddNextContactAtToChecks < ActiveRecord::Migration[6.0]
def change
add_column :checks, :next_contact_at, :datetime
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190513113609_add_last_contact_at_to_checks.rb | db/migrate/20190513113609_add_last_contact_at_to_checks.rb | # frozen_string_literal: true
class AddLastContactAtToChecks < ActiveRecord::Migration[6.0]
def change
add_column :checks, :last_contact_at, :datetime
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190511231027_remove_description_from_checks.rb | db/migrate/20190511231027_remove_description_from_checks.rb | # frozen_string_literal: true
class RemoveDescriptionFromChecks < ActiveRecord::Migration[6.0]
def change
remove_column :checks, :description, :text
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/db/migrate/20190511124951_add_status_to_checks.rb | db/migrate/20190511124951_add_status_to_checks.rb | # frozen_string_literal: true
class AddStatusToChecks < ActiveRecord::Migration[6.0]
def change
add_column :checks, :status, :string
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/application_system_test_case.rb | test/application_system_test_case.rb | # frozen_string_literal: true
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
require "mocha/minitest"
require "webmock/minitest"
module ActiveSupport
class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/system/checks_test.rb | test/system/checks_test.rb | # frozen_string_literal: true
require "application_system_test_case"
class ChecksTest < ApplicationSystemTestCase
setup do
@check = checks(:one)
end
test "visiting the index" do
visit checks_url
assert_selector "h1", text: "Checks"
end
test "creating a Check" do
visit checks_url
click_... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/controllers/checks_controller_test.rb | test/controllers/checks_controller_test.rb | # frozen_string_literal: true
require "test_helper"
class ChecksControllerTest < ActionDispatch::IntegrationTest
setup do
@check = checks(:one)
end
test "should get index" do
get checks_url
assert_response :success
end
test "should get new" do
get new_check_url
assert_response :success... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/models/status_change_test.rb | test/models/status_change_test.rb | # frozen_string_literal: true
require "test_helper"
class StatusChangeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/models/check_test.rb | test/models/check_test.rb | # frozen_string_literal: true
require "test_helper"
class CheckTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/unit/ciao/renderers/replace_renderer_test.rb | test/unit/ciao/renderers/replace_renderer_test.rb | # frozen_string_literal: true
require "test_helper"
module Ciao
module Renderers
class ReplaceRendererTest < ActiveSupport::TestCase
test "#initialize assigns @template" do
renderer = ReplaceRenderer.new('{"name": "__name__"}')
assert_equal '{"name": "__name__"}',
renderer.instan... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/unit/ciao/notifications/webhook_notification_test.rb | test/unit/ciao/notifications/webhook_notification_test.rb | # frozen_string_literal: true
require "test_helper"
module Ciao
module Notifications
class WebhookNotificationTest < ActiveSupport::TestCase
test "#initialize assigns @endpoint & @payload_renderer" do
notification = Ciao::Notifications::WebhookNotification.new(
"https://foo.bar",
... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/unit/ciao/parsers/webhook_parser_test.rb | test/unit/ciao/parsers/webhook_parser_test.rb | # frozen_string_literal: true
require "test_helper"
module Ciao
module Parsers
class WebhookParserTest < ActiveSupport::TestCase
test "self.matches" do
ENV["CIAO_WEBHOOK_ENDPOINT_1"] = "https://foo.bar"
assert_equal "1", Ciao::Parsers::WebhookParser.matches.first[:name]
end
te... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/mailers/check_mailer_test.rb | test/mailers/check_mailer_test.rb | # frozen_string_literal: true
require "test_helper"
class CheckMailerTest < ActionMailer::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/mailers/previews/check_mailer_preview.rb | test/mailers/previews/check_mailer_preview.rb | # frozen_string_literal: true
# Preview all emails at http://localhost:3000/rails/mailers/check_mailer
class CheckMailerPreview < ActionMailer::Preview
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/test/channels/application_cable/connection_test.rb | test/channels/application_cable/connection_test.rb | # frozen_string_literal: true
require "test_helper"
module ApplicationCable
class ConnectionTest < ActionCable::Connection::TestCase
# test "connects with cookies" do
# cookies.signed[:user_id] = 42
#
# connect
#
# assert_equal connection.user_id, "42"
# end
end
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/application.rb | config/application.rb | # frozen_string_literal: true
require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Ciao
class Application < Rails::Application
# Initialize configuration defaults for ... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/environment.rb | config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/puma.rb | config/puma.rb | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
root to: "checks#dashboard"
resources :checks do
get "job", to: "checks#job"
get "jobs/recreate", to: "checks#jobs_recreate", on: :collection
get "admin", to: "checks#admin", on: :collection
end
# For details on the DSL available within... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/spring.rb | config/spring.rb | # frozen_string_literal: true
Spring.watch(
".ruby-version",
".rbenv-vars",
"tmp/restart.txt",
"tmp/caching-dev.txt"
)
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/boot.rb | config/boot.rb | # frozen_string_literal: true
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require "logger" # Fix concurrent-ruby removing logger dependency which Rails itself does not have:wq
require "bootsnap/setup" # Speed up boot time by caching ex... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.conte... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/application_controller_renderer.rb | config/initializers/application_controller_renderer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/yabeda.rb | config/initializers/yabeda.rb | # frozen_string_literal: true
prometheus_enabled = ENV.fetch("PROMETHEUS_ENABLED", "false")
if prometheus_enabled == "true"
Yabeda.configure do
group :ciao do
gauge :checks, comment: "Number of checks"
gauge :checks_active, comment: "Number of active checks"
gauge :checks_healthy, comment: "Num... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_con... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/app.rb | config/initializers/app.rb | # frozen_string_literal: true
NET_HTTP_ERRORS = [
EOFError,
Errno::ECONNRESET,
Errno::EINVAL,
Errno::ECONNREFUSED,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError,
Net::ProtocolError,
Timeout::Error,
SocketError,
OpenSSL::SSL::SSLError
].freeze
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/inflections.rb | config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflec... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/simple_form_bootstrap.rb | config/initializers/simple_form_bootstrap.rb | # frozen_string_literal: true
# Please do not make direct changes to this file!
# This generator is maintained by the community around simple_form-bootstrap:
# https://github.com/rafaelfranca/simple_form-bootstrap
# All future development, tests, and organization should happen there.
# Background history: https://gith... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/rufus_scheduler.rb | config/initializers/rufus_scheduler.rb | # frozen_string_literal: true
require "rufus-scheduler"
scheduler = Rufus::Scheduler.singleton(max_work_threads: 2300)
def scheduler.on_error(job, error)
Rails.logger.error(
"err#{error.object_id} rufus-scheduler intercepted #{error.inspect}" \
" in job #{job.inspect}"
)
error.backtrace.each_with_index... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/simple_form.rb | config/initializers/simple_form.rb | # frozen_string_literal: true
#
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/plataformatec/simple_form#custom-components to know
# more about custom components.
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
#
# Use this setup blo... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/cookies_serializer.rb | config/initializers/cookies_serializer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/assets.rb | config/initializers/assets.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.image... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/notifications.rb | config/initializers/notifications.rb | # frozen_string_literal: true
# Some time in the future Rails is not going to auto_load these for us :(
# we have to explictly require it here
Dir[Rails.root.join("app", "lib", "ciao", "**", "*.rb")].sort.each { |f| require f }
# export CIAO_WEBHOOK_ENDPOINT_$NAME=https://chat.yourhost.net/*****
# export CIAO_WEBHOOK... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/create_background_jobs.rb | config/initializers/create_background_jobs.rb | # frozen_string_literal: true
# Create all Rufus Scheduler Jobs for active checks on Application Start
# Prevent the initializer to be run during rake tasks
if defined?(Rails::Server) && ActiveRecord::Base.connection.table_exists?("checks")
Check.active.each(&:create_job)
Check.active.each(&:create_tls_job)
end
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.applic... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/environments/development.rb | config/environments/development.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
brotandgames/ciao | https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/config/environments/production.rb | config/environments/production.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... | ruby | MIT | 63a79aa41caa9a1d149e07623448fcd679cfafca | 2026-01-04T15:59:50.025269Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/setup.rb | test/setup.rb | # frozen_string_literal: true
# Configure Active Record.
# We must import "uri" explicitly as otherwise URI won't be accessible in
# Ruby 2.7.2 / Rails 6.
require "uri"
require "logger"
require "active_record"
require "pg"
require "mysql2"
require "sqlite3"
adapter = ENV.fetch("DATABASE_ADAPTER")
if adapter == "sq... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/config_test.rb | test/active_record_doctor/config_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::ConfigTest < Minitest::Test
def test_merge_globals_empty
config1 = ActiveRecordDoctor::Config.new({}, {})
config2 = ActiveRecordDoctor::Config.new({}, {})
config = config1.merge(config2)
assert_equal({}, config.globals)
end
def test_merge... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/runner_test.rb | test/active_record_doctor/runner_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::RunnerTest < Minitest::Test
def setup
@io = StringIO.new
@runner = ActiveRecordDoctor::Runner.new(
config: load_config,
logger: ActiveRecordDoctor::Logger::Dummy.new,
io: @io
)
end
def test_run_one_raises_on_unknown_detectors
... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/config/loader_test.rb | test/active_record_doctor/config/loader_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::LoaderTest < Minitest::Test
def test_load_config
config_path = config_file(<<-CONFIG)
ActiveRecordDoctor.configure do |config|
config.global :ignore_tables, ["schema_migrations"]
config.detector :extraneous_indexes, ignore_tables: ["u... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/incorrect_dependent_option_test.rb | test/active_record_doctor/detectors/incorrect_dependent_option_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::IncorrectDependentOptionTest < Minitest::Test
def test_invoking_no_callbacks_suggests_delete_all
Context.create_table(:companies) do
end.define_model do
has_many :users, dependent: :destroy
end
Context.create_table(:users) do |... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/table_without_primary_key_test.rb | test/active_record_doctor/detectors/table_without_primary_key_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::TableWithoutPrimaryKeyTest < Minitest::Test
def test_table_without_primary_key_reported
Context.create_table(:companies, id: false) do |t|
t.string :name
end
assert_problems(<<~OUTPUT)
add a primary key to companies
OUTPU... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/disable_test.rb | test/active_record_doctor/detectors/disable_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::DisableTest < Minitest::Test
# Disabling detectors is implemented in the base class. It's enough to test
# it on a single detector to be reasonably certain it works on all of them.
def test_disabling
Context.create_table(:users) do |t|
... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/table_without_timestamps_test.rb | test/active_record_doctor/detectors/table_without_timestamps_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::TableWithoutTimestampsTest < Minitest::Test
def test_table_without_timestamps_reported
Context.create_table(:companies) do |t|
t.string :name
end
assert_problems(<<~OUTPUT)
add a created_at column to companies
add a upd... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/incorrect_boolean_presence_validation_test.rb | test/active_record_doctor/detectors/incorrect_boolean_presence_validation_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::IncorrectBooleanPresenceValidationTest < Minitest::Test
def test_presence_true_is_reported_on_boolean_only
Context.create_table(:users) do |t|
t.string :email, null: false
t.boolean :active, null: false
end.define_model do
#... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/incorrect_length_validation_test.rb | test/active_record_doctor/detectors/incorrect_length_validation_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::IncorrectLengthValidationTest < Minitest::Test
def test_validation_and_limit_equal_is_ok
Context.create_table(:users) do |t|
t.string :email, limit: 64
t.string :name, limit: 32
end.define_model do
validates :email, length: ... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/missing_non_null_constraint_test.rb | test/active_record_doctor/detectors/missing_non_null_constraint_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::MissingNonNullConstraintTest < Minitest::Test
def test_optional_columns_with_presence_validator_are_disallowed
Context.create_table(:users) do |t|
t.string :name, null: true
end.define_model do
validates :name, presence: true
... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/missing_presence_validation_test.rb | test/active_record_doctor/detectors/missing_presence_validation_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::MissingPresenceValidationTest < Minitest::Test
def test_null_column_is_not_reported_if_validation_absent
Context.create_table(:users) do |t|
t.string :name
end.define_model do
end
refute_problems
end
def test_non_null_colu... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/missing_unique_indexes_test.rb | test/active_record_doctor/detectors/missing_unique_indexes_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::MissingUniqueIndexesTest < Minitest::Test
def test_missing_unique_index
Context.create_table(:users) do |t|
t.string :email
t.index :email
end.define_model do
validates :email, uniqueness: true
end
assert_problems(<... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/undefined_table_references_test.rb | test/active_record_doctor/detectors/undefined_table_references_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::UndefinedTableReferencesTest < Minitest::Test
def test_model_backed_by_table
Context.create_table(:users) do
end.define_model do
end
refute_problems
end
def test_model_backed_by_non_existent_table
Context.define_model(:User)... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/mismatched_foreign_key_type_test.rb | test/active_record_doctor/detectors/mismatched_foreign_key_type_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::MismatchedForeignKeyTypeTest < Minitest::Test
def test_mismatched_foreign_key_type_is_reported
require_foreign_keys_of_different_type!
Context.create_table(:companies, id: :smallint)
Context.create_table(:users) do |t|
t.references... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/short_primary_key_type_test.rb | test/active_record_doctor/detectors/short_primary_key_type_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::ShortPrimaryKeyTypeTest < Minitest::Test
def setup
@connection = ActiveRecord::Base.connection
@connection.enable_extension("uuid-ossp") if postgresql?
super
end
def teardown
@connection.disable_extension("uuid-ossp") if postgres... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/unindexed_foreign_keys_test.rb | test/active_record_doctor/detectors/unindexed_foreign_keys_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::UnindexedForeignKeysTest < Minitest::Test
def test_unindexed_foreign_key_is_reported
require_non_indexed_foreign_keys!
Context.create_table(:companies)
Context.create_table(:users) do |t|
t.references :company, foreign_key: true, i... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/missing_foreign_keys_test.rb | test/active_record_doctor/detectors/missing_foreign_keys_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::MissingForeignKeysTest < Minitest::Test
def test_missing_foreign_key_is_reported
Context.create_table(:companies)
Context.create_table(:users) do |t|
t.references :company, foreign_key: false
end.define_model do
belongs_to :co... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/unindexed_deleted_at_test.rb | test/active_record_doctor/detectors/unindexed_deleted_at_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::UnindexedDeletedAtTest < Minitest::Test
def test_indexed_deleted_at_is_not_reported
require_partial_indexes!
Context.create_table(:users) do |t|
t.string :first_name
t.string :last_name
t.datetime :deleted_at
t.index ... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/active_record_doctor/detectors/extraneous_indexes_test.rb | test/active_record_doctor/detectors/extraneous_indexes_test.rb | # frozen_string_literal: true
class ActiveRecordDoctor::Detectors::ExtraneousIndexesTest < Minitest::Test
def test_index_on_primary_key_is_duplicate
Context.create_table(:users) do |t|
t.index :id
end
assert_problems(<<OUTPUT)
remove index_users_on_id from users - coincides with the primary key on... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/test/generators/active_record_doctor/add_indexes/add_indexes_generator_test.rb | test/generators/active_record_doctor/add_indexes/add_indexes_generator_test.rb | # frozen_string_literal: true
require "rails/generators"
require "generators/active_record_doctor/add_indexes/add_indexes_generator"
class ActiveRecordDoctor::AddIndexesGeneratorTest < Minitest::Test
TIMESTAMP = Time.new(2021, 2, 1, 13, 15, 30)
def test_create_migrations
Context.create_table(:notes) do |t|
... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor.rb | lib/active_record_doctor.rb | # frozen_string_literal: true
require "active_record_doctor/railtie" if defined?(Rails::Railtie)
require "active_record_doctor/utils"
require "active_record_doctor/logger"
require "active_record_doctor/logger/dummy"
require "active_record_doctor/logger/hierarchical"
require "active_record_doctor/detectors"
require "ac... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/version.rb | lib/active_record_doctor/version.rb | # frozen_string_literal: true
module ActiveRecordDoctor
VERSION = "2.0.1"
end
| ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/logger.rb | lib/active_record_doctor/logger.rb | # frozen_string_literal: true
module ActiveRecordDoctor
module Logger # :nodoc:
end
end
| ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/errors.rb | lib/active_record_doctor/errors.rb | # frozen_string_literal: true
module ActiveRecordDoctor # :nodoc:
def self.handle_exception
yield
rescue ActiveRecordDoctor::Error => e
$stderr.puts(e.user_message)
exit(1)
end
# Generic active_record_doctor exception class.
class Error < RuntimeError
attr_accessor :config_path
def self... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/utils.rb | lib/active_record_doctor/utils.rb | # frozen_string_literal: true
module ActiveRecordDoctor
module Utils # :nodoc:
class << self
def postgresql?(connection = ActiveRecord::Base.connection)
["PostgreSQL", "PostGIS"].include?(connection.adapter_name)
end
def mysql?(connection = ActiveRecord::Base.connection)
connec... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/railtie.rb | lib/active_record_doctor/railtie.rb | # frozen_string_literal: true
module ActiveRecordDoctor
class Railtie < Rails::Railtie # :nodoc:
rake_tasks do
load "tasks/active_record_doctor.rake"
end
end
end
| ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/help.rb | lib/active_record_doctor/help.rb | # frozen_string_literal: true
module ActiveRecordDoctor
# Turn a detector class into a human-readable help text.
class Help
def initialize(klass)
@klass = klass
end
def to_s
<<-HELP
#{klass.underscored_name} - #{klass.description}
Configuration options:
#{config_to_s}
HELP
end
... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/runner.rb | lib/active_record_doctor/runner.rb | # frozen_string_literal: true
module ActiveRecordDoctor # :nodoc:
# An execution environment for active_record_doctor that provides a config
# and an output device for use by detectors.
class Runner
# io is injected via constructor parameters to facilitate testing.
def initialize(config:, logger:, io: $s... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/printers.rb | lib/active_record_doctor/printers.rb | # frozen_string_literal: true
module ActiveRecordDoctor
module Printers # :nodoc:
end
end
| ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/config.rb | lib/active_record_doctor/config.rb | # frozen_string_literal: true
module ActiveRecordDoctor # :nodoc:
Config = Struct.new(:globals, :detectors) do
def merge(config)
globals = self.globals.merge(config.globals)
detectors = self.detectors.merge(config.detectors) do |_name, self_settings, config_settings|
self_settings.merge(confi... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/detectors.rb | lib/active_record_doctor/detectors.rb | # frozen_string_literal: true
require "active_support"
require "active_support/core_ext/class/subclasses"
module ActiveRecordDoctor # :nodoc:
def self.detectors
@detectors ||=
begin
detectors = {}
ActiveRecordDoctor::Detectors::Base.subclasses.each do |detector|
detectors[detecto... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/logger/dummy.rb | lib/active_record_doctor/logger/dummy.rb | # frozen_string_literal: true
module ActiveRecordDoctor
module Logger
class Dummy # :nodoc:
def log(_message)
yield if block_given?
end
end
end
end
| ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/logger/hierarchical.rb | lib/active_record_doctor/logger/hierarchical.rb | # frozen_string_literal: true
module ActiveRecordDoctor
module Logger
class Hierarchical # :nodoc:
def initialize(io)
@io = io
@nesting = 0
end
def log(message)
@io.puts((" " * @nesting) + message.to_s)
return if !block_given?
@nesting += 1
res... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/rake/task.rb | lib/active_record_doctor/rake/task.rb | # frozen_string_literal: true
require "rake/tasklib"
module ActiveRecordDoctor
module Rake
# A Rake task for calling active_record_doctor detectors.
#
# The three supported attributes are:
#
# - deps - project-specific Rake dependencies, e.g. :environment in Rails.
# - config_path - acti... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
gregnavis/active_record_doctor | https://github.com/gregnavis/active_record_doctor/blob/69ed244d4eeefff4c446149f5a78fa856fba7791/lib/active_record_doctor/config/default.rb | lib/active_record_doctor/config/default.rb | # frozen_string_literal: true
ActiveRecordDoctor.configure do
global :ignore_tables, [
"ar_internal_metadata",
"schema_migrations",
"active_storage_blobs",
"active_storage_attachments",
"action_text_rich_texts"
]
detector :extraneous_indexes,
enabled: true,
ignore_tables: [],
ign... | ruby | MIT | 69ed244d4eeefff4c446149f5a78fa856fba7791 | 2026-01-04T15:59:53.827607Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.