groupdocs-conversion/GroupDocs.Conversion-for-Java-Dropwizard

View on GitHub

Showing 15 of 15 total issues

Method getPosibleConversions has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public String[] getPosibleConversions(String extension)
    {
        switch (extension)
        {
            default:

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

        private String[] csvTypes = { "ods", "xls", "xlsx", "xlsm", "xlsb", "csv", "xls2003", "xltx", "xltm", "tsv", "tiff", "tif", "jpeg", "jpg", "png", "gif", "bmp", "ico", "psd", "webp", "jp2", "pdf", "epub", "xps", "ppt", "pps", "pptx", "ppsx", "odp", "otp", "potx", "potm", "pptm", "ppsm", "doc", "docm", "docx", "dot", "dotm", "dotx", "rtf", "txt", "odt", "ott", "html", };
    src/main/java/com/groupdocs/ui/conversion/filter/DestinationTypesFilter.java on lines 9..9

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

    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

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

        private String[] tsvTypes = { "ods", "xls", "xlsx", "xlsm", "xlsb", "csv", "xls2003", "xltx", "xltm", "tsv", "tiff", "tif", "jpeg", "jpg", "png", "gif", "bmp", "ico", "psd", "webp", "jp2", "pdf", "epub", "xps", "ppt", "pps", "pptx", "ppsx", "odp", "otp", "potx", "potm", "pptm", "ppsm", "doc", "docm", "docx", "dot", "dotm", "dotx", "rtf", "txt", "odt", "ott", "html", };
    src/main/java/com/groupdocs/ui/conversion/filter/DestinationTypesFilter.java on lines 5..5

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

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

        @Override
        public String download(String path) throws IOException {
            if(path != null && !path.isEmpty()){
    
                String destinationPath = FilenameUtils.concat(conversionConfiguration.getResultDirectory(),path);

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

        protected String uploadFile(String documentUrl, InputStream inputStream, FormDataContentDisposition fileDetail, boolean rewrite, Map<String, Object> params) {
            InputStream uploadedInputStream = null;
            String pathname;
            try {
                String fileName;
    Severity: Minor
    Found in src/main/java/com/groupdocs/ui/common/resources/Resources.java - About 1 hr to fix

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

          private String[] webpTypes = { "ods", "xls", "xlsx", "xlsm", "xlsb", "xls2003", "xltx", "xltm", "tiff", "tif", "jpeg", "jpg", "png", "gif", "bmp", "ico", "psd", "svg", "webp", "jp2", "pdf", "epub", "xps", "ppt", "pps", "pptx", "ppsx", "odp", "otp", "potx", "potm", "pptm", "ppsm", "doc", "docm", "docx", "dot", "dotm", "dotx", "rtf", "odt", "ott", "html", };
      src/main/java/com/groupdocs/ui/conversion/filter/DestinationTypesFilter.java on lines 8..8

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

      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

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

          private String[] imageTypes = { "ods", "xls", "xlsx", "xlsm", "xlsb", "xls2003", "xltx", "xltm", "tiff", "tif", "jpeg", "jpg", "png", "gif", "bmp", "ico", "psd", "svg", "webp", "jp2", "pdf", "epub", "xps", "ppt", "pps", "pptx", "ppsx", "odp", "otp", "potx", "potm", "pptm", "ppsm", "doc", "docm", "docx", "dot", "dotm", "dotx", "rtf", "odt", "ott", "html", };
      src/main/java/com/groupdocs/ui/conversion/filter/DestinationTypesFilter.java on lines 10..10

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

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

          @Override
          public String download(String path) throws IOException {
              if(path != null && !path.isEmpty()){
      
                  String destinationPath = FilenameUtils.concat(conversionConfiguration.getResultDirectory(),path);

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

            public static void main(String[] args) throws Exception {
                if (args == null || args.length == 0 || (args.length == 1 && !COMMANDS.contains(args[0]))) {
                    logger.info("Command is not specified. Use default: server.");
                    args = args.length == 1 ? new String[]{SERVER_COMMAND, args[0]} : new String[]{SERVER_COMMAND, EXTERNAL_CONFIGURATION_FILE};
                }
        Severity: Minor
        Found in src/main/java/com/groupdocs/ui/common/MainService.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

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

            private void merge(Map<String, Object> defaultConfig, Map<String, Object> extConfig) {
                for (String key : defaultConfig.keySet()) {
                    if (extConfig.containsKey(key)) {
                        if (defaultConfig.get(key) instanceof Map) {
                            merge((Map<String, Object>) defaultConfig.get(key), (Map<String, Object>) extConfig.get(key));

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

            protected String uploadFile(String documentUrl, InputStream inputStream, FormDataContentDisposition fileDetail, boolean rewrite, Map<String, Object> params) {
                InputStream uploadedInputStream = null;
                String pathname;
                try {
                    String fileName;
        Severity: Minor
        Found in src/main/java/com/groupdocs/ui/common/resources/Resources.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

        Method uploadFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected String uploadFile(String documentUrl, InputStream inputStream, FormDataContentDisposition fileDetail, boolean rewrite, Map<String, Object> params) {
        Severity: Minor
        Found in src/main/java/com/groupdocs/ui/common/resources/Resources.java - About 35 mins to fix

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

              @Override
              public List<ConversionTypesEntity> loadFiles(FileTreeRequest fileTreeRequest) {
                  String currentPath = fileTreeRequest.getPath();
                  if (StringUtils.isEmpty(currentPath)) {
                      currentPath = globalConfiguration.getConversion().getFilesDirectory();

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

              @Override
              public void convert(ConversionPostedData postedData) {
                  String sourceType = FilenameUtils.getExtension(postedData.getGuid());
                  String destinationType = postedData.getDestinationType();
                  String destinationFile = FilenameUtils.removeExtension(FilenameUtils.getName(postedData.getGuid())) + "." + destinationType;

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

              @Override
              public int compare(File file1, File file2) {
          
                  if (file1.isDirectory() && file2.isFile())
                      return -1;

          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