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

View on GitHub

Showing 11 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:

    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

      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