workcraft/workcraft

View on GitHub
workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java

Summary

Maintainability
B
6 hrs
Test Coverage

Avoid too many return statements within this method.
Open

            if (runCommand("explorer", "%s", what)) return true;
Severity: Major
Found in workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java - About 30 mins to fix

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

          private static boolean editDesktop(File file) {
              try {
                  if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.EDIT)) {
                      return false;
                  }
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 64..74
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 76..86
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 88..98

      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 4 locations. Consider refactoring.
      Open

          private static boolean browseDesktop(URI uri) {
              try {
                  if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
                      return false;
                  }
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 64..74
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 88..98
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 100..110

      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 4 locations. Consider refactoring.
      Open

          private static boolean openDesktop(File file) {
              try {
                  if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
                      return false;
                  }
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 64..74
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 76..86
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 100..110

      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 4 locations. Consider refactoring.
      Open

          private static boolean mailDesktop(URI uri) {
              try {
                  if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.MAIL)) {
                      return false;
                  }
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 76..86
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 88..98
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 100..110

      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

          public static boolean edit(File file) {
              if (editDesktop(file)) return true;
              if (openSystemSpecific(file.getPath())) return true;
              LogUtils.logError("Cannot open an editor for '" + file.getPath() + "'");
              return false;
      Severity: Minor
      Found in workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java and 1 other location - About 40 mins to fix
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 50..55

      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 48.

      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

          public static boolean open(File file) {
              if (openDesktop(file)) return true;
              if (openSystemSpecific(file.getPath())) return true;
              LogUtils.logError("Cannot open a viewer for  '" + file.getPath() + "'");
              return false;
      Severity: Minor
      Found in workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java and 1 other location - About 40 mins to fix
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 57..62

      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 48.

      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

          public static boolean mail(URI uri) {
              if (mailDesktop(uri)) return true;
              if (openSystemSpecific(uri.toString())) return true;
              LogUtils.logError("Cannot open a mailer for '" + uri + "'");
              return false;
      Severity: Minor
      Found in workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java and 1 other location - About 35 mins to fix
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 43..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 46.

      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

          public static boolean browse(URI uri) {
              if (browseDesktop(uri)) return true;
              if (openSystemSpecific(uri.toString())) return true;
              LogUtils.logError("Cannot open a browser for '" + uri + "'");
              return false;
      Severity: Minor
      Found in workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java and 1 other location - About 35 mins to fix
      workcraft/WorkcraftCore/src/org/workcraft/utils/DesktopApi.java on lines 36..41

      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 46.

      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

      There are no issues that match your filters.

      Category
      Status