CalebFenton/dex-oracle

View on GitHub

Showing 27 of 136 total issues

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);
Severity: Minor
Found in driver/src/main/java/org/cf/oracle/Driver.java - About 3 hrs to fix

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 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
Severity: Minor
Found in lib/dex-oracle/smali_file.rb - About 2 hrs to fix

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 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);
Severity: Major
Found in driver/src/main/java/org/cf/oracle/Driver.java - About 2 hrs to fix

    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]]
    Severity: Minor
    Found in lib/dex-oracle/plugin.rb - About 1 hr to fix

    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 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++) {
    Severity: Minor
    Found in driver/src/main/java/org/cf/oracle/options/TargetParser.java - About 1 hr to fix

    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 filter_methods has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.filter_methods(smali_files, include_types, exclude_types)
        methods = []
        smali_files.each do |smali_file|
          smali_file.methods.each do |method|
            if include_types
    Severity: Minor
    Found in lib/oracle.rb - About 1 hr to fix

    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 build_argument has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def build_argument(parameter, argument)
        if parameter[0] == 'L'
          java_type = parameter[1..-2].tr('/', '.')
          if java_type == 'java.lang.String'
            # Need to unescape smali string to get the actual string
    Severity: Minor
    Found in lib/dex-oracle/driver.rb - About 1 hr to fix

    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 smaliToJavaClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private static Class<?> smaliToJavaClass(String className) throws ClassNotFoundException {
            if (className.equals("I")) {
                return int.class;
            } else if (className.equals("V")) {
                return void.class;
    Severity: Minor
    Found in driver/src/main/java/org/cf/oracle/options/TargetParser.java - About 1 hr to fix

    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 prepare has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def prepare(input)
        if File.directory?(input)
          @temp_dir = false
          @temp_dex = true
          @dir = input
    Severity: Minor
    Found in lib/dex-oracle/smali_input.rb - About 1 hr to fix

      Method parseTarget has 26 lines of code (exceeds 25 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++) {
      Severity: Minor
      Found in driver/src/main/java/org/cf/oracle/options/TargetParser.java - About 1 hr to fix

        Method get_driver_dir has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_driver_dir
            # On some older devices, /data/local is world writable
            # But on other devices, it's /data/local/tmp
            %w(/data/local /data/local/tmp).each do |dir|
              stdout = adb("shell -x ls #{dir}")
        Severity: Minor
        Found in lib/dex-oracle/driver.rb - About 55 mins to fix

        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 install has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def install(dex)
            has_java = Utility.which('java')
            raise 'Unable to find Java on the path.' unless has_java
        
            begin
        Severity: Minor
        Found in lib/dex-oracle/driver.rb - About 55 mins to fix

        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 plugin_classes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.plugin_classes
            Dir["#{File.dirname(__FILE__)}/plugins/*.rb"].each { |f| require f }
            classes = []
            Object.constants.each do |klass|
              const = Kernel.const_get(klass) unless klass == :TimeoutError
        Severity: Minor
        Found in lib/dex-oracle/plugin.rb - About 45 mins to fix

        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 unescape has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def unescape(str)
            str.gsub(UNESCAPE_REGEX) do
              if Regexp.last_match[1]
                if Regexp.last_match[1] == '\\'
                  Regexp.last_match[1]
        Severity: Minor
        Found in lib/dex-oracle/driver.rb - About 45 mins to fix

        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 process_plugins has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def process_plugins
            made_changes = false
            loop do
              sweep_changes = false
              Plugin.plugins.each do |p|
        Severity: Minor
        Found in lib/oracle.rb - About 45 mins to fix

        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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def initialize(smali_dir, driver, include_types, exclude_types, disable_plugins)
        Severity: Minor
        Found in lib/oracle.rb - About 35 mins to fix

          Method enumerate_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.enumerate_files(dir, ext)
              # On Windows, filenames with unicode characters do not show up with Dir#glob or Dir#[]
              # They do, however, show up with Dir.entries, which is fine because it seems to be
              # the only Dir method that let's me set UTF-8 encoding. I must be missing something.
              # OH WELL. Do it the hard way.
          Severity: Minor
          Found in lib/oracle.rb - About 35 mins to fix

          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 exec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def exec(cmd, silent = true)
              logger.debug("exec: #{cmd}")
          
              retries = 1
              begin
          Severity: Minor
          Found in lib/dex-oracle/driver.rb - About 35 mins to fix

          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

          Avoid too many return statements within this method.
          Open

                      return short.class;
          Severity: Major
          Found in driver/src/main/java/org/cf/oracle/options/TargetParser.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return long.class;
            Severity: Major
            Found in driver/src/main/java/org/cf/oracle/options/TargetParser.java - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language