cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

Method stbi__process_frame_header has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
Open

        private int stbi__process_frame_header(int scan)
        {
            var Lf = 0;
            var p = 0;
            var i = 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 GenerateMesh has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public void GenerateMesh(GameObject owner, bool dynamic, int totalElements, bool setMesh = true)
        {
            // Precache neccessary data
            // The mesh, vertex and triangle counts
            if (m_Mesh == null)

    Method CreateInstance has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public static object CreateInstance(Type type)
            {
                try
                {
                    if (_cacheCtor.TryGetValue(type, out CreateObject c))

      Method InternalSearch has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private SearchResult InternalSearch(List<Bitap<T>> tokenSearchers, Bitap<T> fullSearcher)
              {
                  var resultMap = new Dictionary<int, AnalyzeResult>();
                  var results = new List<AnalyzeResult>();
                  var output = new AnalyzeOutput

        File ActionMenu.cs has 259 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        using com.csutil;
        using com.csutil.keyvaluestore;
        using com.csutil.ui;
        using System;
        using System.Collections.Generic;

          Method diff_fromDelta has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public List<Diff> diff_fromDelta(string text1, string delta) {
                List<Diff> diffs = new List<Diff>();
                int pointer = 0;  // Cursor in text1
                string[] tokens = delta.Split(new string[] { "\t" },
                    StringSplitOptions.None);

            Class LoadAndSaveExtensions has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public static class LoadAndSaveExtensions {
            
                    public static void SaveStream(this FileInfo self, Stream streamToSave) {
                        using (var fileStream = File.Create(self.FullName)) { streamToSave.CopyTo(fileStream); }
                    }

              Method BuildEntityMapper has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      protected virtual EntityMapper BuildEntityMapper(Type type)
                      {
                          var mapper = new EntityMapper
                          {
                              Members = new List<MemberMapper>(),

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

                        public static FileInfo GetChild(this DirectoryInfo self, string fileName, bool assertThatChildMustExist = false, bool sanitize = true) {
                            fileName.ThrowErrorIfNullOrEmpty("fileName");
                            if (sanitize) { fileName = Sanitize.SanitizeToFileName(fileName); }
                            AssertV3.AreEqual(fileName, Sanitize.SanitizeToFileName(fileName));
                            var c = new FileInfo(self.FullPath() + fileName);
                CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/io/FileExtensions.cs on lines 9..18

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

                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 DirectoryInfo GetChildDir(this DirectoryInfo self, string subDirName, bool assertThatChildMustExist = false, bool sanitize = true) {
                            subDirName.ThrowErrorIfNullOrEmpty("subDirName");
                            if (sanitize) { subDirName = Sanitize.SanitizeToDirName(subDirName); }
                            AssertV3.AreEqual(subDirName, Sanitize.SanitizeToDirName(subDirName));
                            var c = new DirectoryInfo(self.FullPath() + subDirName);
                CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/io/FileExtensions.cs on lines 20..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 159.

                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

                            for (int i = 0; i < inPointsCount; i++) {
                                inCentroid += new Vector3(inPoints[i].X, inPoints[i].Y, inPoints[i].Z) * refPoints[i].W;
                                inTotal += refPoints[i].W;
                                refCentroid += new Vector3(refPoints[i].X, refPoints[i].Y, refPoints[i].Z) * refPoints[i].W;
                                refTotal += refPoints[i].W;
                CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/math/KabschAlgorithmTests.cs on lines 51..56

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

                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 float CellsTailEdge {
                            get {
                                if (scrollDirection == Direction.Vertical) {
                                    if (scrollReverse) {
                                        return cells.Count > 0 ? cells.Last.Value.Top : contentPadding.top;
                CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/VirtualizedScrollRect/BaseController.cs on lines 326..343

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

                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

                                for (int i = 0; i < inPoints.Length; i++) {
                                    inCentroid += new Vector3(inPoints[i].x, inPoints[i].y, inPoints[i].z) * refPoints[i].w;
                                    inTotal += refPoints[i].w;
                                    refCentroid += new Vector3(refPoints[i].x, refPoints[i].y, refPoints[i].z) * refPoints[i].w;
                                    refTotal += refPoints[i].w;
                CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/algorithms/KabschAlgorithm.cs on lines 33..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 158.

                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 float CellsHeadEdge {
                            get {
                                if (scrollDirection == Direction.Vertical) {
                                    if (scrollReverse) {
                                        return cells.Count > 0 ? cells.First.Value.Bottom : contentPadding.bottom;
                CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/VirtualizedScrollRect/BaseController.cs on lines 345..362

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

                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 diff_cleanupSemanticLossless has 53 lines of code (exceeds 25 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 &&

                  Method ArrayPatch has 53 lines of code (exceeds 25 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>();

                    Method BoxFilterSingleChannel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public static double[] BoxFilterSingleChannel(double[] img, int width, int height, int radius, int channels) {
                                var kernalSize = 2 * radius;
                    
                                if (kernalSize % 2 == 0) kernalSize++;
                                var hBlur = new double[img.Length];

                      Method ReadNextLine has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private string ReadNextLine(ref int Cursor, ChangeBufferFunction ChangeBuffer)
                              {
                                  //Debug.Assert(m_Buffer != null, "There's no buffer");
                                  //Debug.Assert((Cursor >= 0) & (Cursor <= m_CharsRead), "The cursor is out of range");
                      
                      

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

                                [Conditional("DEBUG"), Conditional("ENFORCE_ASSERTIONS")]
                                public static void IsEqualToPersisted(string id, object o, params object[] args) {
                                    args = new StackTrace(1, true).AddTo(args);
                                    var persisted = IoC.inject.GetOrAddSingleton<PersistedRegression>(o);
                                    persisted.AssertEqualToPersisted(id, o).ContinueWithSameContext((Task t) => {
                        CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/logging/AssertV3.cs on lines 65..72

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

                        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

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

                                [Conditional("DEBUG"), Conditional("ENFORCE_ASSERTIONS")]
                                public static void IsEqualToPersisted(string id, object o, params object[] args) {
                                    args = new StackTrace(1, true).AddTo(args);
                                    var persisted = IoC.inject.GetOrAddSingleton<PersistedRegression>(o);
                                    persisted.AssertEqualToPersisted(id, o).ContinueWithSameContext((Task t) => {
                        CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/logging/AssertV2.cs on lines 64..71

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language