diff options
-rw-r--r-- | .rubocop_todo.yml | 18 | ||||
-rw-r--r-- | lib/redmine/configuration.rb | 2 | ||||
-rw-r--r-- | lib/redmine/helpers/time_report.rb | 4 | ||||
-rw-r--r-- | lib/redmine/imap.rb | 2 | ||||
-rw-r--r-- | lib/redmine/pop3.rb | 2 | ||||
-rw-r--r-- | lib/redmine/project_jump_box.rb | 2 | ||||
-rw-r--r-- | lib/redmine/safe_attributes.rb | 2 | ||||
-rw-r--r-- | lib/redmine/scm/adapters/cvs_adapter.rb | 6 | ||||
-rw-r--r-- | lib/redmine/sort_criteria.rb | 8 | ||||
-rw-r--r-- | lib/redmine/wiki_formatting/textile/redcloth3.rb | 16 | ||||
-rw-r--r-- | test/functional/imports_controller_test.rb | 2 | ||||
-rw-r--r-- | test/integration/layout_test.rb | 2 | ||||
-rw-r--r-- | test/system/timelog_test.rb | 4 | ||||
-rw-r--r-- | test/unit/attachment_test.rb | 2 | ||||
-rw-r--r-- | test/unit/lib/redmine/field_format/version_field_format_test.rb | 2 |
15 files changed, 28 insertions, 46 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 84baf94e1..64cf76967 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -109,24 +109,6 @@ 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: - 'app/controllers/application_controller.rb' diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb index b1ce9e374..1c7fdb3a5 100644 --- a/lib/redmine/configuration.rb +++ b/lib/redmine/configuration.rb @@ -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 diff --git a/lib/redmine/helpers/time_report.rb b/lib/redmine/helpers/time_report.rb index d6512ffe0..935ba6c20 100644 --- a/lib/redmine/helpers/time_report.rb +++ b/lib/redmine/helpers/time_report.rb @@ -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 diff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rb index cb91bf566..cc8dcb376 100644 --- a/lib/redmine/imap.rb +++ b/lib/redmine/imap.rb @@ -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? diff --git a/lib/redmine/pop3.rb b/lib/redmine/pop3.rb index 6035c4c11..e06c2296c 100644 --- a/lib/redmine/pop3.rb +++ b/lib/redmine/pop3.rb @@ -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? diff --git a/lib/redmine/project_jump_box.rb b/lib/redmine/project_jump_box.rb index 1d00c8f9c..54da4a514 100644 --- a/lib/redmine/project_jump_box.rb +++ b/lib/redmine/project_jump_box.rb @@ -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) diff --git a/lib/redmine/safe_attributes.rb b/lib/redmine/safe_attributes.rb index 387b93e25..095e18195 100644 --- a/lib/redmine/safe_attributes.rb +++ b/lib/redmine/safe_attributes.rb @@ -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 diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb index 92bae7a06..b8cc97001 100644 --- a/lib/redmine/scm/adapters/cvs_adapter.rb +++ b/lib/redmine/scm/adapters/cvs_adapter.rb @@ -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) diff --git a/lib/redmine/sort_criteria.rb b/lib/redmine/sort_criteria.rb index 1825197eb..461cd3ac1 100644 --- a/lib/redmine/sort_criteria.rb +++ b/lib/redmine/sort_criteria.rb @@ -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)} diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 3bc8ea29d..8667b2f09 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -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}" diff --git a/test/functional/imports_controller_test.rb b/test/functional/imports_controller_test.rb index 42edf5ca5..b4022298a 100644 --- a/test/functional/imports_controller_test.rb +++ b/test/functional/imports_controller_test.rb @@ -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 diff --git a/test/integration/layout_test.rb b/test/integration/layout_test.rb index 89f9d4cbe..bc1a67e01 100644 --- a/test/integration/layout_test.rb +++ b/test/integration/layout_test.rb @@ -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 diff --git a/test/system/timelog_test.rb b/test/system/timelog_test.rb index 2545dc694..94b86f592 100644 --- a/test/system/timelog_test.rb +++ b/test/system/timelog_test.rb @@ -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 diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb index b3e813be1..1b292b9bf 100644 --- a/test/unit/attachment_test.rb +++ b/test/unit/attachment_test.rb @@ -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) diff --git a/test/unit/lib/redmine/field_format/version_field_format_test.rb b/test/unit/lib/redmine/field_format/version_field_format_test.rb index 6ca119775..bd9c57ce7 100644 --- a/test/unit/lib/redmine/field_format/version_field_format_test.rb +++ b/test/unit/lib/redmine/field_format/version_field_format_test.rb @@ -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 |