cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

File XRTrailRenderer.cs has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;
using UnityEngine;

namespace com.csutil.rendering
{

    File IndexService.cs has 254 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Collections.Generic;
    
    namespace UltraLiteDB
    {

      File ImmutableExtensions.cs has 254 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      using System;
      using System.Collections;
      using System.Collections.Generic;
      using System.Collections.Immutable;
      using System.Diagnostics;

        Method LinkToJsonModel has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
        Open

                public static bool LinkToJsonModel(this FieldView self, JObject root, JToken value) {
                    if (self is EnumFieldView enumFieldView && value?.Type == JTokenType.Integer) {
                        int posInEnum = int.Parse("" + value);
                        var enumValues = self.field.contentEnum;
                        enumFieldView.LinkToModel(enumValues[posInEnum], newVal => {

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

                void ShaderPropertiesGUI(Material material)
                {
                    // Use default labelWidth
                    EditorGUIUtility.labelWidth = 0f;
        
        

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

                private JArray ArrayUnpatch(JArray right, JObject patch)
                {
                    var toRemove = new List<JProperty>();
                    var toInsert = new List<JProperty>();
                    var toModify = new List<JProperty>();

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

            public void diff_cleanupSemanticLossless(List<Diff> diffs) {
              int pointer = 1;
              // Intentionally ignore the first and last element (don't need checking).
              while (pointer < diffs.Count - 1) {
                if (diffs[pointer - 1].operation == Operation.EQUAL &&

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

                private static Mat<T> Multiply(Mat<T> a, Mat<T> b) {
                    if (a.Width != b.Height)
                        throw new ArgumentException("Matrix A's width must match Matrix B's height.");
        
                    Mat<T> result = new Mat<T>(a.Height, b.Width, 1);

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

                public int UpsertBulk(string collection, IEnumerable<BsonDocument> docs, int batchSize = 5000, BsonAutoId autoId = BsonAutoId.ObjectId)
                {
                    if (collection.IsNullOrWhiteSpace()) throw new ArgumentNullException(nameof(collection));
                    if (docs == null) throw new ArgumentNullException(nameof(docs));
                    if (batchSize < 100 || batchSize > 100000) throw new ArgumentException("batchSize must be a value between 100 and 100000");
        CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Engine/Engine/Insert.cs on lines 48..62

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

        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 int InsertBulk(string collection, IEnumerable<BsonDocument> docs, int batchSize = 5000, BsonAutoId autoId = BsonAutoId.ObjectId)
                {
                    if (collection.IsNullOrWhiteSpace()) throw new ArgumentNullException(nameof(collection));
                    if (docs == null) throw new ArgumentNullException(nameof(docs));
                    if (batchSize < 100 || batchSize > 100000) throw new ArgumentException("batchSize must be a value between 100 and 100000");
        CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Engine/Engine/Insert.cs on lines 67..81

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

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

                private void WriteValue(BsonValue value)
                {
                    // use direct cast to better performance
                    switch (value.Type)
                    {

          Method stbi__zbuild_huffman has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private static int stbi__zbuild_huffman(stbi__zhuffman z, FakePtr<byte> sizelist, int num)
                  {
                      var i = 0;
                      var k = 0;
                      var code = 0;

            Method RecoveryDetectCollectionByIndexPages has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private static HashSet<uint> RecoveryDetectCollectionByIndexPages(UltraLiteEngine engine, HashSet<uint> initialPagesID, StringBuilder log)
                    {
                        var indexPages = new Dictionary<uint, bool>();
                        var dataPages = new HashSet<uint>();
            
            

              Method stbi__decode_jpeg_image has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      private int stbi__decode_jpeg_image()
                      {
                          var m = 0;
                          for (m = 0; m < 4; m++)
                          {

                Method AddViewForJsonSchemaField has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public async Task<V> AddViewForJsonSchemaField(V parentView, JsonSchema field, string fieldName) {
                            JTokenType type = field.GetJTokenType();
                            if (type == JTokenType.Boolean) {
                                return await AddAndInit(parentView, field, fieldName, await NewBoolFieldView(field));
                            }

                  Method UpdateAdjusted has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              public void UpdateAdjusted(Rect rect, float offset)
                              {
                                  switch (Type)
                                  {
                                      case RoundedType.Uniform:

                    Method stbi__process_scan_header has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            private int stbi__process_scan_header()
                            {
                                var i = 0;
                                var Ls = stbi__get16be();
                                scan_n = stbi__get8();

                      Method Recovery has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public static string Recovery(string filename)
                              {
                                  // if not exists, just exit
                                  if (!File.Exists(filename)) return "";
                      
                      

                        Method BuildField has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                public void BuildField(string Line, int StartAt)
                                {
                                    m_Index = StartAt;
                                    int Length = Line.Length;
                        
                        

                          Method ArrayPatch has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
                          Open

                                  private JArray ArrayPatch(JArray left, JObject patch)
                                  {
                                      var toRemove = new List<JProperty>();
                                      var toInsert = new List<JProperty>();
                                      var toModify = new List<JProperty>();

                          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