cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

Method InternalDecode has a Cognitive Complexity of 70 (exceeds 20 allowed). Consider refactoring.
Open

        private ImageResult InternalDecode(ColorComponents? requiredComponents, int bpc)
        {
            var pixelCount = 0;
            var channelCount = 0;
            var compression = 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

File RoundedRects.cs has 524 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using UnityEngine;
using UnityEngine.UI;

using RoundedCornerProperties = ThisOtherThing.UI.GeoUtils.RoundingProperties;

    File Tokenizer.cs has 520 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    
    

      Method patch_apply has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring.
      Open

          public Object[] patch_apply(List<Patch> patches, string text) {
            if (patches.Count == 0) {
              return new Object[] { text, new bool[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 load_jpeg_image has 196 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private byte[] load_jpeg_image(out int out_x, out int out_y, out int comp, int req_comp)
              {
                  out_x = out_y = comp = 0;
      
                  var n = 0;

        Method diff_cleanupMerge has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
        Open

            public void diff_cleanupMerge(List<Diff> diffs) {
              // Add a dummy entry at the end.
              diffs.Add(new Diff(Operation.EQUAL, string.Empty));
              int pointer = 0;
              int count_delete = 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

        File BsonValue.cs has 489 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        using System;
        using System.Diagnostics;
        using System.Text;
        using System.Collections;
        using System.Collections.Generic;

          File JsonDiffPatch.cs has 487 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          using System;
          using System.Collections.Generic;
          using System.IO;
          using System.Linq;
          using DiffMatchPatch;

            Method ReadNext has 191 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private Token ReadNext(bool eatWhitespace)
                    {
                        // remove whitespace before get next token
                        if (eatWhitespace) this.EatWhitespace();
            
            

              Method NewField has a Cognitive Complexity of 64 (exceeds 20 allowed). Consider refactoring.
              Open

                      public virtual JsonSchema NewField(string name, Type parentType, object pInstance = null, JToken jpInstance = null) {
                          MemberInfo model = parentType?.GetMember(name).First();
                          Type modelType = GetModelType(model);
                          JTokenType jTokenType = ToJTokenType(modelType, jpInstance);
                          AssertV3.IsNotNull(jTokenType, "jTokenType");

              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 stbi__bmp_parse_header has a Cognitive Complexity of 63 (exceeds 20 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");

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

                      private void ExpansionOfKnownRegionsHelper(byte[] image, byte[] trimap, int r, double c) {
                          int w = width;
                          int h = height;
                          // ... (Conversion logic) ...
                          for (var x = 0; x < w; ++x) {

              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

              File Fuse.cs has 456 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              using System.Text.RegularExpressions;
              using System.Collections.Generic;
              using System;
              
              namespace Fuse.NET

                File BmpDecoder.cs has 455 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                using System;
                using System.IO;
                using System.Runtime.InteropServices;
                using StbImageSharp.Utility;
                
                

                  File AsyncLock.cs has 445 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  using System;
                  using System.Diagnostics;
                  using System.Runtime.CompilerServices;
                  using System.Runtime.ExceptionServices;
                  using System.Runtime.InteropServices;

                    Method patch_splitMax has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring.
                    Open

                        public void patch_splitMax(List<Patch> patches) {
                          short patch_size = this.Match_MaxBits;
                          for (int x = 0; x < patches.Count; x++) {
                            if (patches[x].length1 <= patch_size) {
                              continue;

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

                            public bool SetCookie(Cookie cookie, bool saveToCookieFile = true) {
                                lock (cookieJarLock) {
                                    if (cookie.expirationDate.ToUnixTimestampUtc() <= 0) { }
                                    bool receivedCookieExpired = cookie.expirationDate.IsBefore(DateTimeV2.UtcNow);
                                    if (cookies.ContainsKey(cookie.name)) {

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

                            public JToken Unpatch(JToken right, JToken patch)
                            {
                                if (patch == null)
                                    return right;
                    
                    

                    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

                    Class ZioExtensions has 45 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                        public static class ZioExtensions {
                    
                            public static DirectoryEntry GetChildDir(this DirectoryEntry self, string subDirName, bool sanitize = true) {
                                subDirName.ThrowErrorIfNullOrEmpty("subDirName");
                                if (sanitize) { subDirName = Sanitize.SanitizeToDirName(subDirName); }

                      Class UIv2ContextMenu has 44 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          public static class UIv2ContextMenu {
                      
                              /// <summary> The priority value of the default Unity GameObject/UI menu </summary>
                              private const int priorityOfUiMenu = 6;
                              private const string UIv2menu = "GameObject/UI v2/";
                        Severity
                        Category
                        Status
                        Source
                        Language