patrickfav/density-converter

View on GitHub

Showing 116 of 116 total issues

File GUIController.java has 523 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  Copyright 2016 Patrick Favre-Bulle
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
Severity: Major
Found in src/main/java/at/favre/tools/dconvert/ui/GUIController.java - About 1 day to fix

    Method onCreate has 187 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void onCreate(final Stage stage, IPreferenceStore store, ResourceBundle bundle) {
            this.bundle = bundle;
            this.preferenceStore = store;
    
            setupLayout();
    Severity: Major
    Found in src/main/java/at/favre/tools/dconvert/ui/GUIController.java - About 7 hrs to fix

      File Arguments.java has 439 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       *  Copyright 2016 Patrick Favre-Bulle
       *
       *  Licensed under the Apache License, Version 2.0 (the "License");
       *  you may not use this file except in compliance with the License.
      Severity: Minor
      Found in src/main/java/at/favre/tools/dconvert/arg/Arguments.java - About 6 hrs to fix

        Method equals has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
        
        
        Severity: Minor
        Found in src/main/java/at/favre/tools/dconvert/arg/Arguments.java - About 6 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 execute has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            public void execute(Arguments args, boolean blockingWaitForFinish, HandlerCallback callback) {
                beginMs = System.currentTimeMillis();
                handlerCallback = callback;
        
                logStringBuilder.append("registered image readers:\n").append(getRegisteredImageReadersAndWriters()).append("\n");
        Severity: Minor
        Found in src/main/java/at/favre/tools/dconvert/DConvert.java - About 5 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 runImageOptimizer has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            public static Result runImageOptimizer(File rawFile, ImageType processedType, String[] args, boolean keepOriginal, String outExtension) throws IOException {
                if (Arguments.getImageType(rawFile) == processedType && rawFile.exists() && rawFile.isFile()) {
                    String id = UUID.randomUUID().toString().substring(0, 8);
        
                    File outFile = getFileWithPostFix(rawFile, "_optimized_" + id, outExtension);
        Severity: Minor
        Found in src/main/java/at/favre/tools/dconvert/util/PostProcessorUtil.java - About 5 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 has 128 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static Arguments parse(String[] args) {
                ResourceBundle strings = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());
                Options options = setupOptions(strings);
                CommandLineParser parser = new DefaultParser();
        
        
        Severity: Major
        Found in src/main/java/at/favre/tools/dconvert/ui/CLIInterpreter.java - About 5 hrs to fix

          Method build has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

                  public Arguments build() throws InvalidArgumentException {
                      if (!internalSkipParamValidation) {
                          ResourceBundle bundle = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());
          
                          if (platform.isEmpty()) {
          Severity: Minor
          Found in src/main/java/at/favre/tools/dconvert/arg/Arguments.java - About 4 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 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              public static Arguments parse(String[] args) {
                  ResourceBundle strings = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());
                  Options options = setupOptions(strings);
                  CommandLineParser parser = new DefaultParser();
          
          
          Severity: Minor
          Found in src/main/java/at/favre/tools/dconvert/ui/CLIInterpreter.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 execute has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void execute(Arguments args, boolean blockingWaitForFinish, HandlerCallback callback) {
                  beginMs = System.currentTimeMillis();
                  handlerCallback = callback;
          
                  logStringBuilder.append("registered image readers:\n").append(getRegisteredImageReadersAndWriters()).append("\n");
          Severity: Major
          Found in src/main/java/at/favre/tools/dconvert/DConvert.java - About 3 hrs to fix

            Method onJobFinished has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                    synchronized void onJobFinished(Result result) {
                        if (!canceled) {
                            currentJobCount++;
            
                            if (result != null) {
            Severity: Minor
            Found in src/main/java/at/favre/tools/dconvert/WorkerHandler.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

            Builder has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public static class Builder {
                    private File dst;
                    private float srcScale;
                    private File src = null;
                    private EScaleMode scaleType = DEFAULT_SCALE_TYPE;
            Severity: Minor
            Found in src/main/java/at/favre/tools/dconvert/arg/Arguments.java - About 3 hrs to fix

              Method saveToFile has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  public List<File> saveToFile(File targetFile, LoadedImage imageData, Dimension targetDimension, boolean isNinePatch) throws Exception {
              
                      List<File> files = new ArrayList<>(2);
                      List<ImageType.ECompression> compressionList = Arguments.getOutCompressionForType(args.outputCompressionMode, Arguments.getImageType(imageData.getSourceFile()));
                      for (ImageType.ECompression compression : compressionList) {

              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 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  public Result convert(File srcImage, Arguments args) {
                      try {
                          File destinationFolder = args.dst;
                          LoadedImage imageData = ImageUtil.loadImage(srcImage);

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

                      @Override
                      public void handle(ActionEvent event) {
                          directoryChooser.setTitle(bundle.getString("main.dirchooser.titel"));
                          File dir = new File(textFieldPath.getText());
              
              
              Severity: Minor
              Found in src/main/java/at/favre/tools/dconvert/ui/GUIController.java - 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 getFromUI has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public Arguments getFromUI(boolean skipValidation) throws InvalidArgumentException {
                      float scale = Arguments.DEFAULT_SCALE;
              
                      try {
                          scale = rbFactor.isSelected() ? (float) scaleSlider.getValue() : Float.valueOf(textFieldDp.getText());
              Severity: Minor
              Found in src/main/java/at/favre/tools/dconvert/ui/GUIController.java - About 1 hr to fix

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

                        @Override
                        public void resize(BufferedImage srcImage, BufferedImage destImage)
                                throws NullPointerException {
                            super.performChecks(srcImage, destImage);
                
                

                  Method main has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static void main(String[] rawArgs) {
                  
                          if (rawArgs.length < 1) {
                              new GUI().launchApp(rawArgs);
                              return;
                  Severity: Minor
                  Found in src/main/java/at/favre/tools/dconvert/Main.java - About 1 hr to fix

                    Method runImageOptimizer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static Result runImageOptimizer(File rawFile, ImageType processedType, String[] args, boolean keepOriginal, String outExtension) throws IOException {
                            if (Arguments.getImageType(rawFile) == processedType && rawFile.exists() && rawFile.isFile()) {
                                String id = UUID.randomUUID().toString().substring(0, 8);
                    
                                File outFile = getFileWithPostFix(rawFile, "_optimized_" + id, outExtension);
                    Severity: Minor
                    Found in src/main/java/at/favre/tools/dconvert/util/PostProcessorUtil.java - About 1 hr to fix

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

                              public BufferedImage doFilter(BufferedImage img, BufferedImage dest, int dstWidth, int dstHeight) {
                                  BufferedImage ret = img;
                                  int w, h;
                      
                                  w = img.getWidth();

                      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