Skip to content

Commit

Permalink
[ci] Fix Style/RescueModifier Rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Schnitzer committed Mar 10, 2017
1 parent 8f3507a commit 3ffef9c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
12 changes: 10 additions & 2 deletions src/api/app/controllers/webui/feeds_controller.rb
Expand Up @@ -21,12 +21,20 @@ def commits
return
end
unless params[:starting_at].blank?
@start = (Time.zone.parse(params[:starting_at]) rescue nil)
@start = (begin
Time.zone.parse(params[:starting_at])
rescue
nil
end)
end
@start ||= 7.days.ago
@finish = nil
unless params[:ending_at].blank?
@finish = (Time.zone.parse(params[:ending_at]) rescue nil)
@finish = (begin
Time.zone.parse(params[:ending_at])
rescue
nil
end)
end
@commits = @project.project_log_entries.where(event_type: 'commit').where(["datetime >= ?", @start])
@commits = @commits.where(["datetime <= ?", @finish]) unless @finish.nil?
Expand Down
12 changes: 10 additions & 2 deletions src/api/app/controllers/webui/project_controller.rb
Expand Up @@ -435,7 +435,11 @@ def monitor
@name_filter = params[:pkgname]
@lastbuild_switch = params[:lastbuild]
if params[:defaults]
defaults = (Integer(params[:defaults]) rescue 1) > 0
defaults = (begin
Integer(params[:defaults])
rescue
1
end) > 0
else
defaults = true
end
Expand Down Expand Up @@ -874,7 +878,11 @@ def monitor_set_filter(defaults)
@avail_status_values.each { |s|
id = s.delete(' ')
if params.has_key?(id)
next unless (Integer(params[id]) rescue 1) > 0
next unless (begin
Integer(params[id])
rescue
1
end) > 0
else
next unless defaults
end
Expand Down
18 changes: 15 additions & 3 deletions src/api/test/functional/webui/owner_search_test.rb
Expand Up @@ -46,9 +46,21 @@ def search_results
raw_results = page.all("div.search_result")
raw_results.collect do |row|
{
project: (row.find("a.project").text rescue nil),
package: (row.find("a.package").text rescue nil),
owners: (row.find("p").text rescue nil)
project: (begin
row.find("a.project").text
rescue
nil
end),
package: (begin
row.find("a.package").text
rescue
nil
end),
owners: (begin
row.find("p").text
rescue
nil
end)
}
end
end
Expand Down

0 comments on commit 3ffef9c

Please sign in to comment.