Showing 136 of 136 total issues
Class has too many lines. [213/100] Open
class Driver
include Logging
UNESCAPES = {
'a' => "\x07", 'b' => "\x08", 't' => "\x09",
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [133/100] Open
class Undexguard < Plugin
attr_reader :optimizations
include Logging
include CommonRegex
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method main
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static void main(String[] args) {
boolean multipleTargets = args.length < 2 && args[0].startsWith("@");
if (args.length < 1 && !multipleTargets) {
showUsage();
System.exit(-1);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Assignment Branch Condition size for install is too high. [28.91/15] Open
def install(dex)
has_java = Utility.which('java')
raise 'Unable to find Java on the path.' unless has_java
begin
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for prepare is too high. [24.04/15] Open
def prepare(input)
if File.directory?(input)
@temp_dir = false
@temp_dex = true
@dir = input
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for unescape is too high. [22.36/15] Open
def unescape(str)
str.gsub(UNESCAPE_REGEX) do
if Regexp.last_match[1]
if Regexp.last_match[1] == '\\'
Regexp.last_match[1]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method parse_methods
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse_methods
@methods = []
method_signature = nil
in_method = false
body = nil
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Assignment Branch Condition size for decrypt_multi_bytes is too high. [20.71/15] Open
def decrypt_multi_bytes(method)
target_to_contexts = {}
target_id_to_output = {}
matches = method.body.scan(MULTI_BYTES_DECRYPT)
@optimizations[:string_decrypts] += matches.size if matches
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for process is too high. [19.95/15] Open
def process
method_to_target_to_contexts = {}
@methods.each do |method|
logger.info("Undexguarding #{method.descriptor} - stage 1/2")
target_to_contexts = {}
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method main
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String[] args) {
boolean multipleTargets = args.length < 2 && args[0].startsWith("@");
if (args.length < 1 && !multipleTargets) {
showUsage();
System.exit(-1);
Assignment Branch Condition size for pull_batch_outputs is too high. [17.15/15] Open
def pull_batch_outputs
output_file = Tempfile.new(['oracle-output', '.json'])
logger.debug('Pulling batch results from device ...')
adb("pull #{@driver_dir}/od-output.json #{output_file.path}")
adb("shell rm #{@driver_dir}/od-output.json")
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for drive is too high. [17.03/15] Open
def drive(cmd, batch = false)
return @cache[cmd] if @cache.key?(cmd)
full_cmd = "shell \"#{cmd}\"; echo $?"
full_output = adb(full_cmd)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for divine is too high. [16.19/15] Open
def divine
puts "Optimizing #{@methods.size} methods over #{@smali_files.size} Smali files."
made_changes = process_plugins
@smali_files.each(&:update) if made_changes
optimizations = {}
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for validate_output is too high. [16.4/15] Open
def validate_output(full_cmd, full_output)
output_lines = full_output.split(/\r?\n/)
exit_code = output_lines.last.to_i
if exit_code != 0
# Non zero exit code would only imply adb command itself was flawed
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Cyclomatic complexity for install is too high. [7/6] Open
def install(dex)
has_java = Utility.which('java')
raise 'Unable to find Java on the path.' unless has_java
begin
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Assignment Branch Condition size for apply_outputs is too high. [15.94/15] Open
def self.apply_outputs(target_id_to_output, method_to_target_to_contexts, modifier, filter = nil)
made_changes = false
method_to_target_to_contexts.each do |method, target_to_contexts|
target_to_contexts.each do |target, contexts|
status, output = target_id_to_output[target[:id]]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for lookup_classes is too high. [15.03/15] Open
def lookup_classes(method)
target_to_contexts = {}
target_id_to_output = {}
matches = method.body.scan(CONST_CLASS_REGEX)
@optimizations[:class_lookups] += matches.size
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for parse is too high. [15.81/15] Open
def parse(file_path)
logger.debug("Parsing: #{file_path} ...")
@content = File.open(file_path, 'r:UTF-8', &:read)
@class = @content[CLASS, 1]
@super = @content[SUPER, 1]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method parseTarget
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static void parseTarget(Gson gson, InvocationTarget target) throws ClassNotFoundException, NoSuchMethodException {
String[] args = target.getArgumentStrings();
Class<?>[] parameterTypes = new Class[args.length];
Object[] methodArguments = new Object[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method apply_outputs
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.apply_outputs(target_id_to_output, method_to_target_to_contexts, modifier, filter = nil)
made_changes = false
method_to_target_to_contexts.each do |method, target_to_contexts|
target_to_contexts.each do |target, contexts|
status, output = target_id_to_output[target[:id]]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"