diff --git a/.rubocop.yml b/.rubocop.yml index 346ea6c2f..1625ee1bb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,8 +3,9 @@ inherit_from: .rubocop_todo.yml require: rubocop-rspec # our custom config +# TODO: Uncomment it after fix rubocop-todo RSpec/MultipleExpectations RSpec/MultipleExpectations: - Max: 1 + # Max: 1 Exclude: - "spec/features/*" @@ -13,9 +14,10 @@ RSpec/DescribeClass: - spec/features/* - spec/requests/* -Metrics/LineLength: - Description: 'Limit lines to 100 characters.' - Max: 100 +# TODO: Uncomment it after fix rubocop-todo Metrics/LineLength +# Metrics/LineLength: +# Description: 'Limit lines to 100 characters.' +# Max: 100 ############################# @@ -117,9 +119,10 @@ Metrics/AbcSize: branches, and conditions. Enabled: false +# TODO: Uncomment it after fix rubocop-todo Metrics/BlockLength Metrics/BlockLength: CountComments: false # count full line comments? - Max: 25 +# Max: 25 ExcludedMethods: [] Exclude: - "spec/**/*" diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 5267cfacf..0b33d27b3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,11 +1,99 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2018-09-03 23:17:57 +0900 using RuboCop version 0.58.2. +# on 2018-10-02 23:35:16 +0300 using RuboCop version 0.59.2. # 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 # versions of RuboCop, may require this file to be generated again. +# Offense count: 104 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLines: + Exclude: + - 'app/models/buffer_update.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'config/routes.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'app/models/buffer_update.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'app/models/article.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, rails +Layout/IndentationConsistency: + Exclude: + - 'app/observers/organization_observer.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/LeadingCommentSpace: + Exclude: + - 'app/controllers/stories_controller.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented, indented_relative_to_receiver +Layout/MultilineMethodCallIndentation: + Exclude: + - 'app/models/follow.rb' + - 'app/models/message.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/MultilineOperationIndentation: + Exclude: + - 'app/models/message.rb' + - 'app/models/user.rb' + - 'app/services/membership_service.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/RescueEnsureAlignment: + Exclude: + - 'app/services/user_role_service.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceAroundEqualsInParameterDefault: + Exclude: + - 'app/models/buffer_update.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'app/mailers/notify_mailer.rb' + # Offense count: 4 Lint/IneffectiveAccessModifier: Exclude: @@ -19,45 +107,55 @@ Lint/UselessAccessModifier: - 'app/black_box/black_box.rb' - 'app/models/tweet.rb' -# Offense count: 8 +# Offense count: 7 # Configuration parameters: CountComments, ExcludedMethods. # ExcludedMethods: refine Metrics/BlockLength: - Max: 68 - -# Offense count: 108 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Metrics/LineLength: - Max: 274 + Max: 62 # Offense count: 13 Metrics/PerceivedComplexity: Max: 13 -# Offense count: 9 +# Offense count: 1 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: io, id, to, by, on, in, at, ip +# AllowedNames: io, id, to, by, on, in, at, ip, db Naming/UncommunicativeMethodParamName: Exclude: - - 'app/controllers/followed_articles_controller.rb' - - 'app/labor/mailchimp_bot.rb' - - 'app/labor/podcast_feed.rb' - - 'app/models/chat_channel.rb' - 'app/models/message.rb' - - 'app/models/tweet.rb' -# Offense count: 2 +# Offense count: 5 # Configuration parameters: Max. RSpec/ExampleLength: Exclude: + - 'spec/models/buffer_update_spec.rb' - 'spec/models/message_spec.rb' + - 'spec/requests/analytics_spec.rb' + - 'spec/requests/internal_buffer_updates_spec.rb' -# Offense count: 1 +# Offense count: 13 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_line_only, disallow +RSpec/ImplicitSubject: + Exclude: + - 'spec/models/feedback_message_spec.rb' + - 'spec/policies/comment_policy_spec.rb' + - 'spec/policies/organization_policy_spec.rb' + - 'spec/policies/user_policy_spec.rb' + - 'spec/requests/dashboard_spec.rb' + - 'spec/requests/registration_spec.rb' + +# Offense count: 4 # Configuration parameters: AggregateFailuresByDefault. RSpec/MultipleExpectations: Max: 6 +# Offense count: 2 +RSpec/RepeatedDescription: + Exclude: + - 'spec/models/buffer_update_spec.rb' + # Offense count: 3 Security/Open: Exclude: @@ -94,3 +192,46 @@ Style/EvalWithLocation: Style/MixinUsage: Exclude: - 'app/models/podcast_episode.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/MutableConstant: + Exclude: + - 'spec/support/omniauth_macros.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'app/controllers/stories_controller.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantSelf: + Exclude: + - 'app/models/buffer_update.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'spec/models/buffer_update_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + Exclude: + - 'config/routes.rb' + +# Offense count: 972 +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 274 diff --git a/Guardfile b/Guardfile index 06eb1aa86..fbbeaf8e1 100644 --- a/Guardfile +++ b/Guardfile @@ -37,7 +37,7 @@ rspec_options = { cmd: "bin/spring rspec -p", ############################# failed_mode: :focus, - bundler_env: :clean_env, + bundler_env: :clean_env } guard :rspec, rspec_options do diff --git a/app/controllers/async_info_controller.rb b/app/controllers/async_info_controller.rb index 94a0c1f0b..a2a4f51df 100644 --- a/app/controllers/async_info_controller.rb +++ b/app/controllers/async_info_controller.rb @@ -7,7 +7,7 @@ class AsyncInfoController < ApplicationController unless user_signed_in? render json: { param: request_forgery_protection_token, - token: form_authenticity_token, + token: form_authenticity_token } return end @@ -22,7 +22,7 @@ class AsyncInfoController < ApplicationController render json: { param: request_forgery_protection_token, token: form_authenticity_token, - user: user_data.to_json, + user: user_data.to_json } end end @@ -44,7 +44,7 @@ class AsyncInfoController < ApplicationController checked_code_of_conduct: @user.checked_code_of_conduct, number_of_comments: @user.comments.count, display_sponsors: @user.display_sponsors, - trusted: @user.trusted, + trusted: @user.trusted } end end diff --git a/app/controllers/buffered_articles_controller.rb b/app/controllers/buffered_articles_controller.rb index 2797d7386..3ea43dca3 100644 --- a/app/controllers/buffered_articles_controller.rb +++ b/app/controllers/buffered_articles_controller.rb @@ -3,7 +3,7 @@ class BufferedArticlesController < ApplicationController def index @article_urls = buffered_article_urls render json: { - urls: @article_urls, + urls: @article_urls }.to_json end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 904e103bb..40e68eacf 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -82,7 +82,7 @@ class CommentsController < ApplicationController name: current_user.name, profile_pic: ProfileImage.new(current_user).get(50), twitter_username: current_user.twitter_username, - github_username: current_user.github_username, + github_username: current_user.github_username } } elsif @comment = Comment.where(body_markdown: @comment.body_markdown, commentable_id: @comment.commentable.id, diff --git a/app/controllers/email_subscriptions_controller.rb b/app/controllers/email_subscriptions_controller.rb index 0b0036e86..9e9dca354 100644 --- a/app/controllers/email_subscriptions_controller.rb +++ b/app/controllers/email_subscriptions_controller.rb @@ -21,7 +21,7 @@ class EmailSubscriptionsController < ApplicationController email_follower_notifications: "follower notifications", email_mention_notifications: "mention notifications", email_connect_messages: "connect messages", - email_unread_notifications: "unread notifications", + email_unread_notifications: "unread notifications" } emails_type[given_email_type] end diff --git a/app/controllers/followed_articles_controller.rb b/app/controllers/followed_articles_controller.rb index 878049296..2bd8d35db 100644 --- a/app/controllers/followed_articles_controller.rb +++ b/app/controllers/followed_articles_controller.rb @@ -27,7 +27,7 @@ class FollowedArticlesController < ApplicationController response.headers["Cache-Control"] = "public, max-age=150" render json: { articles: @articles, - classic_article: (article_json(classic_article) if classic_article), + classic_article: (article_json(classic_article) if classic_article) }.to_json end @@ -55,9 +55,9 @@ class FollowedArticlesController < ApplicationController user: { name: article.user.name, username: article.user.username, - profile_image_90: ProfileImage.new(article.user).get(90), + profile_image_90: ProfileImage.new(article.user).get(90) }, - flare_tag: FlareTag.new(article).tag_hash, + flare_tag: FlareTag.new(article).tag_hash } end end diff --git a/app/controllers/github_repos_controller.rb b/app/controllers/github_repos_controller.rb index 21166e679..9265c1dd0 100644 --- a/app/controllers/github_repos_controller.rb +++ b/app/controllers/github_repos_controller.rb @@ -49,7 +49,7 @@ class GithubReposController < ApplicationController watchers_count: fetched_repo.watchers, stargazers_count: fetched_repo.stargazers_count, featured: true, - info_hash: fetched_repo.to_hash, + info_hash: fetched_repo.to_hash } end end diff --git a/app/controllers/live_articles_controller.rb b/app/controllers/live_articles_controller.rb index c7d7944a0..443c2c72b 100644 --- a/app/controllers/live_articles_controller.rb +++ b/app/controllers/live_articles_controller.rb @@ -14,8 +14,8 @@ class LiveArticlesController < ApplicationController tag_list: [], user: { name: @event.host_name, - profile_pic: ProfileImage.new(@event).get(50), - }, + profile_pic: ProfileImage.new(@event).get(50) + } } elsif @article set_surrogate_key_header "live--article_#{@article.id}" @@ -26,8 +26,8 @@ class LiveArticlesController < ApplicationController tag_list: @article.tag_list, user: { name: @article.user.name, - profile_pic: ProfileImage.new(@article.user).get(50), - }, + profile_pic: ProfileImage.new(@article.user).get(50) + } } else set_surrogate_key_header "live--nothing" diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 620a7b812..cc601fef2 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -31,8 +31,8 @@ class MessagesController < ApplicationController message: { chat_channel_id: @message.chat_channel_id, message: @message.errors.full_messages, - type: "error", - }, + type: "error" + } }, status: 401 end end @@ -49,7 +49,7 @@ class MessagesController < ApplicationController message: new_message.message_html, timestamp: Time.now, color: new_message.preferred_user_color, - reception_method: "pushed", + reception_method: "pushed" }.to_json end @@ -65,8 +65,8 @@ class MessagesController < ApplicationController message: { chat_channel_id: message_params[:chat_channel_id], message: "You can not do that because you are banned", - type: "error", - }, + type: "error" + } }, status: 401 end end diff --git a/app/dashboards/article_dashboard.rb b/app/dashboards/article_dashboard.rb index bb3b2896f..2bb9e7fd4 100644 --- a/app/dashboards/article_dashboard.rb +++ b/app/dashboards/article_dashboard.rb @@ -44,7 +44,7 @@ class ArticleDashboard < Administrate::BaseDashboard video_source_url: Field::String, video_thumbnail_url: Field::String, video_closed_caption_track_url: Field::String, - main_tag_name_for_social: Field::String, + main_tag_name_for_social: Field::String }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/badge_achievement_dashboard.rb b/app/dashboards/badge_achievement_dashboard.rb index 0b946ffd8..ed67a763c 100644 --- a/app/dashboards/badge_achievement_dashboard.rb +++ b/app/dashboards/badge_achievement_dashboard.rb @@ -18,7 +18,7 @@ class BadgeAchievementDashboard < Administrate::BaseDashboard id: Field::Number, rewarder_id: UserIdField, created_at: Field::DateTime, - updated_at: Field::DateTime, + updated_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/badge_dashboard.rb b/app/dashboards/badge_dashboard.rb index cc9090a6e..f59b69de6 100644 --- a/app/dashboards/badge_dashboard.rb +++ b/app/dashboards/badge_dashboard.rb @@ -15,7 +15,7 @@ class BadgeDashboard < Administrate::BaseDashboard description: Field::String, badge_image: CarrierwaveField, created_at: Field::DateTime, - updated_at: Field::DateTime, + updated_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/collection_dashboard.rb b/app/dashboards/collection_dashboard.rb index 18c5e19af..27076884d 100644 --- a/app/dashboards/collection_dashboard.rb +++ b/app/dashboards/collection_dashboard.rb @@ -19,7 +19,7 @@ class CollectionDashboard < Administrate::BaseDashboard social_image: Field::String, published: Field::Boolean, created_at: Field::DateTime, - updated_at: Field::DateTime, + updated_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/comment_dashboard.rb b/app/dashboards/comment_dashboard.rb index cd41a7b87..31e8a1ada 100644 --- a/app/dashboards/comment_dashboard.rb +++ b/app/dashboards/comment_dashboard.rb @@ -22,7 +22,7 @@ class CommentDashboard < Administrate::BaseDashboard ancestry: Field::String, id_code: Field::String, score: Field::Number, - deleted: Field::Boolean, + deleted: Field::Boolean }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/display_ad_dashboard.rb b/app/dashboards/display_ad_dashboard.rb index 9f3dc28e1..522c8dd68 100644 --- a/app/dashboards/display_ad_dashboard.rb +++ b/app/dashboards/display_ad_dashboard.rb @@ -20,7 +20,7 @@ class DisplayAdDashboard < Administrate::BaseDashboard published: Field::Boolean, approved: Field::Boolean, created_at: Field::DateTime, - updated_at: Field::DateTime, + updated_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/email_message_dashboard.rb b/app/dashboards/email_message_dashboard.rb index 2605a02fd..ca2491808 100644 --- a/app/dashboards/email_message_dashboard.rb +++ b/app/dashboards/email_message_dashboard.rb @@ -22,7 +22,7 @@ class EmailMessageDashboard < Administrate::BaseDashboard utm_campaign: Field::String, sent_at: Field::DateTime, opened_at: Field::DateTime, - clicked_at: Field::DateTime, + clicked_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/feedback_message_dashboard.rb b/app/dashboards/feedback_message_dashboard.rb index 03832061a..5bedc8ba8 100644 --- a/app/dashboards/feedback_message_dashboard.rb +++ b/app/dashboards/feedback_message_dashboard.rb @@ -12,7 +12,7 @@ class FeedbackMessageDashboard < Administrate::BaseDashboard id: Field::Number, message: Field::Text, feedback_type: Field::String, - category: Field::String, + category: Field::String }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/follow_dashboard.rb b/app/dashboards/follow_dashboard.rb index b56423660..a64250b96 100644 --- a/app/dashboards/follow_dashboard.rb +++ b/app/dashboards/follow_dashboard.rb @@ -15,7 +15,7 @@ class FollowDashboard < Administrate::BaseDashboard id: Field::Number, blocked: Field::Boolean, created_at: Field::DateTime, - updated_at: Field::DateTime, + updated_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/organization_dashboard.rb b/app/dashboards/organization_dashboard.rb index aa4cd5513..eeb171246 100644 --- a/app/dashboards/organization_dashboard.rb +++ b/app/dashboards/organization_dashboard.rb @@ -33,7 +33,7 @@ class OrganizationDashboard < Administrate::BaseDashboard approved: Field::Boolean, cta_button_text: Field::String, cta_button_url: Field::String, - cta_body_markdown: Field::Text, + cta_body_markdown: Field::Text }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/podcast_dashboard.rb b/app/dashboards/podcast_dashboard.rb index 334c393c6..61c9c6844 100644 --- a/app/dashboards/podcast_dashboard.rb +++ b/app/dashboards/podcast_dashboard.rb @@ -25,7 +25,7 @@ class PodcastDashboard < Administrate::BaseDashboard slug: Field::String, status_notice: Field::Text, created_at: Field::DateTime, - updated_at: Field::DateTime, + updated_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/podcast_episode_dashboard.rb b/app/dashboards/podcast_episode_dashboard.rb index 54a69b7a6..49e639b17 100644 --- a/app/dashboards/podcast_episode_dashboard.rb +++ b/app/dashboards/podcast_episode_dashboard.rb @@ -31,7 +31,7 @@ class PodcastEpisodeDashboard < Administrate::BaseDashboard guid: Field::String, created_at: Field::DateTime, updated_at: Field::DateTime, - social_image: CarrierwaveField, + social_image: CarrierwaveField }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/reaction_dashboard.rb b/app/dashboards/reaction_dashboard.rb index 4c50002f0..ad70a553d 100644 --- a/app/dashboards/reaction_dashboard.rb +++ b/app/dashboards/reaction_dashboard.rb @@ -15,7 +15,7 @@ class ReactionDashboard < Administrate::BaseDashboard category: Field::String, points: Field::Number.with_options(decimals: 2), created_at: Field::DateTime, - updated_at: Field::DateTime, + updated_at: Field::DateTime }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/tag_dashboard.rb b/app/dashboards/tag_dashboard.rb index 9ba3c7fce..78ccfbbfa 100644 --- a/app/dashboards/tag_dashboard.rb +++ b/app/dashboards/tag_dashboard.rb @@ -28,7 +28,7 @@ class TagDashboard < Administrate::BaseDashboard alias_for: Field::String, keywords_for_search: Field::String, taggings_count: Field::Number, - buffer_profile_id_code: Field::String, + buffer_profile_id_code: Field::String }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/dashboards/user_dashboard.rb b/app/dashboards/user_dashboard.rb index a6be7b119..72be9137b 100644 --- a/app/dashboards/user_dashboard.rb +++ b/app/dashboards/user_dashboard.rb @@ -45,7 +45,7 @@ class UserDashboard < Administrate::BaseDashboard saw_onboarding: Field::Boolean, following_tags_count: Field::Number, monthly_dues: Field::Number, - stripe_id_code: Field::String, + stripe_id_code: Field::String }.freeze # COLLECTION_ATTRIBUTES diff --git a/app/decorators/organization_decorator.rb b/app/decorators/organization_decorator.rb index 7aa887b1f..348f99730 100644 --- a/app/decorators/organization_decorator.rb +++ b/app/decorators/organization_decorator.rb @@ -9,12 +9,12 @@ class OrganizationDecorator < ApplicationDecorator if bg_color_hex.blank? { bg: assigned_color[:bg], - text: assigned_color[:text], + text: assigned_color[:text] } else { bg: bg_color_hex || assigned_color[:bg], - text: text_color_hex || assigned_color[:text], + text: text_color_hex || assigned_color[:text] } end end @@ -22,7 +22,7 @@ class OrganizationDecorator < ApplicationDecorator def assigned_color { bg: "#0a0a0a", - text: "#ffffff", + text: "#ffffff" } end end diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index 67b816042..a2b7bd61f 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -15,12 +15,12 @@ class UserDecorator < ApplicationDecorator if bg_color_hex.blank? { bg: assigned_color[:bg], - text: assigned_color[:text], + text: assigned_color[:text] } else { bg: bg_color_hex || assigned_color[:bg], - text: text_color_hex || assigned_color[:text], + text: text_color_hex || assigned_color[:text] } end end @@ -29,43 +29,43 @@ class UserDecorator < ApplicationDecorator colors = [ { bg: "#093656", - text: "#ffffff", + text: "#ffffff" }, { bg: "#19063A", - text: "#dce9f3", + text: "#dce9f3" }, { bg: "#0D4D4B", - text: "#fdf9f3", + text: "#fdf9f3" }, { bg: "#61122f", - text: "#ffffff", + text: "#ffffff" }, { bg: "#edebf6", - text: " #070126", + text: " #070126" }, { bg: "#080E3B", - text: "#ffffff", + text: "#ffffff" }, { bg: "#010C1F", - text: "#aebcd5", + text: "#aebcd5" }, { bg: "#d7dee2", - text: "#022235", + text: "#022235" }, { bg: "#161616", - text: "#66e2d5", + text: "#66e2d5" }, { bg: "#1c0bba", - text: "#c9d2dd", + text: "#c9d2dd" }, ] colors[id % 10] diff --git a/app/helpers/feedback_messages_helper.rb b/app/helpers/feedback_messages_helper.rb index cf5d25afe..d0a236b62 100644 --- a/app/helpers/feedback_messages_helper.rb +++ b/app/helpers/feedback_messages_helper.rb @@ -12,7 +12,7 @@ module FeedbackMessagesHelper HEREDOC { subject: "dev.to Status Update", - body: body, + body: body }.freeze end @@ -30,7 +30,7 @@ module FeedbackMessagesHelper HEREDOC { subject: "dev.to Status Update", - body: body, + body: body }.freeze end @@ -46,7 +46,7 @@ module FeedbackMessagesHelper HEREDOC { subject: "Courtesy Notice from dev.to", - body: body, + body: body }.freeze end end diff --git a/app/labor/color_from_image.rb b/app/labor/color_from_image.rb index 1d563f53a..3ed9d2fb2 100644 --- a/app/labor/color_from_image.rb +++ b/app/labor/color_from_image.rb @@ -14,7 +14,7 @@ class ColorFromImage def get_palette input = { - url: @url, + url: @url } client = Algorithmia.client(ApplicationConfig["ALGORITHMIA_KEY"]) algo = client.algo("vagrant/ColorSchemeExtraction/0.2.0") diff --git a/app/labor/mailchimp_bot.rb b/app/labor/mailchimp_bot.rb index 2008879da..f497b7a8a 100644 --- a/app/labor/mailchimp_bot.rb +++ b/app/labor/mailchimp_bot.rb @@ -33,8 +33,8 @@ class MailchimpBot EXPERIENCE: user.experience_level || 666, COUNTRY: user.shipping_country.to_s, STATE: user.shipping_state.to_s, - POSTAL_ZIP: user.shipping_postal_code.to_s, - }, + POSTAL_ZIP: user.shipping_postal_code.to_s + } }, ) success = true @@ -67,8 +67,8 @@ class MailchimpBot TWITTER: user.twitter_username.to_s, GITHUB: user.github_username.to_s, IMAGE_URL: user.profile_image_url.to_s, - MEMBERSHIP: membership.to_s, - }, + MEMBERSHIP: membership.to_s + } }, ) success = true diff --git a/app/labor/markdown_parser.rb b/app/labor/markdown_parser.rb index 4ac4f1076..4440ec9b4 100644 --- a/app/labor/markdown_parser.rb +++ b/app/labor/markdown_parser.rb @@ -38,7 +38,7 @@ class MarkdownParser renderer_options = { hard_wrap: true, filter_html: false, - link_attributes: { rel: "noopener noreferrer", target: "_blank" }, + link_attributes: { rel: "noopener noreferrer", target: "_blank" } } renderer = Redcarpet::Render::HTMLRouge.new(renderer_options) markdown = Redcarpet::Markdown.new(renderer, REDCARPET_CONFIG) diff --git a/app/labor/reaction_image.rb b/app/labor/reaction_image.rb index 9bc1bff73..80b57a95e 100644 --- a/app/labor/reaction_image.rb +++ b/app/labor/reaction_image.rb @@ -11,7 +11,7 @@ class ReactionImage "unicorn" => "emoji/emoji-one-unicorn.png", "hands" => "emoji/emoji-one-hands.png", "thinking" => "emoji/emoji-one-thinking.png", - "readinglist" => "emoji/emoji-one-bookmark.png", + "readinglist" => "emoji/emoji-one-bookmark.png" }.freeze images[category] end diff --git a/app/labor/rss_reader.rb b/app/labor/rss_reader.rb index 187fb423f..0bd344879 100644 --- a/app/labor/rss_reader.rb +++ b/app/labor/rss_reader.rb @@ -69,7 +69,7 @@ class RssReader published_from_feed: true, show_comments: true, body_markdown: assemble_body_markdown(item, user, feed, feed_source_url), - organization_id: user.organization_id.present? ? user.organization_id : nil, + organization_id: user.organization_id.present? ? user.organization_id : nil } article = Article.create!(article_params) SlackBot.delay.ping( diff --git a/app/labor/user_states.rb b/app/labor/user_states.rb index 0f7483669..2ae448692 100644 --- a/app/labor/user_states.rb +++ b/app/labor/user_states.rb @@ -13,7 +13,7 @@ class UserStates fill_out_your_profile: fill_out_your_profile, leave_your_first_reaction: leave_reactions, follow_your_first_dev: follow_people, - leave_your_first_comment: leave_comments, + leave_your_first_comment: leave_comments } end end diff --git a/app/liquid_tags/podcast_tag.rb b/app/liquid_tags/podcast_tag.rb index fc5825d72..5940b122f 100644 --- a/app/liquid_tags/podcast_tag.rb +++ b/app/liquid_tags/podcast_tag.rb @@ -7,7 +7,7 @@ class PodcastTag < LiquidTagBase itunes: "https://d.ibtimes.co.uk/en/full/1423047/itunes-12.png", overcast: "https://d2uzvmey2c90kn.cloudfront.net/img/logo.svg", android: "http://storage.googleapis.com/ix_choosemuse/uploads/2016/02/android-logo.png", - rss: "https://temenos.com/globalassets/img/marketplace/temenos/rss/rss.png", + rss: "https://temenos.com/globalassets/img/marketplace/temenos/rss/rss.png" }.freeze def initialize(_tag_name, link, _tokens) diff --git a/app/models/buffer_update.rb b/app/models/buffer_update.rb index c010f231c..a6ee00b56 100644 --- a/app/models/buffer_update.rb +++ b/app/models/buffer_update.rb @@ -25,7 +25,7 @@ class BufferUpdate < ApplicationRecord text, profile_ids: [ buffer_profile_id_code, - ], + ] }, ) end diff --git a/app/models/chat_channel.rb b/app/models/chat_channel.rb index 6505554cc..ac4c7f167 100644 --- a/app/models/chat_channel.rb +++ b/app/models/chat_channel.rb @@ -152,7 +152,7 @@ class ChatChannel < ApplicationRecord name: membership.user.name, last_opened_at: membership.last_opened_at, username: membership.user.username, - id: membership.user_id, + id: membership.user_id } end end diff --git a/app/models/feedback_message.rb b/app/models/feedback_message.rb index 127f03594..69f410fba 100644 --- a/app/models/feedback_message.rb +++ b/app/models/feedback_message.rb @@ -9,11 +9,11 @@ class FeedbackMessage < ApplicationRecord validates_presence_of :reported_url, :category, if: :abuse_report? validates :category, inclusion: { - in: ["spam", "other", "rude or vulgar", "harassment", "bug"], + in: ["spam", "other", "rude or vulgar", "harassment", "bug"] } validates :status, inclusion: { - in: ["Open", "Invalid", "Resolved"], + in: ["Open", "Invalid", "Resolved"] } def abuse_report? diff --git a/app/models/follow.rb b/app/models/follow.rb index 518dad8cf..19b3cee0f 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -21,7 +21,7 @@ class Follow < ApplicationRecord }, column_names: { ["follows.followable_type = ?", "User"] => "following_users_count", ["follows.followable_type = ?", "Organization"] => "following_orgs_count", - ["follows.followable_type = ?", "ActsAsTaggableOn::Tag"] => "following_tags_count", + ["follows.followable_type = ?", "ActsAsTaggableOn::Tag"] => "following_tags_count" } after_save :touch_user after_save :touch_user_followed_at diff --git a/app/models/job_opportunity.rb b/app/models/job_opportunity.rb index e110c291a..14318fd90 100644 --- a/app/models/job_opportunity.rb +++ b/app/models/job_opportunity.rb @@ -7,7 +7,7 @@ class JobOpportunity < ApplicationRecord "on_premise" => "In Office", "fully_remote" => "Fully Remote", "remote_optional" => "Remote Optional", - "on_premise_flexible" => "Mostly in Office but Flexible", + "on_premise_flexible" => "Mostly in Office but Flexible" } phrases[remoteness] end diff --git a/app/models/message.rb b/app/models/message.rb index f142e7024..204b4461c 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -35,7 +35,7 @@ class Message < ApplicationRecord vapid: { subject: "https://dev.to", public_key: ApplicationConfig["VAPID_PUBLIC_KEY"], - private_key: ApplicationConfig["VAPID_PRIVATE_KEY"], + private_key: ApplicationConfig["VAPID_PRIVATE_KEY"] }, ) end diff --git a/app/models/role.rb b/app/models/role.rb index f1f330626..791388745 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -29,7 +29,7 @@ class Role < ApplicationRecord chatroom_beta_tester banned_from_mentorship comment_banned - ), + ) } scopify end diff --git a/app/models/tweet.rb b/app/models/tweet.rb index 52a8ffa8b..8ab6ef396 100644 --- a/app/models/tweet.rb +++ b/app/models/tweet.rb @@ -106,7 +106,7 @@ class Tweet < ApplicationRecord iden = Identity.where(provider: "twitter").last(250).sample { token: iden&.token || ApplicationConfig["TWITTER_KEY"], - secret: iden&.secret || ApplicationConfig["TWITTER_SECRET"], + secret: iden&.secret || ApplicationConfig["TWITTER_SECRET"] } end end diff --git a/app/services/membership_service.rb b/app/services/membership_service.rb index 2c5eb0035..f437eefa9 100644 --- a/app/services/membership_service.rb +++ b/app/services/membership_service.rb @@ -48,7 +48,7 @@ class MembershipService def update_stripe_plan_for_subscription subscription.items = [{ id: subscription.items.data[0].id, - plan: plan.id, + plan: plan.id }] subscription.save end diff --git a/config/environments/development.rb b/config/environments/development.rb index 6f5e66753..ff001e99d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -26,7 +26,7 @@ Rails.application.configure do config.cache_store = :memory_store config.public_file_server.headers = { - "Cache-Control" => "public, max-age=172800", + "Cache-Control" => "public, max-age=172800" } else config.action_controller.perform_caching = false @@ -75,7 +75,7 @@ Rails.application.configure do user_name: '<%= ENV["DEVELOPMENT_EMAIL_USERNAME"] %>', password: '<%= ENV["DEVELOPMENT_EMAIL_PASSWORD"] %>', authentication: :plain, - domain: "localhost:3000", + domain: "localhost:3000" } config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews" diff --git a/config/environments/production.rb b/config/environments/production.rb index 93fd3faac..6879edc88 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -30,7 +30,7 @@ Rails.application.configure do # Apache or NGINX already handles this. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? config.public_file_server.headers = { - "Cache-Control" => "public, s-maxage=2592000, max-age=86400", + "Cache-Control" => "public, s-maxage=2592000, max-age=86400" } # Compress JavaScripts and CSS. @@ -120,7 +120,7 @@ Rails.application.configure do user_name: ENV["SENDGRID_USERNAME_ACCEL"], password: ENV["SENDGRID_PASSWORD_ACCEL"], domain: "dev.to", - enable_starttls_auto: true, + enable_starttls_auto: true } config.middleware.use Rack::HostRedirect, diff --git a/config/environments/test.rb b/config/environments/test.rb index 8f925aee3..54827f516 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -20,7 +20,7 @@ Rails.application.configure do # Configure static file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - "Cache-Control" => "public, max-age=3600", + "Cache-Control" => "public, max-age=3600" } # Show full error reports and disable caching. diff --git a/config/initializers/algoliasearch.rb b/config/initializers/algoliasearch.rb index 273a7152d..96be09be9 100644 --- a/config/initializers/algoliasearch.rb +++ b/config/initializers/algoliasearch.rb @@ -1,6 +1,6 @@ AlgoliaSearch.configuration = { application_id: ApplicationConfig["ALGOLIASEARCH_APPLICATION_ID"], - api_key: ApplicationConfig["ALGOLIASEARCH_API_KEY"], + api_key: ApplicationConfig["ALGOLIASEARCH_API_KEY"] } if Rails.env.test? @@ -15,7 +15,7 @@ else "ordered_articles_by_published_at_#{Rails.env}", "ordered_articles_by_positive_reactions_count_#{Rails.env}", "ordered_comments_#{Rails.env}", - ].join(","), + ].join(",") } secured_algolia_key = Algolia.generate_secured_api_key( ApplicationConfig["ALGOLIASEARCH_SEARCH_ONLY_KEY"], params diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 5536f5006..9e191ac15 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -12,7 +12,7 @@ CarrierWave.configure do |config| provider: "AWS", aws_access_key_id: ApplicationConfig["AWS_ID"], aws_secret_access_key: ApplicationConfig["AWS_SECRET"], - region: "us-east-1", + region: "us-east-1" } config.fog_directory = ApplicationConfig["AWS_BUCKET_NAME"] end diff --git a/config/initializers/persistent_csrf_token_cookie.rb b/config/initializers/persistent_csrf_token_cookie.rb index 2890225bc..b019ec030 100644 --- a/config/initializers/persistent_csrf_token_cookie.rb +++ b/config/initializers/persistent_csrf_token_cookie.rb @@ -21,7 +21,7 @@ module ActionController cookies.encrypted[COOKIE_NAME] ||= { value: csrf_token, expires: 1.year.from_now, - httponly: true, + httponly: true } session[:_csrf_token] = csrf_token Base64.strict_decode64(csrf_token) diff --git a/config/initializers/redcarpet.rb b/config/initializers/redcarpet.rb index 866baabf0..51660959e 100644 --- a/config/initializers/redcarpet.rb +++ b/config/initializers/redcarpet.rb @@ -7,5 +7,5 @@ strikethrough: true, superscript: true, tables: true, - footnotes: true, + footnotes: true }.freeze diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb index 26abbd47f..c9152e44f 100644 --- a/config/initializers/stripe.rb +++ b/config/initializers/stripe.rb @@ -1,6 +1,6 @@ Rails.configuration.stripe = { publishable_key: ApplicationConfig["STRIPE_PUBLISHABLE_KEY"], - secret_key: ApplicationConfig["STRIPE_SECRET_KEY"], + secret_key: ApplicationConfig["STRIPE_SECRET_KEY"] } Stripe.api_key = Rails.configuration.stripe[:secret_key] diff --git a/config/routes.rb b/config/routes.rb index 84f1b4081..d64bea5f2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ Rails.application.routes.draw do devise_for :users, controllers: { omniauth_callbacks: "omniauth_callbacks", session: "sessions", - registrations: "registrations", + registrations: "registrations" } devise_scope :user do @@ -226,7 +226,7 @@ Rails.application.routes.draw do get "/dashboard" => "dashboards#show" get "/dashboard/:which" => "dashboards#show", constraints: { - which: /organization|user_followers|following_users|reading/, + which: /organization|user_followers|following_users|reading/ } get "/dashboard/:username" => "dashboards#show" diff --git a/db/seeds.rb b/db/seeds.rb index 55a443bcd..1e4e4e57a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -107,7 +107,7 @@ Comment.clear_index! body_markdown: Faker::Hipster.paragraph(1), user_id: User.order("RANDOM()").first.id, commentable_id: Article.order("RANDOM()").first.id, - commentable_type: "Article", + commentable_type: "Article" } Comment.create!(attributes) end @@ -131,7 +131,7 @@ podcast_objects = [ main_color_hex: "111111", overcast_url: "https://overcast.fm/itunes769189585/coding-blocks-software-and-web-programming-security-best-practices-microsoft-net", # rubocop:disable Metrics/LineLength android_url: "http://subscribeonandroid.com/feeds.podtrac.com/c8yBGHRafqhz", - image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"), + image: Rack::Test::UploadedFile.new(image_file, "image/jpeg") }, { title: "Talk Python", @@ -143,7 +143,7 @@ podcast_objects = [ main_color_hex: "181a1c", overcast_url: "https://overcast.fm/itunes979020229/talk-python-to-me-python-conversations-for-passionate-developers", # rubocop:disable Metrics/LineLength android_url: "https://subscribeonandroid.com/talkpython.fm/episodes/rss", - image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"), + image: Rack::Test::UploadedFile.new(image_file, "image/jpeg") }, { title: "Developer on Fire", @@ -156,7 +156,7 @@ podcast_objects = [ main_color_hex: "", overcast_url: "https://overcast.fm/itunes1006105326/developer-on-fire", android_url: "http://subscribeonandroid.com/developeronfire.com/rss.xml", - image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"), + image: Rack::Test::UploadedFile.new(image_file, "image/jpeg") }, { title: "Building Programmers", @@ -169,7 +169,7 @@ podcast_objects = [ main_color_hex: "140837", overcast_url: "https://overcast.fm/itunes1149043456/building-programmers", android_url: "https://subscribeonandroid.com/building.fireside.fm/rss", - image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"), + image: Rack::Test::UploadedFile.new(image_file, "image/jpeg") }, ] diff --git a/spec/labor/mailchimp_bot_spec.rb b/spec/labor/mailchimp_bot_spec.rb index 57acebaed..99a88e597 100644 --- a/spec/labor/mailchimp_bot_spec.rb +++ b/spec/labor/mailchimp_bot_spec.rb @@ -35,9 +35,9 @@ RSpec.describe MailchimpBot do EXPERIENCE: user.experience_level || 666, COUNTRY: user.shipping_country.to_s, STATE: user.shipping_state.to_s, - POSTAL_ZIP: user.shipping_postal_code.to_s, - }, - }, + POSTAL_ZIP: user.shipping_postal_code.to_s + } + } } end diff --git a/spec/labor/podcast_feed_spec.rb b/spec/labor/podcast_feed_spec.rb index 9cfc62d06..ad13a7ddb 100644 --- a/spec/labor/podcast_feed_spec.rb +++ b/spec/labor/podcast_feed_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" vcr_option = { cassette_name: "se_daily_rss_feed", - allow_playback_repeats: "true", + allow_playback_repeats: "true" } RSpec.describe PodcastFeed, vcr: vcr_option do diff --git a/spec/labor/rss_reader_spec.rb b/spec/labor/rss_reader_spec.rb index e8d9f9b38..b5e779c76 100644 --- a/spec/labor/rss_reader_spec.rb +++ b/spec/labor/rss_reader_spec.rb @@ -3,7 +3,7 @@ require "rss" vcr_option = { cassette_name: "rss_feeds", - allow_playback_repeats: "true", + allow_playback_repeats: "true" } RSpec.describe RssReader, vcr: vcr_option do diff --git a/spec/liquid_tags/github_tag/github_issue_tag_spec.rb b/spec/liquid_tags/github_tag/github_issue_tag_spec.rb index 76df8d549..a86ef73f7 100644 --- a/spec/liquid_tags/github_tag/github_issue_tag_spec.rb +++ b/spec/liquid_tags/github_tag/github_issue_tag_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" vcr_option = { cassette_name: "github_api", - allow_playback_repeats: "true", + allow_playback_repeats: "true" } RSpec.describe GithubTag::GithubIssueTag, vcr: vcr_option do diff --git a/spec/liquid_tags/github_tag/github_readme_tag_spec.rb b/spec/liquid_tags/github_tag/github_readme_tag_spec.rb index 051643464..1ced87a84 100644 --- a/spec/liquid_tags/github_tag/github_readme_tag_spec.rb +++ b/spec/liquid_tags/github_tag/github_readme_tag_spec.rb @@ -4,7 +4,7 @@ require "rails_helper" vcr_option = { cassette_name: "github_api_readme", - allow_playback_repeats: "true", + allow_playback_repeats: "true" } RSpec.describe GithubTag::GithubReadmeTag, vcr: vcr_option do diff --git a/spec/mailers/notify_mailer_spec.rb b/spec/mailers/notify_mailer_spec.rb index d8aa3f01b..a98c4c3f1 100644 --- a/spec/mailers/notify_mailer_spec.rb +++ b/spec/mailers/notify_mailer_spec.rb @@ -79,7 +79,7 @@ RSpec.describe NotifyMailer, type: :mailer do email_subject: "dev.to Status Update", email_body: "You've violated our code of conduct", email_type: "Reporter", - feedback_message_id: feedback_message_id, + feedback_message_id: feedback_message_id } end diff --git a/spec/models/tweet_spec.rb b/spec/models/tweet_spec.rb index 6b26a76d2..f5ca97bec 100644 --- a/spec/models/tweet_spec.rb +++ b/spec/models/tweet_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" vcr_option = { cassette_name: "twitter_gem", - allow_playback_repeats: "true", + allow_playback_repeats: "true" } RSpec.describe Tweet, type: :model, vcr: vcr_option do diff --git a/spec/requests/articles_create_spec.rb b/spec/requests/articles_create_spec.rb index b6492a682..4df62ffe8 100644 --- a/spec/requests/articles_create_spec.rb +++ b/spec/requests/articles_create_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "ArticlesCreate", type: :request do it "creates ordinary article with proper params" do new_title = "NEW TITLE #{rand(100)}" post "/articles", params: { - article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" }, + article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" } } expect(Article.last.user_id).to eq(user.id) end @@ -20,8 +20,8 @@ RSpec.describe "ArticlesCreate", type: :request do post "/articles", params: { article: { body_markdown: "---\ntitle: hey hey hahuu\npublished: false\n---\nYo ho ho#{rand(100)}", - tag_list: "yo", - }, + tag_list: "yo" + } } expect(Article.last.title).to eq("hey hey hahuu") end @@ -34,7 +34,7 @@ RSpec.describe "ArticlesCreate", type: :request do title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yoyo", job_opportunity: { remoteness: "on_premise" } - }, + } } end .to raise_error(RuntimeError) end @@ -46,7 +46,7 @@ RSpec.describe "ArticlesCreate", type: :request do title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "hiring", job_opportunity: { remoteness: "on_premise" } - }, + } } expect(Article.last.job_opportunity.remoteness).to eq("on_premise") end diff --git a/spec/requests/articles_update_spec.rb b/spec/requests/articles_update_spec.rb index 4ae63e3de..2e8f1dafd 100644 --- a/spec/requests/articles_update_spec.rb +++ b/spec/requests/articles_update_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "ArticlesUpdate", type: :request do it "updates ordinary article with proper params" do new_title = "NEW TITLE #{rand(100)}" put "/articles/#{article.id}", params: { - article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" }, + article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" } } expect(Article.last.title).to eq(new_title) end @@ -23,7 +23,7 @@ RSpec.describe "ArticlesUpdate", type: :request do article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo", job_opportunity: { remoteness: "on_premise" } - }, + } } expect(JobOpportunity.count).to eq(0) end @@ -34,7 +34,7 @@ RSpec.describe "ArticlesUpdate", type: :request do article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "hiring", job_opportunity: { remoteness: "on_premise" } - }, + } } expect(Article.last.job_opportunity.remoteness).to eq("on_premise") end diff --git a/spec/requests/blocks_spec.rb b/spec/requests/blocks_spec.rb index 4bc71d0bd..023a01c1f 100644 --- a/spec/requests/blocks_spec.rb +++ b/spec/requests/blocks_spec.rb @@ -20,8 +20,8 @@ RSpec.describe "Blocks", type: :request do block: { input_css: ".blue { color: blue;}", input_html: "yo", - input_javascript: "alert('hey')", - }, + input_javascript: "alert('hey')" + } } expect(Block.all.size).to eq(1) end @@ -33,7 +33,7 @@ RSpec.describe "Blocks", type: :request do put "/blocks/#{block.id}", params: { block: { input_css: ".blue { color: red;}", input_html: "yo", - input_javascript: "alert('hey')" }, + input_javascript: "alert('hey')" } } expect(Block.last.processed_css).to include("color: red") end diff --git a/spec/requests/chat_channel_memberships_spec.rb b/spec/requests/chat_channel_memberships_spec.rb index 5f75905ec..a2efc9b6e 100644 --- a/spec/requests/chat_channel_memberships_spec.rb +++ b/spec/requests/chat_channel_memberships_spec.rb @@ -18,7 +18,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do post "/chat_channel_memberships", params: { chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id - }, + } } expect(ChatChannelMembership.all.size).to eq(mems_num + 1) expect(ChatChannelMembership.last.status).to eq("pending") @@ -29,7 +29,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do post "/chat_channel_memberships", params: { chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id - }, + } } end.to raise_error(Pundit::NotAuthorizedError) end @@ -39,7 +39,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do before do user.add_role(:super_admin) post "/chat_channel_memberships", params: { - chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id }, + chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id } } end @@ -48,8 +48,8 @@ RSpec.describe "ChatChannelMemberships", type: :request do sign_in second_user put "/chat_channel_memberships/#{membership.id}", params: { chat_channel_membership: { - user_action: "accept", - }, + user_action: "accept" + } } expect(ChatChannelMembership.find(membership.id).status).to eq("active") end @@ -58,7 +58,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do membership = ChatChannelMembership.last sign_in second_user put "/chat_channel_memberships/#{membership.id}", params: { - chat_channel_membership: { user_action: "reject" }, + chat_channel_membership: { user_action: "reject" } } expect(ChatChannelMembership.find(membership.id).status).to eq("rejected") end @@ -67,7 +67,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do membership = ChatChannelMembership.last expect do put "/chat_channel_memberships/#{membership.id}", params: { - chat_channel_membership: { user_action: "accept" }, + chat_channel_membership: { user_action: "accept" } } expect(ChatChannelMembership.find(membership.id).status).to eq("active") end.to raise_error(Pundit::NotAuthorizedError) @@ -78,7 +78,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do before do user.add_role(:super_admin) post "/chat_channel_memberships", params: { - chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id }, + chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id } } end diff --git a/spec/requests/comments_create_spec.rb b/spec/requests/comments_create_spec.rb index 2b8526fdf..457b3a7bd 100644 --- a/spec/requests/comments_create_spec.rb +++ b/spec/requests/comments_create_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "CommentsCreate", type: :request do it "creates ordinary article with proper params" do new_body = "NEW BODY #{rand(100)}" post "/comments", params: { - comment: { body_markdown: new_body, commentable_id: article.id, commentable_type: "Article" }, + comment: { body_markdown: new_body, commentable_id: article.id, commentable_type: "Article" } } expect(Comment.last.user_id).to eq(user.id) end diff --git a/spec/requests/comments_update_spec.rb b/spec/requests/comments_update_spec.rb index fe923a25e..f5e71d1e8 100644 --- a/spec/requests/comments_update_spec.rb +++ b/spec/requests/comments_update_spec.rb @@ -12,7 +12,7 @@ RSpec.describe "CommentsUpdate", type: :request do it "updates ordinary article with proper params" do new_body = "NEW TITLE #{rand(100)}" put "/comments/#{comment.id}", params: { - comment: { body_markdown: new_body }, + comment: { body_markdown: new_body } } expect(Comment.last.processed_html).to include(new_body) end diff --git a/spec/requests/ga_events_spec.rb b/spec/requests/ga_events_spec.rb index 6e64574a3..1071ceab3 100644 --- a/spec/requests/ga_events_spec.rb +++ b/spec/requests/ga_events_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" vcr_option = { cassette_name: "ga_event", - allow_playback_repeats: "true", + allow_playback_repeats: "true" } RSpec.describe "GaEvents", type: :request, vcr: vcr_option do diff --git a/spec/requests/messages_spec.rb b/spec/requests/messages_spec.rb index bc6b47ddc..27b9852e8 100644 --- a/spec/requests/messages_spec.rb +++ b/spec/requests/messages_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "Messages", type: :request do { message_markdown: "hi", user_id: user.id, - chat_channel_id: chat_channel.id, + chat_channel_id: chat_channel.id } end diff --git a/spec/requests/organizations_update_spec.rb b/spec/requests/organizations_update_spec.rb index 7f53b1db7..ec6066271 100644 --- a/spec/requests/organizations_update_spec.rb +++ b/spec/requests/organizations_update_spec.rb @@ -13,7 +13,7 @@ RSpec.describe "OrganizationsUpdate", type: :request do it "updates ordinary article with proper params" do put "/organizations/#{organization.id}", params: { - organization: { text_color_hex: "#111111" }, + organization: { text_color_hex: "#111111" } } expect(Organization.last.text_color_hex).to eq("#111111") end diff --git a/spec/requests/podcast_episodes_api_spec.rb b/spec/requests/podcast_episodes_api_spec.rb index 8cc39fc48..3a6afdd48 100644 --- a/spec/requests/podcast_episodes_api_spec.rb +++ b/spec/requests/podcast_episodes_api_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" vcr_option = { cassette_name: "se_daily_rss_feed", - allow_playback_repeats: "true", + allow_playback_repeats: "true" } RSpec.describe "ArticlesApi", type: :request, vcr: vcr_option do diff --git a/spec/requests/pusher_auth_spec.rb b/spec/requests/pusher_auth_spec.rb index f4db32eb8..15c0321e0 100644 --- a/spec/requests/pusher_auth_spec.rb +++ b/spec/requests/pusher_auth_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "PusherAuth", type: :request do describe "POST /pusher/auth" do it "returns forbidden with invalid channel" do post "/pusher/auth", params: { - channel_name: "hey hey hey hey", + channel_name: "hey hey hey hey" } expect(response.body).to include("Forbidden") end diff --git a/spec/requests/reactions_spec.rb b/spec/requests/reactions_spec.rb index 213d24a49..1b26c5bbc 100644 --- a/spec/requests/reactions_spec.rb +++ b/spec/requests/reactions_spec.rb @@ -96,7 +96,7 @@ RSpec.describe "Reactions", type: :request do { reactable_id: article.id, reactable_type: "Article", - category: "like", + category: "like" } end diff --git a/spec/requests/stripe_subscriptions_spec.rb b/spec/requests/stripe_subscriptions_spec.rb index 46952172d..2f953c87d 100644 --- a/spec/requests/stripe_subscriptions_spec.rb +++ b/spec/requests/stripe_subscriptions_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "StripeSubscriptions", type: :request do before do post "/stripe_subscriptions", params: { amount: "12", - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } end @@ -44,7 +44,7 @@ RSpec.describe "StripeSubscriptions", type: :request do it "can't accept anything less than $1" do post "/stripe_subscriptions", params: { amount: rand(100) / 100, - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } expect(response).to redirect_to("/membership") user.reload @@ -95,14 +95,14 @@ RSpec.describe "StripeSubscriptions", type: :request do before do post "/stripe_subscriptions", params: { amount: "12", - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } end it "assigns the proper role with a new subscription" do put "/stripe_subscriptions/current_user", params: { amount: "30", - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } expect(user.has_role?("level_4_member")).to eq(true) end @@ -110,7 +110,7 @@ RSpec.describe "StripeSubscriptions", type: :request do it "updates the user's monthly_dues with the proper amount" do put "/stripe_subscriptions/current_user", params: { amount: "30", - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } user.reload expect(user.monthly_dues).to eq(3000) @@ -121,7 +121,7 @@ RSpec.describe "StripeSubscriptions", type: :request do allow(mock_instance).to receive(:update_subscription).and_return(nil) put "/stripe_subscriptions/current_user", params: { amount: "30", - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } expect(response).to redirect_to("/settings/membership") end @@ -141,21 +141,21 @@ RSpec.describe "StripeSubscriptions", type: :request do user.add_role(:level_2_member) post "/stripe_subscriptions", params: { amount: "12", - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } end context "when a valid request is made" do it "deletes membership" do delete "/stripe_subscriptions/current_user", params: { - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } expect(user.has_role?("level_2_member")).to eq(false) end it "returns user monthly dues to zero" do delete "/stripe_subscriptions/current_user", params: { - stripe_token: stripe_helper.generate_card_token, + stripe_token: stripe_helper.generate_card_token } user.reload expect(user.monthly_dues).to eq(0) diff --git a/spec/requests/tags_spec.rb b/spec/requests/tags_spec.rb index 3c197e253..a036e0979 100644 --- a/spec/requests/tags_spec.rb +++ b/spec/requests/tags_spec.rb @@ -89,7 +89,7 @@ RSpec.describe "Tags", type: :request, proper_status: true do it "displays proper error messages" do invalid_text_color_hex = "udjsadasfkdjsa" patch "/tag/#{tag.id}", params: { - tag: { text_color_hex: invalid_text_color_hex, bg_color_hex: "" }, + tag: { text_color_hex: invalid_text_color_hex, bg_color_hex: "" } } expect(response.body).to include("Text color hex is invalid") end diff --git a/spec/requests/videos_spec.rb b/spec/requests/videos_spec.rb index 53f64a876..b3d0bced6 100644 --- a/spec/requests/videos_spec.rb +++ b/spec/requests/videos_spec.rb @@ -44,8 +44,8 @@ RSpec.describe "Videos", type: :request do valid_params = { article: { - video: "something.mp4", - }, + video: "something.mp4" + } } xit "creates an article for the logged in user" do diff --git a/spec/services/user_role_service_spec.rb b/spec/services/user_role_service_spec.rb index a628b1193..ddca9baa1 100644 --- a/spec/services/user_role_service_spec.rb +++ b/spec/services/user_role_service_spec.rb @@ -85,7 +85,7 @@ RSpec.describe UserRoleService do note_params = { reason: "banned", content: "some reason", - noteable_type: "User", + noteable_type: "User" } it "updates a user's previous note" do diff --git a/spec/support/omniauth_macros.rb b/spec/support/omniauth_macros.rb index ba03e9b5e..3f2d57ccc 100644 --- a/spec/support/omniauth_macros.rb +++ b/spec/support/omniauth_macros.rb @@ -38,7 +38,7 @@ module OmniauthMacros uid: "1234567", info: INFO, extra: EXTRA_INFO, - credentials: CREDENTIAL, + credentials: CREDENTIAL } def mock_auth_hash