diff --git a/.rubocop.yml b/.rubocop.yml index 119b78ae5..ac2050a45 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -342,6 +342,10 @@ Naming/AccessorMethodName: StyleGuide: '#accessor_mutator_method_names' Enabled: false +Naming/InclusiveLanguage: + Description: 'Recommend the use of inclusive language instead of problematic terms.' + Enabled: false + Naming/PredicateName: Description: 'Check the names of predicate methods.' StyleGuide: '#bool-methods-qmark' diff --git a/Gemfile b/Gemfile index 967d70fcc..e1c98bd00 100644 --- a/Gemfile +++ b/Gemfile @@ -147,7 +147,7 @@ group :development, :test do gem "knapsack_pro", "~> 2.17.0" # Help parallelize Ruby spec builds gem "pry-byebug", "~> 3.8" # Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish', 'continue' and 'break' commands to control execution gem "rspec-rails", "~> 5.0" # rspec-rails is a testing framework for Rails 3+ - gem "rubocop", "~> 1.17", require: false # Automatic Ruby code style checking tool + gem "rubocop", "~> 1.18", require: false # Automatic Ruby code style checking tool gem "rubocop-performance", "~> 1.11", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code gem "rubocop-rails", "~> 2.11", require: false # Automatic Rails code style checking tool gem "rubocop-rspec", "~> 2.4", require: false # Code style checking for RSpec files diff --git a/Gemfile.lock b/Gemfile.lock index 28e6a895d..462f5e58b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -646,7 +646,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.10.2) - rubocop (1.17.0) + rubocop (1.18.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -951,7 +951,7 @@ DEPENDENCIES rpush-redis (~> 1.1) rspec-rails (~> 5.0) rspec-retry (~> 0.6) - rubocop (~> 1.17) + rubocop (~> 1.18) rubocop-performance (~> 1.11) rubocop-rails (~> 2.11) rubocop-rspec (~> 2.4) diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 56280a3c7..3e02f5557 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -96,9 +96,9 @@ module Admin Moderator::DeleteUser.call(user: @user) link = helpers.tag.a("the page", href: admin_users_gdpr_delete_requests_path, data: { "no-instant" => true }) message = "@#{@user.username} (email: #{@user.email.presence || 'no email'}, user_id: #{@user.id}) " \ - "has been fully deleted. " \ - "If this is a GDPR delete, delete them from Mailchimp & Google Analytics " \ - " and confirm on " + "has been fully deleted. " \ + "If this is a GDPR delete, delete them from Mailchimp & Google Analytics " \ + " and confirm on " flash[:success] = helpers.safe_join([message, link, "."]) rescue StandardError => e flash[:danger] = e.message diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index c6f2e7667..743f346cc 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -1,6 +1,6 @@ class ConfirmationsController < Devise::ConfirmationsController FLASH_MESSAGE = "Email sent! Please contact support at %s if you are "\ - "having trouble receiving your confirmation instructions.".freeze + "having trouble receiving your confirmation instructions.".freeze def create self.resource = resource_class.send_confirmation_instructions(resource_params) diff --git a/app/controllers/feedback_messages_controller.rb b/app/controllers/feedback_messages_controller.rb index b71f54744..a83d744fb 100644 --- a/app/controllers/feedback_messages_controller.rb +++ b/app/controllers/feedback_messages_controller.rb @@ -2,7 +2,7 @@ class FeedbackMessagesController < ApplicationController # No authorization required for entirely public controller skip_before_action :verify_authenticity_token FLASH_MESSAGE = "Make sure the forms are filled. 🤖 Other possible errors: "\ - "%s".freeze + "%s".freeze def create flash.clear diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index d0e0f561a..e6d21c254 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -58,8 +58,8 @@ class OrganizationsController < ApplicationController redirect_to user_settings_path(:organization) rescue Pundit::NotAuthorizedError - flash[:error] = "Your organization was not deleted; you must be an admin, the only member in the organization, - and have no articles connected to the organization." + flash[:error] = "Your organization was not deleted; you must be an admin, the only member in the organization, " \ + "and have no articles connected to the organization." redirect_to user_settings_path(:organization, id: organization.id) end diff --git a/app/errors/authentication/errors.rb b/app/errors/authentication/errors.rb index 81386b3e8..1a6bfd9d7 100644 --- a/app/errors/authentication/errors.rb +++ b/app/errors/authentication/errors.rb @@ -1,10 +1,10 @@ module Authentication module Errors PREVIOUSLY_SUSPENDED_MESSAGE = "It appears that your previous %s " \ - "account was suspended. As such, we've taken measures to prevent you from " \ - "creating a new account with %s and its community. If you " \ - "think that there has been a mistake, please email us at %s, " \ - "and we will take another look.".freeze + "account was suspended. As such, we've taken measures to prevent you from " \ + "creating a new account with %s and its community. If you " \ + "think that there has been a mistake, please email us at %s, " \ + "and we will take another look.".freeze class Error < StandardError end diff --git a/app/helpers/rate_limit_checker_helper.rb b/app/helpers/rate_limit_checker_helper.rb index 9d4ae113c..13ecaedfd 100644 --- a/app/helpers/rate_limit_checker_helper.rb +++ b/app/helpers/rate_limit_checker_helper.rb @@ -1,6 +1,6 @@ module RateLimitCheckerHelper NEW_USER_MESSAGE = "How many %s can a new member (%s or less) " \ - "create within any 5 minute period?".freeze + "create within any 5 minute period?".freeze def self.new_user_message(thing) timeframe = "day".pluralize(Settings::RateLimit.user_considered_new_days) diff --git a/app/lib/constants/settings/authentication.rb b/app/lib/constants/settings/authentication.rb index 017cf5f6f..e9be53bc2 100644 --- a/app/lib/constants/settings/authentication.rb +++ b/app/lib/constants/settings/authentication.rb @@ -60,8 +60,8 @@ module Constants placeholder: "What is the Google reCAPTCHA secret key?" }, require_captcha_for_email_password_registration: { - description: "People will be required to fill out a captcha when - they're creating a new account in your community", + description: + "People will be required to fill out a captcha when they're creating a new account in your community", placeholder: "" }, twitter_key: { diff --git a/app/lib/constants/settings/general.rb b/app/lib/constants/settings/general.rb index 39f1a1a70..500b1e57b 100644 --- a/app/lib/constants/settings/general.rb +++ b/app/lib/constants/settings/general.rb @@ -45,7 +45,7 @@ module Constants }, main_social_image: { description: "Used as the main image in social networks and OpenGraph. Recommended aspect ratio " \ - "of 16:9 (600x337px,1200x675px)", + "of 16:9 (600x337px,1200x675px)", placeholder: IMAGE_PLACEHOLDER }, mailchimp_api_key: { @@ -86,7 +86,7 @@ module Constants }, payment_pointer: { description: "Used for site-wide web monetization. " \ - "See: https://github.com/thepracticaldev/dev.to/pull/6345", + "See: https://github.com/thepracticaldev/dev.to/pull/6345", placeholder: "$pay.somethinglikethis.co/value" }, periodic_email_digest: { @@ -103,29 +103,29 @@ module Constants }, stripe_api_key: { description: "Secret Stripe key for receiving payments. " \ - "See: https://stripe.com/docs/keys", + "See: https://stripe.com/docs/keys", placeholder: "sk_live_...." }, stripe_publishable_key: { description: "Public Stripe key for receiving payments. " \ - "See: https://stripe.com/docs/keys", + "See: https://stripe.com/docs/keys", placeholder: "pk_live_...." }, suggested_tags: { - description: "Determines which tags are suggested to new users during onboarding (comma - separated, letters only)", + description: + "Determines which tags are suggested to new users during onboarding (comma separated, letters only)", placeholder: "List of valid tags: comma separated, letters only e.g. beginners,javascript,ruby,swift,kotlin" }, suggested_users: { description: "Determines which users are suggested to follow to new users during onboarding (comma " \ - "separated, letters only). Please note that these users will be shown as a fallback if no " \ - "recently-active commenters or producers can be suggested", + "separated, letters only). Please note that these users will be shown as a fallback if no " \ + "recently-active commenters or producers can be suggested", placeholder: "List of valid usernames: comma separated, letters only e.g. " \ - "ben,jess,peter,maestromac,andy,liana" + "ben,jess,peter,maestromac,andy,liana" }, prefer_manual_suggested_users: { description: "Always show suggested users as suggested people to follow even when " \ - "auto-suggestion is available" + "auto-suggestion is available" }, twitter_hashtag: { description: "Used as the twitter hashtag of the community", diff --git a/app/lib/constants/settings/rate_limit.rb b/app/lib/constants/settings/rate_limit.rb index 1e3c2189e..08509f673 100644 --- a/app/lib/constants/settings/rate_limit.rb +++ b/app/lib/constants/settings/rate_limit.rb @@ -8,7 +8,7 @@ module Constants }, user_considered_new_days: { description: "The number of days a user is considered new. The default is 3 days, but you "\ - "can disable this entirely by inputting 0.", + "can disable this entirely by inputting 0.", placeholder: ::Settings::RateLimit.user_considered_new_days } }.freeze diff --git a/app/lib/constants/settings/smtp.rb b/app/lib/constants/settings/smtp.rb index bbc550565..909506d0f 100644 --- a/app/lib/constants/settings/smtp.rb +++ b/app/lib/constants/settings/smtp.rb @@ -12,7 +12,7 @@ module Constants }, authentication: { description: " If your mail server requires authentication, " \ - "you need to specify the authentication type here", + "you need to specify the authentication type here", placeholder: "ie. plain, login, or cram_md5" }, user_name: { diff --git a/app/lib/constants/settings/user_experience.rb b/app/lib/constants/settings/user_experience.rb index 6bbf1228c..f8ddc12f9 100644 --- a/app/lib/constants/settings/user_experience.rb +++ b/app/lib/constants/settings/user_experience.rb @@ -6,8 +6,8 @@ module Constants description: "Determines the default reading font (registered users can change this in their UX settings)" }, feed_strategy: { - description: "Determines the main feed algorithm approach the app takes: basic or large_forem_experimental - (which should only be used for 10k+ member communities)", + description: "Determines the main feed algorithm approach the app takes: basic or large_forem_experimental " \ + "(which should only be used for 10k+ member communities)", placeholder: "basic" }, feed_style: { diff --git a/app/liquid_tags/spotify_tag.rb b/app/liquid_tags/spotify_tag.rb index 25616c573..2984d08b4 100644 --- a/app/liquid_tags/spotify_tag.rb +++ b/app/liquid_tags/spotify_tag.rb @@ -42,7 +42,7 @@ class SpotifyTag < LiquidTagBase def raise_error msg = "Invalid Spotify Link - Be sure you're using the uri of a specific track, " \ - "album, artist, playlist, or podcast episode." + "album, artist, playlist, or podcast episode." raise StandardError, msg end end diff --git a/app/liquid_tags/stackexchange_tag.rb b/app/liquid_tags/stackexchange_tag.rb index 244ffd492..426ad089f 100644 --- a/app/liquid_tags/stackexchange_tag.rb +++ b/app/liquid_tags/stackexchange_tag.rb @@ -75,7 +75,7 @@ class StackexchangeTag < LiquidTagBase id = input.split.first url = "#{API_URL}posts/#{id}?site=#{@site}&filter=#{FILTERS['post']}" \ - "&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}" + "&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}" post_response = HTTParty.get(url) handle_response_error(post_response, input) @@ -83,7 +83,7 @@ class StackexchangeTag < LiquidTagBase @post_type = post_response["items"][0]["post_type"] url = "#{API_URL}#{@post_type.pluralize}/#{id}?site=#{@site}" \ - "&filter=#{FILTERS[@post_type]}&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}" + "&filter=#{FILTERS[@post_type]}&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}" final_response = HTTParty.get(url) handle_response_error(final_response, input) diff --git a/app/liquid_tags/wikipedia_tag.rb b/app/liquid_tags/wikipedia_tag.rb index b067852e1..a14a727cc 100644 --- a/app/liquid_tags/wikipedia_tag.rb +++ b/app/liquid_tags/wikipedia_tag.rb @@ -1,6 +1,8 @@ class WikipediaTag < LiquidTagBase PARTIAL = "liquids/wikipedia".freeze WIKI_REGEXP = %r{\Ahttps?://([a-z-]+)\.wikipedia.org/wiki/(\S+)\z}.freeze + TEXT_CLEANUP_XPATH = "//div[contains(@class, 'noprint') or contains(@class, 'hatnote')] | " \ + "//span[@class='mw-ref'] | //figure | //sup".freeze def initialize(_tag_name, input, _parse_context) super @@ -89,12 +91,10 @@ class WikipediaTag < LiquidTagBase def text_clean_up(text) doc = Nokogiri::HTML(text) - path_expression = "//div[contains(@class, 'noprint') or contains(@class, 'hatnote')] | - //span[@class='mw-ref'] | - //figure | - //sup" - doc.xpath(path_expression).each(&:remove) + + doc.xpath(TEXT_CLEANUP_XPATH).each(&:remove) doc.xpath("//a").each { |x| x.replace Nokogiri::XML::Text.new(x.inner_html, x.document) } + doc.to_html end end diff --git a/app/models/reaction.rb b/app/models/reaction.rb index 99ec76c2a..12fb9b6f2 100644 --- a/app/models/reaction.rb +++ b/app/models/reaction.rb @@ -54,7 +54,7 @@ class Reaction < ApplicationRecord def cached_any_reactions_for?(reactable, user, category) class_name = reactable.instance_of?(ArticleDecorator) ? "Article" : reactable.class.name cache_name = "any_reactions_for-#{class_name}-#{reactable.id}-" \ - "#{user.reactions_count}-#{user.public_reactions_count}-#{category}" + "#{user.reactions_count}-#{user.public_reactions_count}-#{category}" Rails.cache.fetch(cache_name, expires_in: 24.hours) do Reaction.where(reactable_id: reactable.id, reactable_type: class_name, user: user, category: category).any? end diff --git a/app/queries/admin/users_query.rb b/app/queries/admin/users_query.rb index 415b17a47..9b37d825e 100644 --- a/app/queries/admin/users_query.rb +++ b/app/queries/admin/users_query.rb @@ -1,5 +1,11 @@ module Admin class UsersQuery + QUERY_CLAUSE = "users.name ILIKE :search OR " \ + "users.username ILIKE :search OR " \ + "users.github_username ILIKE :search OR " \ + "users.email ILIKE :search OR " \ + "users.twitter_username ILIKE :search".freeze + def self.call(relation: User.registered, options: {}) role, search = options.values_at(:role, :search) @@ -10,11 +16,7 @@ module Admin end def self.search_relation(relation, search) - relation.where("users.name ILIKE :search OR - users.username ILIKE :search OR - users.github_username ILIKE :search OR - users.email ILIKE :search OR - users.twitter_username ILIKE :search", search: "%#{search.strip}%") + relation.where(QUERY_CLAUSE, search: "%#{search.strip}%") end end end diff --git a/app/services/articles/builder.rb b/app/services/articles/builder.rb index 6419a304f..fa11d2291 100644 --- a/app/services/articles/builder.rb +++ b/app/services/articles/builder.rb @@ -83,7 +83,7 @@ module Articles def user_editor_v1 body = "---\ntitle: \npublished: false\ndescription: " \ - "\ntags: \n//cover_image: https://direct_url_to_image.jpg\n---\n\n" + "\ntags: \n//cover_image: https://direct_url_to_image.jpg\n---\n\n" Article.new( body_markdown: body, diff --git a/app/services/badges/award_streak.rb b/app/services/badges/award_streak.rb index 0ea98e4ef..9e28f1fa2 100644 --- a/app/services/badges/award_streak.rb +++ b/app/services/badges/award_streak.rb @@ -2,8 +2,8 @@ module Badges class AwardStreak LONGEST_STREAK_WEEKS = 16 LONGEST_STREAK_MESSAGE = "16 weeks! You've achieved the longest writing " \ - "streak possible. This makes you eligible for special quests in the future. " \ - "Keep up the amazing contributions to our community!".freeze + "streak possible. This makes you eligible for special quests in the future. " \ + "Keep up the amazing contributions to our community!".freeze MINIMUM_QUALITY = -25 diff --git a/app/services/error_messages/clean.rb b/app/services/error_messages/clean.rb index 3e1d813da..d31a8a49d 100644 --- a/app/services/error_messages/clean.rb +++ b/app/services/error_messages/clean.rb @@ -3,8 +3,8 @@ module ErrorMessages FRONTMATTER_ERROR = /expected key while parsing a block mapping at line/.freeze REPLACEMENT_ERROR = "There was a problem parsing the front-matter YAML. " \ - "Perhaps you need to escape a quote or a colon or something. " \ - "Email %s if you are having trouble.".freeze + "Perhaps you need to escape a quote or a colon or something. " \ + "Email %s if you are having trouble.".freeze def self.call(error_message) return error_message unless error_message.match?(FRONTMATTER_ERROR) diff --git a/app/services/moderator/merge_user.rb b/app/services/moderator/merge_user.rb index acc1a6d69..1bb1c023d 100644 --- a/app/services/moderator/merge_user.rb +++ b/app/services/moderator/merge_user.rb @@ -32,8 +32,8 @@ module Moderator def handle_identities error_message = "The user being deleted already has two identities. " \ - "Are you sure this is the right user to be deleted? " \ - "If so, a super admin will need to do this from the console to be safe." + "Are you sure this is the right user to be deleted? " \ + "If so, a super admin will need to do this from the console to be safe." raise error_message if @delete_user.identities.count.positive? return true if diff --git a/app/services/search/user.rb b/app/services/search/user.rb index 823ea46da..e8b242e88 100644 --- a/app/services/search/user.rb +++ b/app/services/search/user.rb @@ -12,10 +12,12 @@ module Search # User.search_score used to take employer related fields into account, but they have since been moved to profile # and removed from fields that are searched against. + # rubocop:disable Layout/LineEndStringConcatenationIndentation HOTNESS_SCORE_ORDER = Arel.sql(%{ (((articles_count + comments_count + reactions_count + badge_achievements_count) * 10) * reputation_modifier) DESC }.squish).freeze + # rubocop:enable Layout/LineEndStringConcatenationIndentation def self.search_documents(term: nil, sort_by: :nil, sort_direction: :desc, page: 0, per_page: DEFAULT_PER_PAGE) # NOTE: we should eventually update the frontend diff --git a/app/services/user_subscriptions/is_subscribed_cache_checker.rb b/app/services/user_subscriptions/is_subscribed_cache_checker.rb index a448a25bd..59cc6d7ec 100644 --- a/app/services/user_subscriptions/is_subscribed_cache_checker.rb +++ b/app/services/user_subscriptions/is_subscribed_cache_checker.rb @@ -16,7 +16,7 @@ module UserSubscriptions def call cache_key = "user-#{user.id}-#{user.updated_at.rfc3339}-#{user.subscribed_to_user_subscriptions_count}/" \ - "is_subscribed_#{source_type}_#{source_id}" + "is_subscribed_#{source_type}_#{source_id}" Rails.cache.fetch(cache_key, expires_in: 24.hours) do UserSubscription.where( subscriber_id: user.id, diff --git a/app/workers/reactions/bust_reactable_cache_worker.rb b/app/workers/reactions/bust_reactable_cache_worker.rb index 13d02705d..e3abe6051 100644 --- a/app/workers/reactions/bust_reactable_cache_worker.rb +++ b/app/workers/reactions/bust_reactable_cache_worker.rb @@ -16,7 +16,7 @@ module Reactions cache_bust.call("/reactions?article_id=#{reaction.reactable_id}") when "Comment" path = "/reactions?commentable_id=#{reaction.reactable.commentable_id}&" \ - "commentable_type=#{reaction.reactable.commentable_type}" + "commentable_type=#{reaction.reactable.commentable_type}" cache_bust.call(path) end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 38fb270d4..7a70604cd 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -135,7 +135,7 @@ Rails.application.configure do # Check if there are any data update scripts to run during startup if %w[Console Server DBConsole].any? { |const| Rails.const_defined?(const) } && DataUpdateScript.scripts_to_run? message = "Data update scripts need to be run before you can start the application. " \ - "Please run 'rails data_updates:run'" + "Please run 'rails data_updates:run'" raise message end end diff --git a/db/seeds.rb b/db/seeds.rb index c9eaec176..9601e2a8b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -290,33 +290,38 @@ end seeder.create_if_none(Broadcast) do broadcast_messages = { set_up_profile: "Welcome to DEV! 👋 I'm Sloan, the community mascot and I'm here to help get you started. " \ - "Let's begin by setting up your profile!", + "Let's begin by setting up your profile!", welcome_thread: "Sloan here again! 👋 DEV is a friendly community. " \ - "Why not introduce yourself by leaving a comment in the welcome thread!", + "Why not introduce yourself by leaving a comment in the welcome thread!", twitter_connect: "You're on a roll! 🎉 Do you have a Twitter account? " \ - "Consider connecting it so we can @mention you if we share your post " \ - "via our Twitter account @thePracticalDev.", + "Consider connecting it so we can @mention you if we share your post " \ + "via our Twitter account @thePracticalDev.", facebook_connect: "You're on a roll! 🎉 Do you have a Facebook account? " \ - "Consider connecting it.", + "Consider connecting it.", github_connect: "You're on a roll! 🎉 Do you have a GitHub account? " \ - "Consider connecting it so you can pin any of your repos to your profile.", - customize_feed: "Hi, it's me again! 👋 Now that you're a part of the DEV community, let's focus on personalizing " \ + "Consider connecting it so you can pin any of your repos to your profile.", + customize_feed: + "Hi, it's me again! 👋 Now that you're a part of the DEV community, let's focus on personalizing " \ "your content. You can start by following some tags to help customize your feed! 🎉", - customize_experience: "Sloan here! 👋 Did you know that that you can customize your DEV experience? " \ + customize_experience: + "Sloan here! 👋 Did you know that that you can customize your DEV experience? " \ "Try changing your font and theme and find the best style for you!", - start_discussion: "Sloan here! 👋 I noticed that you haven't " \ + start_discussion: + "Sloan here! 👋 I noticed that you haven't " \ "started a discussion yet. Starting a discussion is easy to do; " \ - "just click on 'Create Post' in the sidebar of the tag page to get started!", - ask_question: "Sloan here! 👋 I noticed that you haven't " \ + "just click on 'Create Post' in the sidebar of the tag page to get started!", + ask_question: + "Sloan here! 👋 I noticed that you haven't " \ "asked a question yet. Asking a question is easy to do; " \ "just click on 'Create Post' in the sidebar of the tag page to get started!", - discuss_and_ask: "Sloan here! 👋 I noticed that you haven't " \ + discuss_and_ask: + "Sloan here! 👋 I noticed that you haven't " \ "asked a question or " \ "started a discussion yet. It's easy to do both of these; " \ "just click on 'Create Post' in the sidebar of the tag page to get started!", download_app: "Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile app yet? " \ - "Consider downloading it so you can access all " \ - "of your favorite DEV content on the go!" + "Consider downloading it so you can access all " \ + "of your favorite DEV content on the go!" } broadcast_messages.each do |type, message| diff --git a/lib/data_update_scripts/20200820153340_insert_facebook_connect_broadcast_message.rb b/lib/data_update_scripts/20200820153340_insert_facebook_connect_broadcast_message.rb index 4cdb71b76..34098dbe5 100644 --- a/lib/data_update_scripts/20200820153340_insert_facebook_connect_broadcast_message.rb +++ b/lib/data_update_scripts/20200820153340_insert_facebook_connect_broadcast_message.rb @@ -4,7 +4,7 @@ module DataUpdateScripts return if Broadcast.find_by title: "Welcome Notification: facebook_connect" message = "You're on a roll! 🎉 Do you have a Facebook account? " \ - "Consider connecting it." + "Consider connecting it." Broadcast.create!( title: "Welcome Notification: facebook_connect", diff --git a/spec/factories/broadcasts.rb b/spec/factories/broadcasts.rb index 34a3883df..aced2cf3b 100644 --- a/spec/factories/broadcasts.rb +++ b/spec/factories/broadcasts.rb @@ -8,8 +8,8 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Welcome to DEV! 👋 I'm Sloan, " \ - "the community mascot and I'm here to help get you started. " \ - "Let's begin by setting up your profile!" + "the community mascot and I'm here to help get you started. " \ + "Let's begin by setting up your profile!" end end @@ -18,7 +18,7 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Sloan here again! 👋 DEV is a friendly community. " \ - "Why not introduce yourself by leaving a comment in the welcome thread!" + "Why not introduce yourself by leaving a comment in the welcome thread!" end end @@ -35,7 +35,7 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "You're on a roll! 🎉 Do you have a GitHub account? Consider " \ - "connecting it so you can pin any of your repos to your profile." + "connecting it so you can pin any of your repos to your profile." end end @@ -44,7 +44,7 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "You're on a roll! 🎉 Do you have a Facebook account? Consider " \ - "connecting it." + "connecting it." end end @@ -53,8 +53,8 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "You're on a roll! 🎉 Do you have a Twitter account? Consider " \ - "connecting it so we can @mention you if we share " \ - "your post via our Twitter account @thePracticalDev." + "connecting it so we can @mention you if we share " \ + "your post via our Twitter account @thePracticalDev." end end @@ -63,7 +63,7 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Sloan here! 👋 Did you know that that you can customize your DEV experience? " \ - "Try changing your font and theme and find the best style for you!" + "Try changing your font and theme and find the best style for you!" end end @@ -72,8 +72,8 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Hi, it's me again! 👋 Now that you're a part of the DEV community, " \ - "let's focus on personalizing your content. You can start by " \ - "following some tags to help customize your feed! 🎉" + "let's focus on personalizing your content. You can start by " \ + "following some tags to help customize your feed! 🎉" end end @@ -82,9 +82,9 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Sloan here! 👋 I noticed that you haven't " \ - "started a discussion yet. " \ - "Starting a discussion is easy to do; just click on 'Create Post' " \ - "in the sidebar of the tag page to get started!" + "started a discussion yet. " \ + "Starting a discussion is easy to do; just click on 'Create Post' " \ + "in the sidebar of the tag page to get started!" end end @@ -93,8 +93,8 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Sloan here! 👋 I noticed that you haven't " \ - "asked a question yet. " \ - "Asking a question is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!" + "asked a question yet. " \ + "Asking a question is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!" end end @@ -103,9 +103,9 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Sloan here! 👋 I noticed that you haven't " \ - "asked a question or " \ - "started a discussion yet. " \ - "It's easy to do both of these; just click on 'Create Post' in the sidebar of the tag page to get started!" + "asked a question or " \ + "started a discussion yet. " \ + "It's easy to do both of these; just click on 'Create Post' in the sidebar of the tag page to get started!" end end @@ -114,8 +114,8 @@ FactoryBot.define do type_of { "Welcome" } processed_html do "Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile " \ - "app yet? Consider downloading it " \ - "so you can access all of your favorite DEV content on the go!" + "app yet? Consider downloading it " \ + "so you can access all of your favorite DEV content on the go!" end end @@ -128,7 +128,8 @@ FactoryBot.define do trait :with_tracking do processed_html do "Sloan here again! 👋 DEV is a friendly community. Why not introduce " \ - "yourself by leaving a comment in the welcome thread!" + "yourself by leaving a comment in " \ + "the welcome thread!" end end end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 36803c4d0..fe7592ddd 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -184,7 +184,7 @@ RSpec.describe ApplicationHelper, type: :helper do } link = "text" + "question%20mark%20%3F%20%0A%20and%20a%20newline&subject=This%20is%20a%20long%20subject\">text" expect(email_link(text: "text", additional_info: additional_info)).to eq(link) end end diff --git a/spec/lib/data_update_scripts/update_article_main_image_path_spec.rb b/spec/lib/data_update_scripts/update_article_main_image_path_spec.rb index 00854ac16..336331e70 100644 --- a/spec/lib/data_update_scripts/update_article_main_image_path_spec.rb +++ b/spec/lib/data_update_scripts/update_article_main_image_path_spec.rb @@ -7,7 +7,7 @@ describe DataUpdateScripts::UpdateArticleMainImagePath do allow(ENV).to receive(:[]).with("FOREM_CONTEXT").and_return("forem_cloud") bad_path = "https://res.cloudinary.com/practicaldev/image/fetch/s--d-pOh1Z_--/c_imagga_scale,f_auto," \ - "fl_progressive,h_420,q_auto,w_1000/#{URL.url}/images/i/some-image.jpeg" + "fl_progressive,h_420,q_auto,w_1000/#{URL.url}/images/i/some-image.jpeg" article = create(:article, main_image: bad_path) described_class.new.run diff --git a/spec/liquid_tags/link_tag_spec.rb b/spec/liquid_tags/link_tag_spec.rb index 60fd0c5e1..58005be41 100644 --- a/spec/liquid_tags/link_tag_spec.rb +++ b/spec/liquid_tags/link_tag_spec.rb @@ -58,7 +58,7 @@ RSpec.describe LinkTag, type: :liquid_tag do