diff options
author | Hans de Graaff <graaff@gentoo.org> | 2019-12-20 09:53:49 +0100 |
---|---|---|
committer | Hans de Graaff <graaff@gentoo.org> | 2019-12-20 09:54:22 +0100 |
commit | bbda6aaf9798e0b114271e59eaf30d2dcbe946c3 (patch) | |
tree | 1cbd1ab594f3d9839de84a1e2a9b64983dd00777 | |
parent | travis: use bionic and faster curl (diff) | |
download | packages-5-bbda6aaf9798e0b114271e59eaf30d2dcbe946c3.tar.gz packages-5-bbda6aaf9798e0b114271e59eaf30d2dcbe946c3.tar.bz2 packages-5-bbda6aaf9798e0b114271e59eaf30d2dcbe946c3.zip |
Fix rubocop warnings
Signed-off-by: Hans de Graaff <graaff@gentoo.org>
-rw-r--r-- | app/helpers/packages_helper.rb | 2 | ||||
-rw-r--r-- | app/repositories/useflag_repository.rb | 2 | ||||
-rw-r--r-- | app/views/packages/show.json.jbuilder | 2 | ||||
-rwxr-xr-x | bin/yarn | 12 | ||||
-rw-r--r-- | lib/portage/util/maskfile.rb | 3 | ||||
-rw-r--r-- | test/integration/arches_routes_test.rb | 4 |
6 files changed, 13 insertions, 12 deletions
diff --git a/app/helpers/packages_helper.rb b/app/helpers/packages_helper.rb index b36624c..97626b7 100644 --- a/app/helpers/packages_helper.rb +++ b/app/helpers/packages_helper.rb @@ -93,8 +93,10 @@ module PackagesHelper nil end + # rubocop:disable Security/Open def documentation_label(package) doc = Nokogiri::XML(open('https://wiki.gentoo.org/api.php?action=query&titles=' + package + '&format=xml')) doc.xpath('//api/query/pages/page')[0].attr('missing').nil? ? (t :res_docs) : (t :res_search_docs) end + # rubocop:enable Security/Open end diff --git a/app/repositories/useflag_repository.rb b/app/repositories/useflag_repository.rb index 7b8dad3..8198a9b 100644 --- a/app/repositories/useflag_repository.rb +++ b/app/repositories/useflag_repository.rb @@ -50,7 +50,7 @@ class UseflagRepository < BaseRepository processed_results = {} results.each do |result| processed_results[result.name] = if processed_results.key? result.name - Useflag.new ({ 'name' => result.name, 'description' => '(multiple definitions)', 'scope' => 'multi' }) + Useflag.new('name' => result.name, 'description' => '(multiple definitions)', 'scope' => 'multi') else result end diff --git a/app/views/packages/show.json.jbuilder b/app/views/packages/show.json.jbuilder index 703ed8b..b8aea5a 100644 --- a/app/views/packages/show.json.jbuilder +++ b/app/views/packages/show.json.jbuilder @@ -30,7 +30,7 @@ json.use do json.description strip_tags flag[:description] end - json.use_expand @package.versions.first.useflags[:use_expand].group_by { |u| u['use_expand_prefix'] } do |flag| + json.use_expand(@package.versions.first.useflags[:use_expand].group_by { |u| u['use_expand_prefix'] }) do |flag| json.set! flag[0] do json.array! flag[1] do |expand_flag| json.name expand_flag[:name].gsub(expand_flag[:use_expand_prefix] + '_', '') @@ -1,11 +1,9 @@ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT - $stderr.puts "Yarn executable was not detected in the system." - $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" - exit 1 - end + exec "yarnpkg", *ARGV +rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 end diff --git a/lib/portage/util/maskfile.rb b/lib/portage/util/maskfile.rb index f2d0a55..d043eff 100644 --- a/lib/portage/util/maskfile.rb +++ b/lib/portage/util/maskfile.rb @@ -9,7 +9,8 @@ class Portage::Util::Maskfile end def parse! - return unless File.exists?(@path) + return unless File.exist?(@path) + File.read(@path).split("\n\n").each do |raw_mask| comments = [] atoms = [] diff --git a/test/integration/arches_routes_test.rb b/test/integration/arches_routes_test.rb index d654118..47f2897 100644 --- a/test/integration/arches_routes_test.rb +++ b/test/integration/arches_routes_test.rb @@ -9,7 +9,7 @@ class ArchesRoutesTest < ActionDispatch::IntegrationTest test 'view keyworded packages for arch' do arches = %w[alpha amd64 arm arm64 hppa ia64 ppc ppc64 sparc x86] arches.each do |arch| - get ('/arches/' + arch + '/keyworded') + get '/arches/' + arch + '/keyworded' assert_select 'h1', ('Keyworded Packages (' + arch + ')') end end @@ -17,7 +17,7 @@ class ArchesRoutesTest < ActionDispatch::IntegrationTest test 'view stable packages for arch' do arches = %w[alpha amd64 arm arm64 hppa ia64 ppc ppc64 sparc x86] arches.each do |arch| - get ('/arches/' + arch + '/stable') + get '/arches/' + arch + '/stable' assert_select 'h1', ('Newly Stable Packages (' + arch + ')') end end |