patrickfav/Dali

View on GitHub

Showing 40 of 76 total issues

Method blur has 155 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public Bitmap blur(int radius, Bitmap original) {
        if (radius < 1) {
            return (null);
        }
Severity: Major
Found in dali/src/main/java/at/favre/lib/dali/blur/algorithms/StackBlur.java - About 6 hrs to fix

    Method blur has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public Bitmap blur(int radius, Bitmap original) {
            if (radius < 1) {
                return (null);
            }
    Severity: Minor
    Found in dali/src/main/java/at/favre/lib/dali/blur/algorithms/StackBlur.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 boxBlurVertical has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        private static void boxBlurVertical(int[] pixels, int w, int h,
                                            int halfRange) {
    
            int[] newColors = new int[h];
            int oldPixelOffset = -(halfRange + 1) * w;
    Severity: Minor
    Found in dali/src/main/java/at/favre/lib/dali/blur/algorithms/BoxBlur.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 renderBlurLayer has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        private void renderBlurLayer(float slideOffset) {
            if (enableBlur) {
                if (slideOffset == 0 || forceRedraw) {
                    clearBlurView();
                }

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

        private Bitmap process() {
            PerformanceProfiler profiler = new PerformanceProfiler("blur image task [" + builderData.tag + "] started at " + BenchmarkUtil.getCurrentTime(), Dali.getConfig().debugMode);
            try {
    
                final String cacheKey = BuilderUtil.getCacheKey(builderData);
    Severity: Major
    Found in dali/src/main/java/at/favre/lib/dali/builder/blur/BlurWorker.java - About 3 hrs to fix

      BlurBuilder has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class BlurBuilder extends ABuilder {
          private static final String TAG = BlurBuilder.class.getSimpleName();
          private static final int FADE_IN_MS = 200;
      
          private BlurData data;
      Severity: Minor
      Found in dali/src/main/java/at/favre/lib/dali/builder/blur/BlurBuilder.java - About 2 hrs to fix

        Method onCreateView has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                binding = DataBindingUtil.inflate(inflater, R.layout.fragment_simple_blur, container, false);
        
                Dali dali = Dali.create(getActivity());

          Method boxBlurHorizontal has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              private static void boxBlurHorizontal(int[] pixels, int w, int h,
                                                    int halfRange) {
                  int index = 0;
                  int[] newColors = new int[w];
          
          
          Severity: Minor
          Found in dali/src/main/java/at/favre/lib/dali/blur/algorithms/BoxBlur.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

          Dali has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public final class Dali {
              public static final int NO_RESID = -1;
              private static final String TAG = Dali.class.getSimpleName();
              private static TwoLevelCache DISK_CACHE_MANAGER;
              private static ExecutorManager EXECUTOR_MANAGER;
          Severity: Minor
          Found in dali/src/main/java/at/favre/lib/dali/Dali.java - About 2 hrs to fix

            Method process has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                private Bitmap process() {
                    PerformanceProfiler profiler = new PerformanceProfiler("blur image task [" + builderData.tag + "] started at " + BenchmarkUtil.getCurrentTime(), Dali.getConfig().debugMode);
                    try {
            
                        final String cacheKey = BuilderUtil.getCacheKey(builderData);
            Severity: Minor
            Found in dali/src/main/java/at/favre/lib/dali/builder/blur/BlurWorker.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 synchronouslyLoadBitmap has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public Bitmap synchronouslyLoadBitmap(Resources resources) {
                    if (bitmap != null) {
                        if (decoderOptions != null && decoderOptions.inSampleSize > 1) {
                            return Bitmap.createScaledBitmap(bitmap, bitmap.getWidth() / decoderOptions.inSampleSize, bitmap.getHeight() / decoderOptions.inSampleSize, false);
                        } else {
            Severity: Minor
            Found in dali/src/main/java/at/favre/lib/dali/builder/ImageReference.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 putBitmapToDiskCache has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public boolean putBitmapToDiskCache(Bitmap bitmap, String cacheKey) {
                    Precondition.checkArgument("disk cache disabled", useDiskCache);
            
                    if (getDiskCache() != null) {
                        OutputStream out = null;
            Severity: Minor
            Found in dali/src/main/java/at/favre/lib/dali/builder/TwoLevelCache.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 into has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public JobDescription into(final ImageView imageView) {
                    if (data.placeholder != Dali.NO_RESID) {
                        imageView.setImageResource(data.placeholder);
                    }
            
            
            Severity: Minor
            Found in dali/src/main/java/at/favre/lib/dali/builder/blur/BlurBuilder.java - About 1 hr to fix

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

                  private static void boxBlurVertical(int[] pixels, int w, int h,
                                                      int halfRange) {
              
                      int[] newColors = new int[h];
                      int oldPixelOffset = -(halfRange + 1) * w;
              Severity: Minor
              Found in dali/src/main/java/at/favre/lib/dali/blur/algorithms/BoxBlur.java - About 1 hr to fix

                Method updateBlurView has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public boolean updateBlurView() {
                        try {
                            Dali.logD(TAG, "update");
                            if (!BuilderUtil.isOnUiThread()) {
                                Dali.logD(TAG, "Not on ui thread");

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

                    private static void boxBlurHorizontal(int[] pixels, int w, int h,
                                                          int halfRange) {
                        int index = 0;
                        int[] newColors = new int[w];
                
                
                Severity: Minor
                Found in dali/src/main/java/at/favre/lib/dali/blur/algorithms/BoxBlur.java - About 1 hr to fix

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

                      @Override
                      protected void onCreate(Bundle savedInstanceState) {
                          super.onCreate(savedInstanceState);
                          setContentView(R.layout.activity_nav_drawer);
                  
                  

                    Method updateBlurView has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public boolean updateBlurView() {
                            try {
                                Dali.logD(TAG, "update");
                                if (!BuilderUtil.isOnUiThread()) {
                                    Dali.logD(TAG, "Not on ui thread");

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

                          public void printResultToLog(String tag) {
                              if (isActivated) {
                                  StringBuilder sb = new StringBuilder("->\nLog profile for task " + description + " - " + BenchmarkUtil.formatNum(getDurationMs(), "0.##") + "ms\n----------------------------------------\n");
                                  for (Duration duration : durations) {
                                      String logMsg = " * " + duration.getTaskDescription();

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

                          public void start(final ImageView imageView) {
                              if (listener != null) {
                                  listener.onAnimationStart();
                              }
                              long duration = 0;
                        Severity
                        Category
                        Status
                        Source
                        Language