Skip to content

Commit

Permalink
fix: Apply rubocop corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jmatsu committed Oct 17, 2023
1 parent c0e7b2f commit 92defbb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
20 changes: 20 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,23 @@ source "https://rubygems.org"

# Specify your gem's dependencies in android_apk.gemspec
gemspec

# General ruby development
gem "rake", "~> 10.0"

# Testing support
gem "rspec", "~> 3.4"
gem "simplecov"

# Linting code and docs
gem "rubocop"
gem "yard"

# Makes testing easy via `bundle exec guard`
gem "guard", "~> 2.14"
gem "guard-rspec", "~> 4.7"

gem "irb"
gem "pry"

gem "mini_magick" # to compare extracted png files
19 changes: 0 additions & 19 deletions android_apk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,5 @@ Gem::Specification.new do |spec|

spec.add_dependency "rubyzip", "~> 2.3.0"

# General ruby development
spec.add_development_dependency "rake", "~> 10.0"

# Testing support
spec.add_development_dependency "rspec", "~> 3.4"
spec.add_development_dependency "simplecov"

# Linting code and docs
spec.add_development_dependency "rubocop"
spec.add_development_dependency "yard"

# Makes testing easy via `bundle exec guard`
spec.add_development_dependency "guard", "~> 2.14"
spec.add_development_dependency "guard-rspec", "~> 4.7"

spec.add_development_dependency "irb"
spec.add_development_dependency "pry"

spec.add_development_dependency "mini_magick" # to compare extracted png files
spec.metadata["rubygems_mfa_required"] = "true"
end
14 changes: 7 additions & 7 deletions lib/android_apk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
require "tmpdir"
require "zip"

require_relative "./android_apk/app_icon"
require_relative "./android_apk/error"
require_relative "./android_apk/resource_finder"
require_relative "./android_apk/xmltree"
require_relative "android_apk/app_icon"
require_relative "android_apk/error"
require_relative "android_apk/resource_finder"
require_relative "android_apk/xmltree"

class AndroidApk
FALLBACK_DPI = 65_534
Expand Down Expand Up @@ -348,7 +348,7 @@ def backward_compatible_adaptive_icon?
def self._parse_values_workaround(str)
return nil if str.nil?

str.scan(/^'(.+)'$/).map { |v| v[0].gsub(/\\'/, "'") }
str.scan(/^'(.+)'$/).map { |v| v[0].gsub("\\'", "'") }
end

# Parse values of aapt output
Expand All @@ -361,10 +361,10 @@ def self._parse_values(str)
if str.index("='")
# key-value hash
vars = str.scan(/(\S+)='((?:\\'|[^'])*)'/).to_h
vars.each_value { |v| v.gsub(/\\'/, "'") }
vars.each_value { |v| v.gsub("\\'", "'") }
else
# values array
vars = str.scan(/'((?:\\'|[^'])*)'/).map { |v| v[0].gsub(/\\'/, "'") }
vars = str.scan(/'((?:\\'|[^'])*)'/).map { |v| v[0].gsub("\\'", "'") }
end
return vars
end
Expand Down
2 changes: 1 addition & 1 deletion lib/android_apk/xmltree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def initialize(content:)
@root_element = nil

line_num = 1
content&.split(/\n/) do |line|
content&.split("\n") do |line|
line.strip!

if line.start_with?("E: ")
Expand Down

0 comments on commit 92defbb

Please sign in to comment.