Skip to content

Commit

Permalink
Rename reference_count to method_reference_count
Browse files Browse the repository at this point in the history
  • Loading branch information
Kouta Imanaka committed Aug 15, 2018
1 parent 1ab4662 commit 223d517
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/apkstats/command/apk_analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def target_sdk(apk_filepath)
run_command("manifest", "target-sdk", apk_filepath)
end

def reference_count(apk_filepath)
def method_reference_count(apk_filepath)
ApkAnalyzer.parse_reference_to_map(run_command("dex", "references", apk_filepath))
.values
.map(&:to_i)
Expand Down
6 changes: 3 additions & 3 deletions lib/apkstats/command/executable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def executable?
# permissions: Array<String>,
# min_sdk: String,
# target_sdk: String,
# reference_count: Integer,
# method_reference_count: Integer,
# dex_count: Integer,
# },
# other: {
Expand All @@ -32,7 +32,7 @@ def executable?
# permissions: Array<String>,
# min_sdk: String,
# target_sdk: String,
# reference_count: Integer,
# method_reference_count: Integer,
# dex_count: Integer,
# },
# diff: {
Expand All @@ -52,7 +52,7 @@ def executable?
# },
# min_sdk: Array<String>,
# target_sdk: Array<String>,
# reference_count: Integer,
# method_reference_count: Integer,
# dex_count: Integer,
# }
# }
Expand Down
4 changes: 2 additions & 2 deletions lib/apkstats/entity/apk_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class ApkInfo
permissions
min_sdk
target_sdk
reference_count
method_reference_count
dex_count
).freeze

# Integer
attr_accessor :file_size, :download_size, :reference_count, :dex_count
attr_accessor :file_size, :download_size, :method_reference_count, :dex_count

# String
attr_accessor :min_sdk, :target_sdk
Expand Down
2 changes: 1 addition & 1 deletion lib/apkstats/entity/apk_info_diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def target_sdk
[@base[__method__], @other[__method__]].uniq
end

def reference_count
def method_reference_count
# Integer
@base[__method__].to_i - @other[__method__].to_i
end
Expand Down
12 changes: 6 additions & 6 deletions lib/apkstats/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module Danger
#
# @example Show the methods reference count of your apk file.
#
# apkstats.reference_count
# apkstats.method_reference_count
#
# @example Show the number of dex of your apk file.
#
Expand Down Expand Up @@ -145,12 +145,12 @@ def compare_with(other_apk_filepath, do_report: true)
md << "Download Size Change | #{size.to_s_b} Bytes. (#{size.to_s_kb} KB) " << "\n"
end

result[:base][:reference_count].tap do |reference_count|
md << "New Reference Count | #{reference_count}" << "\n"
result[:base][:method_reference_count].tap do |method_reference_count|
md << "New Method Reference Count | #{method_reference_count}" << "\n"
end

diff[:reference_count].tap do |reference_count|
md << "Reference Count Change | #{reference_count}" << "\n"
diff[:method_reference_count].tap do |method_reference_count|
md << "Method Reference Count Change | #{method_reference_count}" << "\n"
end

result[:base][:dex_count].tap do |dex_count|
Expand Down Expand Up @@ -247,7 +247,7 @@ def target_sdk(_opts = {})
# Show the methods reference count of your apk file.
#
# @return [Fixnum] return positive value if exists, otherwise -1.
def reference_count(_opts = {})
def method_reference_count(_opts = {})
result = run_command(__method__)
result ? result.to_i : -1
end
Expand Down
6 changes: 3 additions & 3 deletions spec/command/apk_analyzer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ module Apkstats::Command
expect(command.target_sdk(apk_base)).to eq("28")
end

it "reference_count should return reference count" do
expect(command.reference_count(apk_base)).to eq(15_720.to_s)
expect(command.reference_count(apk_method64k)).to eq(124_304.to_s)
it "method_reference_count should return reference count" do
expect(command.method_reference_count(apk_base)).to eq(15_720.to_s)
expect(command.method_reference_count(apk_method64k)).to eq(124_304.to_s)
end

it "dex_count should return dex count" do
Expand Down
6 changes: 3 additions & 3 deletions spec/entity/apk_info_diff_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create_permission(name, opts = {})
]),
min_sdk: "16",
target_sdk: "26",
reference_count: 20_000,
method_reference_count: 20_000,
dex_count: 1,
}
end
Expand Down Expand Up @@ -59,7 +59,7 @@ def create_permission(name, opts = {})
]),
min_sdk: "21",
target_sdk: "27",
reference_count: base_apk_values[:reference_count] + 2000,
method_reference_count: base_apk_values[:method_reference_count] + 2000,
dex_count: base_apk_values[:dex_count] + 1,
}
end
Expand Down Expand Up @@ -109,7 +109,7 @@ def create_permission(name, opts = {})
)
expect(diff.min_sdk).to eq(%w(16 21))
expect(diff.target_sdk).to eq(%w(26 27))
expect(diff.reference_count).to eq(-2000)
expect(diff.method_reference_count).to eq(-2000)
expect(diff.dex_count).to eq(-1)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/entity/apk_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Apkstats::Entity
]),
min_sdk: "16",
target_sdk: "26",
reference_count: 20_000,
method_reference_count: 20_000,
dex_count: 1,
}
end
Expand Down

0 comments on commit 223d517

Please sign in to comment.