cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

Method stbi__convert_format has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public static byte[] stbi__convert_format(byte[] data, int img_n, int req_comp, uint x, uint y)
        {
            int i = 0;
            int j = 0;
            if ((req_comp) == (img_n))

    Method stbi__bmp_parse_header has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private void stbi__bmp_parse_header(ref stbi__bmp_data info)
            {
                var hsz = 0;
                if (stbi__get8() != 'B' || stbi__get8() != 'M')
                    stbi__err("not BMP");

      Method ParseDelimitedLine has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private string[] ParseDelimitedLine()
              {
                  string Line = ReadNextDataLine();
                  if (Line == null)
                      return null;

        File BaseController.cs has 324 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        using System.Collections.Generic;
        using com.csutil;
        using UnityEngine;
        using UnityEngine.EventSystems;
        using UnityEngine.UI;

          Method GetBitapSearch has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
          Open

                  private BitapResult GetBitapSearch(string text)
                  {
                      var expectedLocation = _options.location;
                      var textLen = text.Length;
                      var currentThreshold = _options.threshold;

          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 Info has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
          Open

                  public static ImageInfo? Info(Stream stream)
                  {
                      try
                      {
                          var tga_w = 0;

          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 ThreadBasedDispatchLoop has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
          Open

                  private void ThreadBasedDispatchLoop(Action threadInit, Action threadFinally) {
                      if (threadInit != null) threadInit();
                      try {
                          // If the scheduler is disposed, the cancellation token will be set and
                          // we'll receive an OperationCanceledException.  That OCE should not crash the process.

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

                  private static string GetBlockPattern()
                  {
                      // Hashify HTML blocks:
                      // We only want to do this for block-level HTML tags, such as headers,
                      // lists, and tables. That's because we still want to wrap <p>s around

            Method diff_bisect has 91 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected List<Diff> diff_bisect(string text1, string text2,
                    DateTime deadline) {
                  // Cache the text lengths to prevent multiple calls.
                  int text1_length = text1.Length;
                  int text2_length = text2.Length;

              Method stbi__process_gif_raster has 91 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      private byte[] stbi__process_gif_raster()
                      {
                          byte lzw_cs = 0;
                          var len = 0;
                          var init_code = 0;

                Method stbi__convert_format has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                Open

                        public static byte[] stbi__convert_format(byte[] data, int img_n, int req_comp, uint x, uint y)
                        {
                            int i = 0;
                            int j = 0;
                            if ((req_comp) == (img_n))

                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 DoPropagateIteration has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
                Open

                        private void DoPropagateIteration(byte[] trimap, List<Point> foregroundBoundary, List<Point> backgroundBoundary, Sample[][] samples, int w, int h) {
                
                            // Create and shuffle coordinate points
                            List<Point> coords1 = new List<Point>(h * w);
                            for (int y = 0; y < h; ++y)

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

                        static void AddRoundedRectVerticesRing(
                            ref VertexHelper vh,
                            Vector2 center,
                            float width,
                            float height,

                  Method BoxFilter has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          private static byte[] BoxFilter(byte[] img, int width, int height, int radius, int channels) {
                              var kernalSize = 2 * radius;
                              if (kernalSize % 2 == 0) kernalSize++;
                              var hBlur = new byte[img.Length];
                              var avg = (float)1 / kernalSize;

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

                            private void MoveCellLastToFirst() {
                                if (cells.Count == 0) return;
                    
                                BaseCell<T> lastCell = cells.Last.Value;
                                BaseCell<T> firstCell = cells.First.Value;
                    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/VirtualizedScrollRect/BaseController.cs on lines 228..253

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

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

                            private void MoveCellFirstToLast() {
                                if (cells.Count == 0) return;
                    
                                BaseCell<T> firstCell = cells.First.Value;
                                BaseCell<T> lastCell = cells.Last.Value;
                    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/VirtualizedScrollRect/BaseController.cs on lines 255..280

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

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

                            public Task<bool> TryLockAsync(Func<Task> callback, CancellationToken cancel)
                            {
                                var @lock = new InnerLock(this, _asyncId.Value, ThreadId);
                                _asyncId.Value = Interlocked.Increment(ref AsyncLock.AsyncStackCounter);
                    
                    
                    CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/AsyncLock/AsyncLock.cs on lines 369..400

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

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

                            public Task<bool> TryLockAsync(Func<Task> callback, TimeSpan timeout)
                            {
                                var @lock = new InnerLock(this, _asyncId.Value, ThreadId);
                                _asyncId.Value = Interlocked.Increment(ref AsyncLock.AsyncStackCounter);
                    
                    
                    CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/AsyncLock/AsyncLock.cs on lines 436..467

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

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

                            private int stbi__process_frame_header(int scan)
                            {
                                var Lf = 0;
                                var p = 0;
                                var i = 0;

                      Class GameObjectExtensions has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          public static class GameObjectExtensions {
                      
                              /// <summary> Adds a child GameObject to the calling new parent GameObject </summary>
                              public static GameObject AddChild(this GameObject parentGo, GameObject child, bool worldPositionStays = false, int siblingIndex = -1) {
                                  AssertParentNotInChildGoTree(parentGo, child, "" + parentGo);
                        Severity
                        Category
                        Status
                        Source
                        Language