Skip to content

Commit

Permalink
Small bump to next rubocop that works
Browse files Browse the repository at this point in the history
Rubocop 0.48.1 and earlier are affected by CVE-2017-8418
  • Loading branch information
dmacvicar committed Feb 2, 2018
1 parent d144df7 commit 981fbdd
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Capfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }

load 'config/deploy' # remove this line to skip loading any of the default tasks
load 'config/deploy' # remove this line to skip loading any of the default tasks
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'

gem 'rails', '~> 5.1.4'
gem 'nokogiri'
gem 'rails', '~> 5.1.4'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.7'
Expand All @@ -15,25 +15,25 @@ gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'jquery-ui-rails', '~> 4.2.1'

gem 'gettext_i18n_rails', '>= 0.4.3'
gem 'fast_gettext', '>= 0.7.0'
gem 'gettext_i18n_rails', '>= 0.4.3'

# rails-i18n provides translations for ActiveRecord
# validation error messages
gem 'rails-i18n'

gem 'xmlhash', '>= 1.2.2'
gem 'hashie'
gem 'dalli'
gem 'minitest'
gem 'hashie'
gem 'mini_magick'
gem 'minitest'
gem 'xmlhash', '>= 1.2.2'

# needed to collect translatable strings
# not needed at production
group :development do
# no need to load the gem via require
# we only need the rake tasks
gem 'gettext', '>= 1.9.3', :require => false
gem 'gettext', '>= 1.9.3', require: false
end

group :production do
Expand All @@ -43,6 +43,6 @@ end
group :test do
gem 'capybara'
gem 'poltergeist'
gem 'rubocop', "~> 0.49.0"
gem 'webmock'
gem 'rubocop', ">= 0.47"
end
6 changes: 4 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ GEM
nio4r (2.1.0)
nokogiri (1.8.1)
mini_portile2 (~> 2.3.0)
parallel (1.12.1)
parser (2.4.0.2)
ast (~> 2.3)
pkg-config (1.2.8)
Expand Down Expand Up @@ -154,7 +155,8 @@ GEM
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rubocop (0.47.0)
rubocop (0.49.1)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
Expand Down Expand Up @@ -217,7 +219,7 @@ DEPENDENCIES
puma
rails (~> 5.1.4)
rails-i18n
rubocop (>= 0.47)
rubocop (~> 0.49.0)
sass-rails (~> 5.0.7)
uglifier (>= 1.3.0)
webmock
Expand Down
Empty file modified Rakefile
100644 → 100755
Empty file.
6 changes: 2 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
IMAGE_USERID=`id -u`
VAGRANTFILE_API_VERSION = '2'.freeze
IMAGE_USERID = `id -u`.freeze

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.define "default" do |web|
web.vm.provider 'docker' do |d|
d.build_dir = "."
Expand All @@ -18,5 +17,4 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
d.ports = ['3000:3000']
end
end

end
2 changes: 1 addition & 1 deletion app/controllers/distributions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class DistributionsController < ApplicationController
skip_before_action :set_distributions
before_action :set_parameters, only: [:index, :testing]
before_action :set_parameters, only: %i[index testing]

def set_parameters
@testing_version = '15.0'
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/package_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class PackageController < ApplicationController

#before_action :set_beta_warning, :only => [:category, :categories]
before_action :set_search_options, :only => [:show, :categories]
before_action :prepare_appdata, :set_categories, :only => [:show, :categories, :category]
before_action :set_search_options, :only => %i[show categories]
before_action :prepare_appdata, :set_categories, :only => %i[show categories category]

skip_before_action :set_language, :set_distributions, :set_baseproject, :only => [:thumbnail, :screenshot]
skip_before_action :set_language, :set_distributions, :set_baseproject, :only => %i[thumbnail screenshot]

def show
required_parameters :package
Expand Down Expand Up @@ -66,7 +66,7 @@ def category
mapping = @main_sections.select{|s| s[:id].downcase == @category.downcase }
categories = (mapping.blank? ? [@category] : mapping.first[:categories])

app_pkgs = @appdata[:apps].select{|app| !(app[:categories].map{|c| c.downcase} & categories.map{|c| c.downcase}).blank? }
app_pkgs = @appdata[:apps].reject{|app| (app[:categories].map{|c| c.downcase} & categories.map{|c| c.downcase}).blank? }
@packagenames = app_pkgs.map{|p| p[:pkgname]}.uniq.sort_by {|x| @appdata[:apps].select{|a| a[:pkgname] == x}.first[:name] }

app_categories = app_pkgs.map{|p| p[:categories]}.flatten
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def index
base = (@baseproject == "ALL") ? "" : @baseproject

#if we have a baseproject, and don't show unsupported packages, shortcut: '
if !@baseproject.blank? && !(@baseproject == "ALL") && !@search_unsupported && !@search_project
if !@baseproject.blank? && @baseproject != "ALL" && !@search_unsupported && !@search_project
@search_project = @baseproject
end

Expand All @@ -31,7 +31,7 @@ def index
end

# only show packages
@packages = @packages.select { |p| p.first.type != 'ymp' }
@packages = @packages.reject { |p| p.first.type == 'ymp' }
@packagenames = @packages.map { |p| p.name }

# mix in searchresults from appdata, as the api can't search in summary and description atm
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def search_for_description pkgname, packages = []
description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do
if packages.blank?
packages = Seeker.prepare_result("\"#{pkgname}\"", nil, nil, nil, nil)
packages = packages.select{|p| p.first.type != 'ymp'}
packages = packages.reject{|p| p.first.type == 'ymp'}
end
packages.select{|p| p.name == pkgname}.each do |package|
description_package = nil
Expand Down
8 changes: 4 additions & 4 deletions app/models/seeker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class InvalidSearchTerm < Exception; end

class SearchResult < Array
def self.search(query, baseproject, project = nil, exclude_filter = nil, exclude_debug = false)
words = query.split(" ").select {|part| !part.match(/^[0-9_\.-]+$/) }
words = query.split(" ").reject {|part| part.match(/^[0-9_\.-]+$/) }
versrel = query.split(" ").select {|part| part.match(/^[0-9_\.-]+$/) }
logger.debug "splitted words and versrel: #{words.inspect} #{versrel.inspect}"
raise InvalidSearchTerm.new "Please provide a valid search term" if words.blank? && project.blank?

xpath_items = Array.new
xpath_items << "@project = '#{project}' " unless project.blank?
substring_words = words.select{|word| !word.match(/^".+"$/) }.map{|word| "'#{word.gsub(/['"()]/, "")}'"}.join(", ")
substring_words = words.reject{|word| word.match(/^".+"$/) }.map{|word| "'#{word.gsub(/['"()]/, "")}'"}.join(", ")
unless (substring_words.blank?)
xpath_items << "contains-ic(@name, " + substring_words + ")"
end
Expand Down Expand Up @@ -354,13 +354,13 @@ class Fragment < Hash
attr_accessor :fragment_type

def initialize(element)
%w(project repository name filename filepath arch type baseproject type version release package).each do |att|
%w[project repository name filename filepath arch type baseproject type version release package].each do |att|
self[att] = element.value att
end
end

def __key
@__key ||= @fragment_type.to_s + "|" + %w(project repository name).map{|x| self[x]}.join('|')
@__key ||= @fragment_type.to_s + "|" + %w[project repository name].map{|x| self[x]}.join('|')
end

def dump
Expand Down
2 changes: 1 addition & 1 deletion lib/activexml/transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def find(model, *args)
raise RuntimeError.new("GET to %s returned no data" % url) if objdata.empty?
else
#use post-method
logger.debug"[REST] Transport.find using POST-method"
logger.debug "[REST] Transport.find using POST-method"
#logger.debug"[REST] POST-data as xml: #{data.to_s}"
objdata = http_do('post', url, :data => data.to_s, :content_type => own_mimetype)
raise RuntimeError.new("POST to %s returned no data" % url) if objdata.empty?
Expand Down
7 changes: 3 additions & 4 deletions lib/tasks/fill_search_cache.rake
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

desc "Fill cache with app data from Factory"
task(:fill_search_cache => :environment) do
task(fill_search_cache: :environment) do
appdata = Appdata.get "factory"
puts appdata
pkg_list =appdata[:apps].map{|p| p[:pkgname]}.uniq
pkg_list = appdata[:apps].map { |p| p[:pkgname] }.uniq
puts "Caching data for #{pkg_list.size} apps"
pkg_list.each_with_index do |pkg, number|
Seeker.prepare_result("\"#{pkg}\"", nil, nil, nil, nil)
Seeker.prepare_result("#{pkg}", nil, nil, nil, nil)
Seeker.prepare_result(pkg.to_s, nil, nil, nil, nil)
puts "Cached data for #{pkg} (#{number}/#{pkg_list.size})"
end

end
10 changes: 5 additions & 5 deletions lib/tasks/gettext.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# Added for Ruby-GetText-Package
#

POT_FILE = "locale/software.pot"
POT_FILE = "locale/software.pot".freeze

def each_po_file(&block)
def each_po_file
@po_files ||= Dir.glob("locale/*/software.po")

@po_files.each do |file|
lang = file_to_lang(file)
block.call(file, lang)
yield(file, lang)
end
end

Expand All @@ -18,13 +18,13 @@ def file_to_lang(file)
end

def backup_po_files
each_po_file do |file, lang|
each_po_file do |file, _lang|
system("cp #{file} #{file}.back")
end
end

def restore_po_files
each_po_file do |file, lang|
each_po_file do |file, _lang|
system("mv #{file}.back #{file}")
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ActiveSupport::TestCase
# Helper to associate queries to OBS with the corresponding file in
# test/support
def stub_remote_file(url, filename)
%w(http https).each do |protocol|
%w[http https].each do |protocol|
stub_request(:any, "#{protocol}://test:test@#{url}").to_return(body: File.read(Rails.root.join('test', 'support', filename)))
end
end
Expand Down

0 comments on commit 981fbdd

Please sign in to comment.