Upgrade rubocop and rubocop-performance (#2802) [ci skip]
This commit is contained in:
parent
419ee34866
commit
66ddcbca02
10 changed files with 34 additions and 42 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2019-04-10 05:04:16 +0200 using RuboCop version 0.67.2.
|
||||
# on 2019-05-14 00:36:38 +0200 using RuboCop version 0.69.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
|
||||
|
|
@ -10,9 +10,9 @@
|
|||
# Configuration parameters: CountComments, ExcludedMethods.
|
||||
# ExcludedMethods: refine
|
||||
Metrics/BlockLength:
|
||||
Max: 69
|
||||
Max: 63
|
||||
|
||||
# Offense count: 21
|
||||
# Offense count: 20
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 13
|
||||
|
||||
|
|
@ -21,52 +21,42 @@ RSpec/AnyInstance:
|
|||
Exclude:
|
||||
- 'spec/requests/stripe_cancellations_spec.rb'
|
||||
|
||||
# Offense count: 145
|
||||
# Offense count: 185
|
||||
# Configuration parameters: AggregateFailuresByDefault.
|
||||
RSpec/MultipleExpectations:
|
||||
Max: 6
|
||||
|
||||
# Offense count: 16
|
||||
# Offense count: 15
|
||||
Rails/OutputSafety:
|
||||
Exclude:
|
||||
- 'app/controllers/stripe_subscriptions_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/helpers/comments_helper.rb'
|
||||
- 'app/labor/markdown_parser.rb'
|
||||
- 'app/liquid_tags/dev_comment_tag.rb'
|
||||
- 'app/liquid_tags/github_tag/github_issue_tag.rb'
|
||||
- 'app/liquid_tags/liquid_tag_base.rb'
|
||||
- 'app/liquid_tags/tweet_tag.rb'
|
||||
- 'app/models/comment.rb'
|
||||
- 'app/models/display_ad.rb'
|
||||
- 'app/models/message.rb'
|
||||
- 'app/views/api/v0/articles/show.json.jbuilder'
|
||||
- 'app/views/articles/feed.rss.builder'
|
||||
|
||||
# Offense count: 15
|
||||
# Offense count: 17
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
||||
# SupportedStyles: nested, compact
|
||||
Style/ClassAndModuleChildren:
|
||||
Exclude:
|
||||
- 'app/controllers/api/v0/api_controller.rb'
|
||||
- 'app/controllers/internal/application_controller.rb'
|
||||
- 'app/controllers/internal/articles_controller.rb'
|
||||
- 'app/controllers/internal/broadcasts_controller.rb'
|
||||
- 'app/controllers/internal/buffer_updates_controller.rb'
|
||||
- 'app/controllers/internal/comments_controller.rb'
|
||||
- 'app/controllers/internal/dogfood_controller.rb'
|
||||
- 'app/controllers/internal/feedback_messages_controller.rb'
|
||||
- 'app/controllers/internal/members_controller.rb'
|
||||
- 'app/controllers/internal/reactions_controller.rb'
|
||||
- 'app/controllers/internal/tags_controller.rb'
|
||||
- 'app/controllers/internal/users_controller.rb'
|
||||
- 'app/controllers/internal/welcome_controller.rb'
|
||||
- 'app/controllers/notifications/counts_controller.rb'
|
||||
- 'app/controllers/notifications/reads_controller.rb'
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1754
|
||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# Offense count: 1
|
||||
# Configuration parameters: MinBodyLength.
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
- 'app/models/article.rb'
|
||||
|
||||
# Offense count: 2101
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Metrics/LineLength:
|
||||
Max: 279
|
||||
Max: 278
|
||||
|
|
|
|||
2
Gemfile
2
Gemfile
|
|
@ -117,9 +117,9 @@ group :development do
|
|||
gem "pry", "~> 0.12" # An IRB alternative and runtime developer console
|
||||
gem "pry-rails", "~> 0.3" # Use Pry as your rails console
|
||||
gem "web-console", "~> 3.7" # Rails Console on the Browser
|
||||
gem "yard", "~> 0.9.19" # YARD is a documentation generation tool for the Ruby programming language
|
||||
gem "yard-activerecord", "~> 0.0.16" # YARD extension that handles and interprets methods used when developing applications with ActiveRecord
|
||||
gem "yard-activesupport-concern", "~> 0.0.1" # YARD extension that brings support for modules making use of ActiveSupport::Concern
|
||||
gem "yard", "~> 0.9.19" # YARD is a documentation generation tool for the Ruby programming language
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
|
|
|||
|
|
@ -646,8 +646,8 @@ GEM
|
|||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
rubocop-performance (1.1.0)
|
||||
rubocop (>= 0.67.0)
|
||||
rubocop-performance (1.3.0)
|
||||
rubocop (>= 0.68.0)
|
||||
rubocop-rspec (1.33.0)
|
||||
rubocop (>= 0.60.0)
|
||||
ruby-prof (0.17.0)
|
||||
|
|
|
|||
|
|
@ -104,14 +104,15 @@ class ArticlesController < ApplicationController
|
|||
if @article
|
||||
format.json { render json: @article.errors, status: :unprocessable_entity }
|
||||
else
|
||||
format.json { render json: {
|
||||
processed_html: processed_html,
|
||||
title: parsed["title"],
|
||||
tags: (Article.new.tag_list.add(parsed["tags"], parser: ActsAsTaggableOn::TagParser) if parsed["tags"]),
|
||||
cover_image: (ApplicationController.helpers.cloud_cover_url(parsed["cover_image"]) if parsed["cover_image"])
|
||||
},
|
||||
status: 200
|
||||
}
|
||||
format.json do
|
||||
render json: {
|
||||
processed_html: processed_html,
|
||||
title: parsed["title"],
|
||||
tags: (Article.new.tag_list.add(parsed["tags"], parser: ActsAsTaggableOn::TagParser) if parsed["tags"]),
|
||||
cover_image: (ApplicationController.helpers.cloud_cover_url(parsed["cover_image"]) if parsed["cover_image"])
|
||||
},
|
||||
status: 200
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
class ReadingListItemsController < ApplicationController
|
||||
|
||||
def index
|
||||
@reading_list_items_index = true
|
||||
set_view
|
||||
|
|
@ -9,6 +8,7 @@ class ReadingListItemsController < ApplicationController
|
|||
def update
|
||||
@reaction = Reaction.find(params[:id])
|
||||
raise if @reaction.user_id != current_user.id # Lazy but I'm tired. HACK
|
||||
|
||||
@reaction.status = params[:current_status] == "archived" ? "valid" : "archived"
|
||||
@reaction.save
|
||||
head :ok
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ class MarkdownParser
|
|||
next unless src
|
||||
# allow image to render as-is
|
||||
next if allowed_image_host?(src)
|
||||
|
||||
img["loading"] = "lazy"
|
||||
img["src"] = if giphy_img?(src)
|
||||
src.gsub("https://media.", "https://i.")
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ class Reaction < ApplicationRecord
|
|||
|
||||
def reactable_user
|
||||
return unless category == "readinglist"
|
||||
|
||||
{
|
||||
username: reactable.user_username,
|
||||
name: reactable.user_name,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class ArticleWithVideoCreationService
|
|||
|
||||
def create!
|
||||
Article.create! do |article|
|
||||
|
||||
article = initial_article_with_params(article)
|
||||
article.processed_html = ""
|
||||
article.user_id = @current_user.id
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ source "https://rubygems.org"
|
|||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
||||
|
||||
gem "activerecord", "~> 5.2.3" # Databases on Rails
|
||||
gem "yard", "~> 0.9.19" # YARD is a documentation generation tool for the Ruby programming language
|
||||
gem "yard-activerecord", "~> 0.0.16" # YARD extension that handles and interprets methods used when developing applications with ActiveRecord
|
||||
gem "yard-activesupport-concern", "~> 0.0.1" # YARD extension that brings support for modules making use of ActiveSupport::Concern
|
||||
gem "yard", "~> 0.9.19" # YARD is a documentation generation tool for the Ruby programming language
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ RSpec.describe "ReadingListItems", type: :request do
|
|||
expect(reaction.reload.status).to eq("archived")
|
||||
end
|
||||
it "unarchives an item if current_status is passed as archived" do
|
||||
put "/reading_list_items/#{reaction.id}", params: {current_status: "archived"}
|
||||
put "/reading_list_items/#{reaction.id}", params: { current_status: "archived" }
|
||||
expect(reaction.reload.status).to eq("valid")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue