Routine rubocop fixes (#7885)

This commit is contained in:
rhymes 2020-05-18 10:27:51 +02:00 committed by GitHub
parent ed8893a734
commit decae056f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 25 additions and 9 deletions

View file

@ -31,6 +31,12 @@ Layout/DotPosition:
# TODO: [@thepracticaldev/oss] enable leading?
EnforcedStyle: trailing
Layout/EmptyLinesAroundAttributeAccessor:
Description: "Keep blank lines around attribute accessors."
StyleGuide: '#empty-lines-around-attribute-accessor'
Enabled: true
# Layout/FirstArrayElementLineBreak:
# Description: >-
# Checks for a line break before the first element in a
@ -321,6 +327,10 @@ Style/SingleLineBlockParams:
Description: 'Enforces the names of some block params.'
Enabled: true
Style/SlicingWithRange:
Description: 'Checks array slicing is done with endless ranges when suitable.'
Enabled: true
Style/StringLiterals:
Description: 'Checks if uses of quotes match the configured preference.'
StyleGuide: '#consistent-string-literals'

View file

@ -6,13 +6,13 @@ require:
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-05-08 12:21:06 +0200 using RuboCop version 0.82.0.
# on 2020-05-15 16:11:31 +0200 using RuboCop version 0.83.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
# versions of RuboCop, may require this file to be generated again.
# Offense count: 264
# Offense count: 266
# Configuration parameters: IgnoredMethods.
Metrics/AbcSize:
Max: 64
@ -41,7 +41,7 @@ RSpec/ExampleLength:
- 'spec/models/comment_spec.rb'
- 'spec/requests/display_ad_events_spec.rb'
# Offense count: 859
# Offense count: 872
RSpec/MultipleExpectations:
Max: 10
@ -95,7 +95,7 @@ Style/SingleLineBlockParams:
Exclude:
- 'app/labor/markdown_fixer.rb'
# Offense count: 5028
# Offense count: 5168
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https

View file

@ -1,5 +1,6 @@
class Bufferizer
attr_accessor :post_type, :post, :text
include ApplicationHelper
def initialize(post_type, post, text, admin_id = nil)

View file

@ -1,5 +1,6 @@
class ReadingList
attr_accessor :user
def initialize(user)
@user = user
end

View file

@ -1,5 +1,6 @@
class StickyArticleCollection
attr_accessor :article, :author, :reaction_count_num, :comment_count_num
def initialize(article, author)
@article = article
@author = author

View file

@ -2,6 +2,7 @@ require "uri"
class GlitchTag < LiquidTagBase
attr_accessor :uri
PARTIAL = "liquids/glitch".freeze
ID_REGEXP = /\A[a-zA-Z0-9\-]{1,110}\z/.freeze
OPTION_REGEXP = /(app|code|no-files|preview-first|no-attribution|file\=\w(\.\w)?)/.freeze

View file

@ -3,6 +3,7 @@ class MediumTag < LiquidTagBase
include ActionView::Helpers::TagHelper
include InlineSvg::ActionView::Helpers
attr_reader :response
PARTIAL = "liquids/medium".freeze
def initialize(_tag_name, url, _tokens)

View file

@ -3,6 +3,7 @@ class PodcastTag < LiquidTagBase
include CloudinaryHelper
attr_reader :episode, :podcast
PARTIAL = "podcast_episodes/liquid".freeze
SCRIPT = <<~JAVASCRIPT.freeze

View file

@ -37,7 +37,7 @@ class SpotifyTag < LiquidTagBase
end
def generate_embed_link(parsed_uri)
parsed_uri.string.split(":")[1..-1].unshift("https://open.spotify.com/embed").join("/")
parsed_uri.string.split(":")[1..].unshift("https://open.spotify.com/embed").join("/")
end
def raise_error

View file

@ -85,7 +85,7 @@ class RssReader
def get_host_without_www(url)
url = "http://#{url}" if URI.parse(url).scheme.nil?
host = URI.parse(url).host.downcase
host.start_with?("www.") ? host[4..-1] : host
host.start_with?("www.") ? host[4..] : host
end
def medium_reply?(item)

View file

@ -13,7 +13,7 @@ RSpec.describe SpotifyTag, type: :liquid_tag do
end
def generate_iframe(uri, height)
parsed_uri = uri.split(":")[1..-1].unshift("https://open.spotify.com/embed").join("/")
parsed_uri = uri.split(":")[1..].unshift("https://open.spotify.com/embed").join("/")
<<~HTML
<iframe
width="100%"

View file

@ -23,7 +23,7 @@ RSpec.describe "Admin manages organizations", type: :system do
it "does not show the remove form when there are no credits" do
expect(page).to have_button("Add Org Credits")
#expect(page).to have_no_button("Remove Org Credits")
# expect(page).to have_no_button("Remove Org Credits")
end
end
end

View file

@ -49,7 +49,7 @@ RSpec.describe "Using the editor", type: :system do
it "user write and publish an article" do
fill_markdown_with(template.gsub("false", "true"))
find("button", text: /\ASAVE CHANGES\z/).click
["Sample Article", template[-200..-1], "test"].each do |text|
["Sample Article", template[-200..], "test"].each do |text|
expect(page).to have_text(text)
end
end