cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

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

                    if (typeof(T) == typeof(double)) {
                        double sum = 0;
                        for (int k = 0; k < a.Width; k++) {
                            result.data[i * result.Width + j] = (T)(object)(((double)(object)a.data[i * a.Width + k] * (double)(object)b.data[k * b.Width + j]));
                        }
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 99..104
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 105..110
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 117..122

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

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

                    if (typeof(T) == typeof(float)) {
                        float sum = 0;
                        for (int k = 0; k < a.Width; k++) {
                            result.data[i * result.Width + j] = (T)(object)(((float)(object)a.data[i * a.Width + k] * (float)(object)b.data[k * b.Width + j]));
                        }
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 99..104
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 111..116
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 117..122

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

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

                    if (typeof(T) == typeof(byte)) {
                        byte sum = 0;
                        for (int k = 0; k < a.Width; k++) {
                            result.data[i * result.Width + j] = (T)(object)(((byte)(object)a.data[i * a.Width + k] * (byte)(object)b.data[k * b.Width + j]));
                        }
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 99..104
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 105..110
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/images/Mat.cs on lines 111..116

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

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

        public void Delete(CollectionIndex index, PageAddress nodeAddress)
        {
            var node = this.GetNode(nodeAddress);
            var page = node.Page;

    Method stbi__psd_decode_rle has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private int stbi__psd_decode_rle(FakePtr<byte> p, int pixelCount)
            {
                var count = 0;
                var nleft = 0;
                var len = 0;

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

              public static Vector3 CalcMean(this IEnumerable<Vector3> sequence) {
                  sequence = sequence.Cached();
                  var x = sequence.CalcMean(v => v.X);
                  var y = sequence.CalcMean(v => v.Y);
                  var z = sequence.CalcMean(v => v.Z);
      CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/math/CalculateMedian.cs on lines 40..46

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

      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 static Vector3 CalcMedian(this IEnumerable<Vector3> sequence) {
                  sequence = sequence.Cached(); 
                  var x = sequence.CalcMedian(v => v.X);
                  var y = sequence.CalcMedian(v => v.Y);
                  var z = sequence.CalcMedian(v => v.Z);
      CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/math/CalculateAverage.cs on lines 23..29

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

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

              void SetupMeshBackend()
              {
                  if (m_MeshRenderer == null)
                      m_MeshRenderer = GetComponent<MeshRenderer>();
      
      

        Method InternalDecode has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                private ImageResult InternalDecode(ColorComponents? requiredComponents)
                {
                    var req_comp = requiredComponents.ToReqComp();
                    if (req_comp < 0 || req_comp > 4)
                        stbi__err("bad req_comp");

          Method stbi__parse_zlib has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private int stbi__parse_zlib(int parse_header)
                  {
                      var final = 0;
                      var type = 0;
                      if (parse_header != 0)

            Method ArrayHasChanged has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private bool ArrayHasChanged()
                    {
                        int lowerBound = 0;
                        int upperBound = 0;
            
            

              Method TestRunTaskInBackground has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      [UnityTest]
                      public IEnumerator TestRunTaskInBackground() {
              
                          var queue = BackgroundTaskQueue.NewBackgroundTaskQueue(1);
              
              

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

                        public void Write(Single value)
                        {
                            var pi = BitConverter.GetBytes(value);
                
                            _buffer[_pos + 0] = pi[0];
                CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Utils/ByteWriter.cs on lines 82..92
                CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Utils/ByteWriter.cs on lines 120..130

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

                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

                        public void Write(Int32 value)
                        {
                            var pi = BitConverter.GetBytes(value);
                
                            _buffer[_pos + 0] = pi[0];
                CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Utils/ByteWriter.cs on lines 82..92
                CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Utils/ByteWriter.cs on lines 148..158

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

                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

                        public void Write(UInt32 value)
                        {
                            var pi = BitConverter.GetBytes(value);
                
                            _buffer[_pos + 0] = pi[0];
                CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Utils/ByteWriter.cs on lines 120..130
                CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Utils/ByteWriter.cs on lines 148..158

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

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

                        public static bool Test(Stream stream)
                        {
                            try
                            {
                                stream.stbi__get8();

                  Method RunFloodFill has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public static byte[] RunFloodFill(this ImageResult self, int colorThreshold = 240) {
                  
                              var image = self.Data;
                  
                              var width = self.Width;

                    Method Get has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public static float Get(this Matrix4x4 self, int rowIndex, int columnIndex) {
                                if (rowIndex < 0 || rowIndex > 3 || columnIndex < 0 || columnIndex > 3) {
                                    throw new ArgumentOutOfRangeException("Row and column indices must be between 0 and 3 inclusive.");
                                }
                                switch (rowIndex) {

                      Method TestRunTaskInBackground has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              [UnityTest]
                              public IEnumerator TestRunTaskInBackground() {
                      
                                  var task1WasStarted = false;
                                  var task1ReachedItsLoopEnd = false;

                        Method ProcessPrioritizedAndBatchedTasks has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                        Open

                                private void ProcessPrioritizedAndBatchedTasks() {
                                    bool continueProcessing = true;
                                    while (!_disposeCancellation.IsCancellationRequested && continueProcessing) {
                                        try {
                        
                        

                        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