patrickfav/uber-adb-tools

View on GitHub

Showing 87 of 87 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        } else if (osName.contains("nix")) {
            if (cmdProvider.canRunCmd(LINUX_DEFAULT)) {
                return new LocationResult(Location.LINUX_DEFAULT, LINUX_DEFAULT);
            }
            if (userPath != null && cmdProvider.canRunCmd(new String[]{userPath + LINUX_DEFAULT_2})) {
src/main/java/at/favre/tools/uberadb/AdbLocationFinderImpl.java on lines 64..74

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 118.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public static void execute(AdbLocationFinder.LocationResult adbLocation, Arg arguments, CmdProvider cmdProvider, boolean preview, Commons.ActionResult actionResult, AdbDevice device) {
        List<File> installFiles = new FileArgParser().parseAndSortUniqueFilesNonRecursive(arguments.mainArgument, EXTENSION_APK);

        if (installFiles.isEmpty()) {
            throw new IllegalStateException("could not find any apk files in " + Arrays.toString(arguments.mainArgument) + " to install");
Severity: Minor
Found in src/main/java/at/favre/tools/uberadb/actions/Install.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 main has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static void main(String args[]) {
        System.out.println("- Downloader started");
        File baseDirectory = new File(args[0]);
        System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

Severity: Minor
Found in .mvn/wrapper/MavenWrapperDownloader.java - About 1 hr to fix

    Method find has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public LocationResult find(CmdProvider cmdProvider, String customPath) {
            String osName = System.getProperty("os.name").toLowerCase();
    
            if (customPath != null && new File(customPath).exists() && cmdProvider.canRunCmd(new String[]{customPath})) {
    Severity: Minor
    Found in src/main/java/at/favre/tools/uberadb/AdbLocationFinderImpl.java - About 1 hr to fix

      Method parseDeviceLine has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static AdbDevice parseDeviceLine(String line) {
              char[] chars = line.replace("\t", " ").toCharArray();
              StringBuilder deviceName = new StringBuilder();
              String additionalInfo = null;
      
      
      Severity: Minor
      Found in src/main/java/at/favre/tools/uberadb/parser/AdbDevicesParser.java - About 1 hr to fix

        Method parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public List<String> parse(String shellOutput) {
                List<String> packages = new ArrayList<>();
        
                if (shellOutput != null && !shellOutput.isEmpty()) {
                    for (String line : shellOutput.split("\\n")) {

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

            public static void main(String args[]) {
                System.out.println("- Downloader started");
                File baseDirectory = new File(args[0]);
                System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
        
        
        Severity: Minor
        Found in .mvn/wrapper/MavenWrapperDownloader.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 getCorrectAction has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static String getCorrectAction(Arg.Mode mode, String install, String uninstall, String bugreport, String forceStop, String clear, String info, String start) {
        Severity: Major
        Found in src/main/java/at/favre/tools/uberadb/actions/Commons.java - About 1 hr to fix

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

              public static void checkSpecificDevice(List<AdbDevice> devices, Arg arguments) {
                  if (arguments.device != null) {
                      boolean found = false;
                      for (AdbDevice device : devices) {
                          if (device.serial.equals(arguments.device) && device.status == AdbDevice.Status.OK) {
          Severity: Minor
          Found in src/main/java/at/favre/tools/uberadb/actions/Commons.java - 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 execute has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public static void execute(AdbLocationFinder.LocationResult adbLocation, Arg arguments, CmdProvider cmdProvider, boolean preview, Commons.ActionResult actionResult, AdbDevice device, List<String> allPackages) {
          Severity: Major
          Found in src/main/java/at/favre/tools/uberadb/actions/PackageDependentAction.java - About 50 mins to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public AdbDevice(String serial, Status status, String model, String product, boolean isEmulator) {
                    this.serial = serial;
                    this.status = status;
                    this.model = model;
                    this.product = product;
            Severity: Minor
            Found in src/main/java/at/favre/tools/uberadb/parser/AdbDevice.java and 1 other location - About 50 mins to fix
            src/main/java/at/favre/tools/uberadb/actions/BugReport.java on lines 249..255

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 60.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    BugReportDeviceFileAction(String log, String deviceTempFile, File localTempFile, String[] command, String zipSubFolder) {
                        this.deviceTempFile = deviceTempFile;
                        this.localTempFile = localTempFile;
                        this.command = command;
                        this.log = log;
            Severity: Minor
            Found in src/main/java/at/favre/tools/uberadb/actions/BugReport.java and 1 other location - About 50 mins to fix
            src/main/java/at/favre/tools/uberadb/parser/AdbDevice.java on lines 32..38

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 60.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    return "AdbDevice{" +
                            "serial='" + serial + '\'' +
                            ", status=" + status +
                            ", model='" + model + '\'' +
                            ", product='" + product + '\'' +
            Severity: Minor
            Found in src/main/java/at/favre/tools/uberadb/parser/AdbDevice.java and 1 other location - About 50 mins to fix
            src/main/java/at/favre/tools/uberadb/parser/DumpsysPackageParser.java on lines 100..105

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        return "PackageInfo{" +
                                "packageName='" + packageName + '\'' +
                                ", versionCode=" + versionCode +
                                ", versionName='" + versionName + '\'' +
                                ", codePath='" + codePath + '\'' +
            src/main/java/at/favre/tools/uberadb/parser/AdbDevice.java on lines 42..48

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        actions.add(new BugReportDeviceFileAction(
                                "\tcreate events logcat file and pull from device",
                                "/sdcard/bugreport_tempfile_logcat_events",
                                new File(tmpFolder, "events-" + dateTimeString + "-" + device.model + ".txt"),
                                new String[]{"logcat", "-b", "events", "-d", "-f", "/sdcard/bugreport_tempfile_logcat_events"}, "additional-logcat"));
            Severity: Minor
            Found in src/main/java/at/favre/tools/uberadb/actions/BugReport.java and 1 other location - About 45 mins to fix
            src/main/java/at/favre/tools/uberadb/actions/BugReport.java on lines 100..104

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 56.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        actions.add(new BugReportDeviceFileAction(
                                "\tcreate radio logcat file and pull from device",
                                "/sdcard/bugreport_tempfile_logcat_radio",
                                new File(tmpFolder, "radio-" + dateTimeString + "-" + device.model + ".txt"),
                                new String[]{"logcat", "-b", "radio", "-d", "-f", "/sdcard/bugreport_tempfile_logcat_radio"}, "additional-logcat"));
            Severity: Minor
            Found in src/main/java/at/favre/tools/uberadb/actions/BugReport.java and 1 other location - About 45 mins to fix
            src/main/java/at/favre/tools/uberadb/actions/BugReport.java on lines 95..99

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 56.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static void execute(AdbLocationFinder.LocationResult adbLocation, Arg arguments, CmdProvider cmdProvider, boolean preview, Commons.ActionResult actionResult, AdbDevice device) {
            Severity: Minor
            Found in src/main/java/at/favre/tools/uberadb/actions/Install.java - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (InstalledPackagesParser.wasSuccessfulUninstalled(uninstallCmdResult.out)) {
                                          actionResult.successCount++;
                                      } else {
                                          actionResult.failureCount++;
                                      }
              Severity: Major
              Found in src/main/java/at/favre/tools/uberadb/actions/PackageDependentAction.java - About 45 mins to fix

                Method createDumpSysFiles has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    private static List<File> createDumpSysFiles(File tmpFolder, String dateTimeString, AdbDevice device, AdbLocationFinder.LocationResult adbLocation, CmdProvider cmdProvider, Arg arguments) throws IOException {
                Severity: Minor
                Found in src/main/java/at/favre/tools/uberadb/actions/BugReport.java - About 45 mins to fix

                  Method findMatches has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public List<String> findMatches(String... moreFilters) {
                          Set<String> matchedPackages = new HashSet<>();
                  
                          List<String> filters = new ArrayList<>();
                          if (moreFilters != null && moreFilters.length > 0) {
                  Severity: Minor
                  Found in src/main/java/at/favre/tools/uberadb/parser/PackageMatcher.java - 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

                  Severity
                  Category
                  Status
                  Source
                  Language