Skip to content
Snippets Groups Projects
Commit baafd8de authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Style/BarePercentLiterals

parent d78513cb
No related branches found
No related tags found
No related merge requests found
Showing
with 31 additions and 34 deletions
Loading
Loading
@@ -950,6 +950,10 @@ Security/JSONLoad:
Style/AlignParameters:
Enabled: false
 
Style/BarePercentLiterals:
Enabled: true
EnforcedStyle: bare_percent
Style/CaseEquality:
Enabled: false
 
Loading
Loading
Loading
Loading
@@ -38,13 +38,6 @@ RSpec/SingleArgumentMessageChain:
Exclude:
- 'spec/requests/api/internal_spec.rb'
 
# Offense count: 55
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: percent_q, bare_percent
Style/BarePercentLiterals:
Enabled: false
# Offense count: 399
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Loading
Loading
Loading
Loading
@@ -155,7 +155,7 @@ module CommitsHelper
 
text =
if options[:avatar]
%Q{<span class="commit-#{options[:source]}-name">#{person_name}</span>}
%{<span class="commit-#{options[:source]}-name">#{person_name}</span>}
else
person_name
end
Loading
Loading
Loading
Loading
@@ -255,7 +255,7 @@ class Commit
end
 
def revert_message(user)
%Q{Revert "#{title.strip}"\n\n#{revert_description(user)}}
%{Revert "#{title.strip}"\n\n#{revert_description(user)}}
end
 
def reverts_commit?(commit, user)
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@ class MigrateUsersNotificationLevel < ActiveRecord::Migration
# creating a new record on notification settings table
 
def up
execute(%Q{
execute(%{
INSERT INTO notification_settings
(user_id, level, created_at, updated_at)
(SELECT id, notification_level, created_at, updated_at FROM users WHERE notification_level != 1)
Loading
Loading
@@ -13,7 +13,7 @@ class MigrateUsersNotificationLevel < ActiveRecord::Migration
# Migrates from notification settings back to user notification_level
# If no value is found the default level of 1 will be used
def down
execute(%Q{
execute(%{
UPDATE users u SET
notification_level = COALESCE((SELECT level FROM notification_settings WHERE user_id = u.id AND source_type IS NULL), 1)
})
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ class MigrateProjectFeatures < ActiveRecord::Migration
 
def up
sql =
%Q{
%{
INSERT INTO project_features(project_id, issues_access_level, merge_requests_access_level, wiki_access_level,
builds_access_level, snippets_access_level, created_at, updated_at)
SELECT
Loading
Loading
@@ -29,7 +29,7 @@ class MigrateProjectFeatures < ActiveRecord::Migration
end
 
def down
sql = %Q{
sql = %{
UPDATE projects
SET
issues_enabled = COALESCE((SELECT CASE WHEN issues_access_level = 20 THEN true ELSE false END AS issues_enabled FROM project_features WHERE project_features.project_id = projects.id), true),
Loading
Loading
Loading
Loading
@@ -27,6 +27,6 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
def expect_badge(status)
svg = Nokogiri::XML.parse(page.body)
expect(page.response_headers['Content-Type']).to include('image/svg+xml')
expect(svg.at(%Q{text:contains("#{status}")})).to be_truthy
expect(svg.at(%{text:contains("#{status}")})).to be_truthy
end
end
Loading
Loading
@@ -32,7 +32,7 @@ module Banzai
IGNORE_PARENTS = %w(a code kbd pre script style).to_set
 
# The XPath query to use for finding text nodes to parse.
TEXT_QUERY = %Q(descendant-or-self::text()[
TEXT_QUERY = %(descendant-or-self::text()[
not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')})
and contains(., '://')
and not(starts-with(., 'http'))
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ module Banzai
attributes[:reference_type] ||= self.class.reference_type
attributes.delete(:original) if context[:no_original_data]
attributes.map do |key, value|
%Q(data-#{key.to_s.dasherize}="#{escape_once(value)}")
%(data-#{key.to_s.dasherize}="#{escape_once(value)}")
end.join(' ')
end
 
Loading
Loading
@@ -76,7 +76,7 @@ module Banzai
def each_node
return to_enum(__method__) unless block_given?
 
query = %Q{descendant-or-self::text()[not(#{ignore_ancestor_query})]
query = %{descendant-or-self::text()[not(#{ignore_ancestor_query})]
| descendant-or-self::a[
not(contains(concat(" ", @class, " "), " gfm ")) and not(@href = "")
]}
Loading
Loading
Loading
Loading
@@ -43,7 +43,7 @@ module Banzai
end
end
 
result[:toc] = %Q{<ul class="section-nav">\n#{result[:toc]}</ul>} unless result[:toc].empty?
result[:toc] = %{<ul class="section-nav">\n#{result[:toc]}</ul>} unless result[:toc].empty?
 
doc
end
Loading
Loading
@@ -51,11 +51,11 @@ module Banzai
private
 
def anchor_tag(id, href)
%Q{<a id="#{id}" class="anchor" href="##{href}" aria-hidden="true"></a>}
%{<a id="#{id}" class="anchor" href="##{href}" aria-hidden="true"></a>}
end
 
def push_toc(href, text)
result[:toc] << %Q{<li><a href="##{href}">#{text}</a></li>\n}
result[:toc] << %{<li><a href="##{href}">#{text}</a></li>\n}
end
end
end
Loading
Loading
Loading
Loading
@@ -100,13 +100,13 @@ module Gitlab
end
 
def extract_epoch(arel_attribute)
Arel.sql(%Q{EXTRACT(EPOCH FROM "#{arel_attribute.relation.name}"."#{arel_attribute.name}")})
Arel.sql(%{EXTRACT(EPOCH FROM "#{arel_attribute.relation.name}"."#{arel_attribute.name}")})
end
 
def extract_diff_epoch(diff)
return diff unless Gitlab::Database.postgresql?
 
Arel.sql(%Q{EXTRACT(EPOCH FROM (#{diff.to_sql}))})
Arel.sql(%{EXTRACT(EPOCH FROM (#{diff.to_sql}))})
end
# Need to cast '0' to an INTERVAL before we can check if the interval is positive
def zero_interval
Loading
Loading
Loading
Loading
@@ -77,6 +77,6 @@ feature 'test coverage badge' do
def expect_coverage_badge(coverage)
svg = Nokogiri::XML.parse(page.body)
expect(page.response_headers['Content-Type']).to include('image/svg+xml')
expect(svg.at(%Q{text:contains("#{coverage}")})).to be_truthy
expect(svg.at(%{text:contains("#{coverage}")})).to be_truthy
end
end
Loading
Loading
@@ -13,7 +13,7 @@ feature 'issuable templates', feature: true, js: true do
 
context 'user creates an issue using templates' do
let(:template_content) { 'this is a test "bug" template' }
let(:longtemplate_content) { %Q(this\n\n\n\n\nis\n\n\n\n\na\n\n\n\n\nbug\n\n\n\n\ntemplate) }
let(:longtemplate_content) { %(this\n\n\n\n\nis\n\n\n\n\na\n\n\n\n\nbug\n\n\n\n\ntemplate) }
let(:issue) { create(:issue, author: user, assignee: user, project: project) }
let(:description_addition) { ' appending to description' }
 
Loading
Loading
Loading
Loading
@@ -154,7 +154,7 @@ describe 'Pipelines', :feature, :js do
it 'contains badge with tooltip which contains error' do
expect(pipeline).to have_yaml_errors
expect(page).to have_selector(
%Q{span[data-original-title="#{pipeline.yaml_errors}"]})
%{span[data-original-title="#{pipeline.yaml_errors}"]})
end
end
 
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@ describe BlobHelper do
end
 
it 'highlights single block' do
expected = %Q[<pre class="code highlight"><code><span id="LC1" class="line"><span class="p">(</span><span class="nb">make-pathname</span> <span class="ss">:defaults</span> <span class="nv">name</span></span>
expected = %[<pre class="code highlight"><code><span id="LC1" class="line"><span class="p">(</span><span class="nb">make-pathname</span> <span class="ss">:defaults</span> <span class="nv">name</span></span>
<span id="LC2" class="line"><span class="ss">:type</span> <span class="s">"assem"</span><span class="p">))</span></span></code></pre>]
 
expect(helper.highlight(blob_name, blob_content)).to eq(expected)
Loading
Loading
Loading
Loading
@@ -107,13 +107,13 @@ describe GitlabMarkdownHelper do
it 'ignores reference links when they are the entire body' do
text = issues[0].to_reference
act = helper.link_to_gfm(text, '/foo')
expect(act).to eq %Q(<a href="/foo">#{issues[0].to_reference}</a>)
expect(act).to eq %(<a href="/foo">#{issues[0].to_reference}</a>)
end
 
it 'replaces commit message with emoji to link' do
actual = link_to_gfm(':book:Book', '/foo')
expect(actual).
to eq %Q(<img class="emoji" title=":book:" alt=":book:" src="http://#{Gitlab.config.gitlab.host}/assets/1F4D6.png" height="20" width="20" align="absmiddle"><a href="/foo">Book</a>)
to eq %(<img class="emoji" title=":book:" alt=":book:" src="http://#{Gitlab.config.gitlab.host}/assets/1F4D6.png" height="20" width="20" align="absmiddle"><a href="/foo">Book</a>)
end
end
 
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do
 
it 'skips internal links' do
internal = Gitlab.config.gitlab.url
exp = act = %Q(<a href="#{internal}/sign_in">Login</a>)
exp = act = %(<a href="#{internal}/sign_in">Login</a>)
expect(filter(act).to_html).to eq exp
end
 
Loading
Loading
@@ -70,8 +70,8 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do
it 'skips internal links' do
internal_link = Gitlab.config.gitlab.url + "/sign_in"
url = internal_link.gsub(/\Ahttp/, 'HtTp')
act = %Q(<a href="#{url}">Login</a>)
exp = %Q(<a href="#{internal_link}">Login</a>)
act = %(<a href="#{url}">Login</a>)
exp = %(<a href="#{internal_link}">Login</a>)
expect(filter(act).to_html).to eq(exp)
end
 
Loading
Loading
Loading
Loading
@@ -282,7 +282,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
end
 
describe 'referencing a label in a link href' do
let(:reference) { %Q{<a href="#{label.to_reference}">Label</a>} }
let(:reference) { %{<a href="#{label.to_reference}">Label</a>} }
 
it 'links to a valid reference' do
doc = reference_filter("See #{reference}")
Loading
Loading
Loading
Loading
@@ -117,7 +117,7 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
end
 
describe 'referencing a milestone in a link href' do
let(:reference) { %Q{<a href="#{milestone.to_reference}">Milestone</a>} }
let(:reference) { %{<a href="#{milestone.to_reference}">Milestone</a>} }
 
it 'links to a valid reference' do
doc = reference_filter("See #{reference}")
Loading
Loading
Loading
Loading
@@ -144,7 +144,7 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do
end
 
context 'referencing a user in a link href' do
let(:reference) { %Q{<a href="#{user.to_reference}">User</a>} }
let(:reference) { %{<a href="#{user.to_reference}">User</a>} }
 
it 'links to a User' do
doc = reference_filter("Hey #{reference}")
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment