patrickfav/Dali

View on GitHub

Showing 76 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 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 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 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 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 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

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

            package at.favre.lib.dali.blur.algorithms;
            
            import android.graphics.Bitmap;
            
            import androidx.renderscript.Allocation;
            dali/src/main/java/at/favre/lib/dali/blur/algorithms/RenderScriptBox3x3Blur.java on lines 1..38
            dali/src/main/java/at/favre/lib/dali/blur/algorithms/RenderScriptBox5x5Blur.java on lines 1..38

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

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

            package at.favre.lib.dali.blur.algorithms;
            
            import android.graphics.Bitmap;
            
            import androidx.renderscript.Allocation;
            dali/src/main/java/at/favre/lib/dali/blur/algorithms/RenderScriptBox3x3Blur.java on lines 1..38
            dali/src/main/java/at/favre/lib/dali/blur/algorithms/RenderScriptGaussian5x5Blur.java on lines 1..38

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

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

            package at.favre.lib.dali.blur.algorithms;
            
            import android.graphics.Bitmap;
            
            import androidx.renderscript.Allocation;
            dali/src/main/java/at/favre/lib/dali/blur/algorithms/RenderScriptBox5x5Blur.java on lines 1..38
            dali/src/main/java/at/favre/lib/dali/blur/algorithms/RenderScriptGaussian5x5Blur.java on lines 1..38

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

            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 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);
                  
                  
                    Severity
                    Category
                    Status
                    Source
                    Language