From 63de03417935656c1bdeb9cffc60443e320eb6b6 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sun, 1 Mar 2026 05:32:41 +0000 Subject: [PATCH] Rubocop autocorrections --- .rubocop_todo.yml | 27 +++++++++++---------------- app/models/crop.rb | 2 +- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a39632c06..09ada2431 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2026-03-01 05:17:50 UTC using RuboCop version 1.85.0. +# on 2026-03-01 05:32:16 UTC using RuboCop version 1.85.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -75,6 +75,16 @@ FactoryBot/ExcessiveCreateList: FactoryBot/SyntaxMethods: Enabled: false +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/HashAlignment: + Exclude: + - 'app/models/crop.rb' + # Offense count: 6 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings. @@ -254,12 +264,6 @@ RSpec/ContextMethod: RSpec/ContextWording: Enabled: false -# Offense count: 1 -# Configuration parameters: IgnoredMetadata. -RSpec/DescribeClass: - Exclude: - - 'spec/tasks/import_spec.rb' - # Offense count: 36 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants. @@ -643,15 +647,6 @@ Rails/RootPathnameMethods: - 'lib/tasks/import.rake' - 'spec/rails_helper.rb' -# Offense count: 4 -# Configuration parameters: ForbiddenMethods, AllowedMethods. -# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all -Rails/SkipsModelValidations: - Exclude: - - 'db/migrate/20240101010102_populate_crop_fields_from_openfarm_data.rb' - - 'db/migrate/20240810160538_set_default_language_for_existing_alternate_names.rb' - - 'db/migrate/20251128200506_add_description_to_crops.rb' - # Offense count: 21 Rails/ThreeStateBooleanColumn: Enabled: false diff --git a/app/models/crop.rb b/app/models/crop.rb index 8c8f0e82b..b04eb3325 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -61,7 +61,7 @@ class Crop < ApplicationRecord }, if: :approved? validates :en_youtube_url, - format: { + format: { with: %r{\A(?:https?://)?(?:www\.)?(?:youtube(?:-nocookie)?\.com/(?:(?:v|e(?:mbed)?)/|\S*?[?&]v=)|youtu\.be/)[a-zA-Z0-9_-]{11}(?:[?&]\S*)?\z}, message: 'is not a valid YouTube URL' },