mirror of
https://github.com/redmine/redmine.git
synced 2025-10-26 07:46:17 +01:00
Fix RuboCop offense Layout/SpaceAfterComma, one of the offenses enabled in rubocop-rails-omakase (#39887).
git-svn-id: https://svn.redmine.org/redmine/trunk@22953 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -108,24 +108,6 @@ Layout/MultilineMethodCallIndentation:
|
||||
Layout/MultilineOperationIndentation:
|
||||
Enabled: false
|
||||
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Layout/SpaceAfterComma:
|
||||
Exclude:
|
||||
- 'lib/redmine/configuration.rb'
|
||||
- 'lib/redmine/helpers/time_report.rb'
|
||||
- 'lib/redmine/imap.rb'
|
||||
- 'lib/redmine/pop3.rb'
|
||||
- 'lib/redmine/project_jump_box.rb'
|
||||
- 'lib/redmine/safe_attributes.rb'
|
||||
- 'lib/redmine/scm/adapters/cvs_adapter.rb'
|
||||
- 'lib/redmine/sort_criteria.rb'
|
||||
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
|
||||
- 'test/functional/imports_controller_test.rb'
|
||||
- 'test/integration/layout_test.rb'
|
||||
- 'test/system/timelog_test.rb'
|
||||
- 'test/unit/attachment_test.rb'
|
||||
- 'test/unit/lib/redmine/field_format/version_field_format_test.rb'
|
||||
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Layout/SpaceAfterNot:
|
||||
Exclude:
|
||||
|
||||
@@ -84,7 +84,7 @@ module Redmine
|
||||
def with(settings)
|
||||
settings.stringify_keys!
|
||||
load unless @config
|
||||
was = settings.keys.inject({}) {|h,v| h[v] = @config[v]; h}
|
||||
was = settings.keys.inject({}) {|h, v| h[v] = @config[v]; h}
|
||||
@config.merge! settings
|
||||
yield if block_given?
|
||||
@config.merge! was
|
||||
|
||||
@@ -28,7 +28,7 @@ module Redmine
|
||||
@criteria = criteria || []
|
||||
@criteria = @criteria.select{|criteria| available_criteria.has_key? criteria}
|
||||
@criteria.uniq!
|
||||
@criteria = @criteria[0,3]
|
||||
@criteria = @criteria[0, 3]
|
||||
|
||||
@columns = (columns && %w(year month week day).include?(columns)) ? columns : 'month'
|
||||
@scope = time_entry_scope
|
||||
@@ -77,7 +77,7 @@ module Redmine
|
||||
max = @hours.pluck('spent_on').max
|
||||
@to = max ? max.to_date : User.current.today
|
||||
|
||||
@total_hours = @hours.inject(0) {|s,k| s = s + k['hours'].to_f}
|
||||
@total_hours = @hours.inject(0) {|s, k| s = s + k['hours'].to_f}
|
||||
|
||||
@periods = []
|
||||
# Date#at_beginning_of_ not supported in Rails 1.2.x
|
||||
|
||||
@@ -36,7 +36,7 @@ module Redmine
|
||||
imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?
|
||||
imap.select(folder)
|
||||
imap.uid_search(['NOT', 'SEEN']).each do |uid|
|
||||
msg = imap.uid_fetch(uid,'RFC822')[0].attr['RFC822']
|
||||
msg = imap.uid_fetch(uid, 'RFC822')[0].attr['RFC822']
|
||||
logger.debug "Receiving message #{uid}" if logger && logger.debug?
|
||||
if MailHandler.safe_receive(msg, options)
|
||||
logger.debug "Message #{uid} successfully received" if logger && logger.debug?
|
||||
|
||||
@@ -40,7 +40,7 @@ module Redmine
|
||||
apop = (pop_options[:apop].to_s == '1')
|
||||
delete_unprocessed = (pop_options[:delete_unprocessed].to_s == '1')
|
||||
|
||||
pop = Net::POP3.APOP(apop).new(host,port)
|
||||
pop = Net::POP3.APOP(apop).new(host, port)
|
||||
logger.debug "Connecting to #{host}..." if logger && logger.debug?
|
||||
pop.start(pop_options[:username], pop_options[:password]) do |pop_session|
|
||||
if pop_session.mails.empty?
|
||||
|
||||
@@ -77,7 +77,7 @@ module Redmine
|
||||
end
|
||||
|
||||
def recently_used_project_ids
|
||||
pref_project_ids(:recently_used_project_ids)[0,recent_projects_count]
|
||||
pref_project_ids(:recently_used_project_ids)[0, recent_projects_count]
|
||||
end
|
||||
|
||||
def recently_used_project_ids=(new_ids)
|
||||
|
||||
@@ -76,7 +76,7 @@ module Redmine
|
||||
# # => {'title' => 'My book'}
|
||||
def delete_unsafe_attributes(attrs, user=User.current)
|
||||
safe = safe_attribute_names(user)
|
||||
attrs.dup.delete_if {|k,v| !safe.include?(k.to_s)}
|
||||
attrs.dup.delete_if {|k, v| !safe.include?(k.to_s)}
|
||||
end
|
||||
|
||||
# Sets attributes from attrs that are safe
|
||||
|
||||
@@ -94,7 +94,7 @@ module Redmine
|
||||
cmd_args << path_with_proj(path)
|
||||
scm_cmd(*cmd_args) do |io|
|
||||
io.each_line() do |line|
|
||||
fields = line.chop.split('/',-1)
|
||||
fields = line.chop.split('/', -1)
|
||||
logger.debug(">>InspectLine #{fields.inspect}")
|
||||
if fields[0]!="D"
|
||||
time = nil
|
||||
@@ -362,11 +362,11 @@ module Redmine
|
||||
end
|
||||
|
||||
def normalize_cvs_path(path)
|
||||
normalize_path(path.gsub("Attic/",''))
|
||||
normalize_path(path.gsub("Attic/", ''))
|
||||
end
|
||||
|
||||
def normalize_path(path)
|
||||
path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
|
||||
path.sub(/^(\/)*(.*)/, '\2').sub(/(.*)(,v)+/, '\1')
|
||||
end
|
||||
|
||||
def path_with_proj(path)
|
||||
|
||||
@@ -34,7 +34,7 @@ module Redmine
|
||||
end
|
||||
|
||||
def to_param
|
||||
self.collect {|k,o| k + (o == 'desc' ? ':desc' : '')}.join(',')
|
||||
self.collect {|k, o| k + (o == 'desc' ? ':desc' : '')}.join(',')
|
||||
end
|
||||
|
||||
def to_a
|
||||
@@ -43,7 +43,7 @@ module Redmine
|
||||
|
||||
def add!(key, asc)
|
||||
key = key.to_s
|
||||
delete_if {|k,o| k == key}
|
||||
delete_if {|k, o| k == key}
|
||||
prepend([key, asc])
|
||||
normalize!
|
||||
end
|
||||
@@ -74,10 +74,10 @@ module Redmine
|
||||
|
||||
def sort_clause(sortable_columns)
|
||||
if sortable_columns.is_a?(Array)
|
||||
sortable_columns = sortable_columns.inject({}) {|h,k| h[k]=k; h}
|
||||
sortable_columns = sortable_columns.inject({}) {|h, k| h[k]=k; h}
|
||||
end
|
||||
|
||||
sql = self.collect do |k,o|
|
||||
sql = self.collect do |k, o|
|
||||
if s = sortable_columns[k]
|
||||
s = [s] unless s.is_a?(Array)
|
||||
s.collect {|c| append_order(c, o)}
|
||||
|
||||
@@ -563,7 +563,7 @@ class RedCloth3 < String
|
||||
depth = []
|
||||
lines.each_with_index do |line, line_id|
|
||||
if line =~ LISTS_CONTENT_RE
|
||||
tl,atts,content = $~[1..3]
|
||||
tl, atts, content = $~[1..3]
|
||||
if depth.last
|
||||
if depth.last.length > tl.length
|
||||
(depth.length - 1).downto(0) do |i|
|
||||
@@ -608,7 +608,7 @@ class RedCloth3 < String
|
||||
indent = 0
|
||||
lines.each do |line|
|
||||
line =~ QUOTES_CONTENT_RE
|
||||
bq,content = $1, $2
|
||||
bq, content = $1, $2
|
||||
l = bq.count('>')
|
||||
if l != indent
|
||||
quotes << ("\n\n" + (l>indent ? '<blockquote>' * (l-indent) : '</blockquote>' * (indent-l)) + "\n\n")
|
||||
@@ -630,7 +630,7 @@ class RedCloth3 < String
|
||||
|
||||
def inline_textile_code( text )
|
||||
text.gsub!( CODE_RE ) do |m|
|
||||
before,lang,code,after = $~[1..4]
|
||||
before, lang, code, after = $~[1..4]
|
||||
lang = " lang=\"#{lang}\"" if lang
|
||||
rip_offtags( +"#{before}<code#{lang}>#{code}</code>#{after}", false )
|
||||
end
|
||||
@@ -719,7 +719,7 @@ class RedCloth3 < String
|
||||
|
||||
def block_textile_prefix( text )
|
||||
if text =~ BLOCK_RE
|
||||
tag,tagpre,num,atts,cite,content = $~[1..6]
|
||||
tag, tagpre, num, atts, cite, content = $~[1..6]
|
||||
atts = pba( atts )
|
||||
|
||||
# pass to prefix handler
|
||||
@@ -789,13 +789,13 @@ class RedCloth3 < String
|
||||
text.gsub!( qtag_re ) do |m|
|
||||
case rtype
|
||||
when :limit
|
||||
sta,oqs,qtag,content,oqa = $~[1..6]
|
||||
sta, oqs, qtag, content, oqa = $~[1..6]
|
||||
atts = nil
|
||||
if content =~ /^(#{C})(.+)$/o
|
||||
atts, content = $~[1..2]
|
||||
end
|
||||
else
|
||||
qtag,atts,cite,content = $~[1..4]
|
||||
qtag, atts, cite, content = $~[1..4]
|
||||
sta = ''
|
||||
end
|
||||
atts = pba( atts )
|
||||
@@ -827,7 +827,7 @@ class RedCloth3 < String
|
||||
|
||||
def inline_textile_link( text )
|
||||
text.gsub!( LINK_RE ) do |m|
|
||||
all,pre,atts,text,title,url,proto,slash,post = $~[1..9]
|
||||
all, pre, atts, text, title, url, proto, slash, post = $~[1..9]
|
||||
if text.include?('<br />')
|
||||
all
|
||||
else
|
||||
@@ -950,7 +950,7 @@ class RedCloth3 < String
|
||||
|
||||
def inline_textile_image( text )
|
||||
text.gsub!( IMAGE_RE ) do |m|
|
||||
stln,algn,atts,url,title,href,href_a1,href_a2 = $~[1..8]
|
||||
stln, algn, atts, url, title, href, href_a1, href_a2 = $~[1..8]
|
||||
htmlesc title
|
||||
atts = pba( atts )
|
||||
atts = +" src=\"#{htmlesc url.dup}\"#{atts}"
|
||||
|
||||
@@ -435,7 +435,7 @@ class ImportsControllerTest < Redmine::ControllerTest
|
||||
)
|
||||
ActionMailer::Base.deliveries.clear
|
||||
assert_difference 'Issue.count', 3 do
|
||||
post(:run, :params => {:id => import,})
|
||||
post(:run, :params => {:id => import})
|
||||
assert_response :found
|
||||
end
|
||||
actual_email_count = ActionMailer::Base.deliveries.size
|
||||
|
||||
@@ -38,7 +38,7 @@ class LayoutTest < Redmine::IntegrationTest
|
||||
end
|
||||
|
||||
test "browsing to an unauthorized page should render the base layout" do
|
||||
log_user('jsmith','jsmith')
|
||||
log_user('jsmith', 'jsmith')
|
||||
|
||||
get "/admin"
|
||||
assert_response :forbidden
|
||||
|
||||
@@ -54,7 +54,7 @@ class TimelogTest < ApplicationSystemTestCase
|
||||
select 'QA', :from => 'Activity'
|
||||
page.first(:button, 'Submit').click
|
||||
|
||||
entries = TimeEntry.where(:id => [1,2,3]).to_a
|
||||
entries = TimeEntry.where(:id => [1, 2, 3]).to_a
|
||||
assert entries.all? {|entry| entry.hours == 8.5}
|
||||
assert entries.all? {|entry| entry.activity.name == 'QA'}
|
||||
end
|
||||
@@ -70,7 +70,7 @@ class TimelogTest < ApplicationSystemTestCase
|
||||
page.first(:button, 'Submit').click
|
||||
|
||||
assert_current_path "/projects/ecookbook/time_entries"
|
||||
entries = TimeEntry.where(:id => [1,2,3]).to_a
|
||||
entries = TimeEntry.where(:id => [1, 2, 3]).to_a
|
||||
assert entries.all? {|entry| entry.hours == 7.0}
|
||||
end
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
assert(
|
||||
Attachment.update_attachments(
|
||||
attachments,
|
||||
{2 => {:filename => 'newname?.txt'},}
|
||||
{2 => {:filename => 'newname?.txt'}}
|
||||
)
|
||||
)
|
||||
attachment = Attachment.find(2)
|
||||
|
||||
@@ -109,7 +109,7 @@ class Redmine::VersionFieldFormatTest < ActionView::TestCase
|
||||
def test_cast_value_should_not_raise_error_when_array_contains_value_casted_to_nil
|
||||
field = IssueCustomField.new(:field_format => 'version')
|
||||
assert_nothing_raised do
|
||||
field.cast_value([1,2, 42])
|
||||
field.cast_value([1, 2, 42])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user