Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Layout/EmptyLineAfterGuardClause cop #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ Layout/ArgumentAlignment:
Layout/DotPosition:
Enabled: false

# This cop supports safe auto-correction (--auto-correct).
Layout/EmptyLineAfterGuardClause:
Exclude:
- 'db/migrate/101_populate_changesets_user_id.rb'
- 'lib/redmine/default_data/loader.rb'
- 'lib/redmine/safe_attributes.rb'
- 'lib/redmine/string_array_diff/diff.rb'
- 'lib/redmine/string_array_diff/diffable.rb'
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'

# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
Layout/EmptyLineBetweenDefs:
Expand Down
1 change: 1 addition & 0 deletions db/migrate/101_populate_changesets_user_id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ def self.up
committers = Changeset.connection.select_values("SELECT DISTINCT committer FROM #{Changeset.table_name}")
committers.each do |committer|
next if committer.blank?

if committer.strip =~ /^([^<]+)(<(.*)>)?$/
username, email = $1.strip, $3
u = User.find_by_login(username)
Expand Down
1 change: 1 addition & 0 deletions lib/redmine/default_data/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def no_data?
# Raises a RecordNotSaved exception if something goes wrong
def load(lang=nil, options={})
raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data?

set_language_if_valid(lang)
workflow = !(options[:workflow] == false)

Expand Down
2 changes: 2 additions & 0 deletions lib/redmine/safe_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def safe_attributes(*args)
# book.safe_attributes(book.author) # => ['title', 'pages', 'isbn']
def safe_attribute_names(user=nil)
return @safe_attribute_names if @safe_attribute_names && user.nil?

names = []
self.class.safe_attributes.collect do |attrs, options|
if options[:if].nil? || options[:if].call(self, user || User.current)
Expand Down Expand Up @@ -87,6 +88,7 @@ def safe_attributes=(attrs, user=User.current)
end

return unless attrs.is_a?(Hash)

self.attributes = delete_unsafe_attributes(attrs, user)
end
end
Expand Down
1 change: 1 addition & 0 deletions lib/redmine/string_array_diff/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def Diff.lcs(a, b)
(astart..afinish).each { |aindex|
aelem = a[aindex]
next unless bmatches.has_key? aelem

k = nil
bmatches[aelem].reverse_each { |bindex|
if k && (thresh[k] > bindex) && (thresh[k-1] < bindex)
Expand Down
1 change: 1 addition & 0 deletions lib/redmine/string_array_diff/diffable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def replacenextlarger(value, high = nil)
index = (high+low)/2
found = self[index]
return nil if value == found

if value > found
low = index + 1
else
Expand Down
3 changes: 3 additions & 0 deletions lib/redmine/wiki_formatting/textile/redcloth3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ def block_textile_lists( text )
if depth.last.length > tl.length
(depth.length - 1).downto(0) do |i|
break if depth[i].length == tl.length

lines[line_id - 1] << "</li>\n\t</#{lT(depth[i])}l>\n\t"
depth.pop
end
Expand Down Expand Up @@ -962,6 +963,7 @@ def inline_textile_image( text )
url, url_title = check_refs( url )

next m unless uri_with_safe_scheme?(url.partition('?').first)

if href
href = htmlesc(href.dup)
next m if href.downcase.start_with?('javascript:')
Expand Down Expand Up @@ -1195,6 +1197,7 @@ def clean_html( text, tags = BASIC_TAGS )
if raw[3] =~ /#{prop}\s*=\s*#{q}([^#{q2}]+)#{q}/i
attrv = $1
next if prop == 'src' and attrv =~ %r{^(?!http)\w+:}

pcs << "#{prop}=\"#{$1.gsub('"', '\\"')}\""
break
end
Expand Down