cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

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

        private List<FuseResult<T>> Format(List<AnalyzeResult> results)
        {
            var finalOutput = new List<FuseResult<T>>();
            var transformers = new List<TransformResult>();

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

        private int stbi__parse_zlib(int parse_header)
        {
            var final = 0;
            var type = 0;
            if (parse_header != 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

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

        private static List<List<string>> FilterForChanges(List<List<string>> oldData, List<List<string>> newData) {
            var filtered = new List<List<string>>();
            for (int i = 0; i < newData.Count; i++) {
                var newLine = newData[i];
                if (oldData.Count <= i || ChangeFound(oldData[i], newLine)) { filtered.Add(newLine); }
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/datastructures/keyvaluestore/GoogleSheetsKeyValueStore.cs on lines 94..101

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

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

        private static List<List<string>> FilterForChanges(List<List<string>> oldData, List<List<string>> newData) {
            var filtered = new List<List<string>>();
            for (int i = 0; i < newData.Count; i++) {
                var newLine = newData[i];
                if (oldData.Count <= i || ChangeFound(oldData[i], newLine)) { filtered.Add(newLine); }
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/datastructures/keyvaluestore/GoogleSheetsKeyValueStoreV2.cs on lines 77..84

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

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

        private async Task RunTestTask() {

            var store = new ObservableKeyValueStore(new InMemoryKeyValueStore());

            await store.ShowDebugUiScreen();

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

            {
                var offset = elementIndex * 4;
    
                m_ShapeData[offset] = new Vector4(0, 0, startSize, endSize);
                m_ShapeData[offset + 1] = new Vector4(1, 0, startSize, endSize);
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/rendering/lines/Runtime/XRMeshChain.cs on lines 267..273

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

    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 uint[] ToURationalFraction(byte[] data)
            {
                var numeratorData = new byte[4];
                var denominatorData = new byte[4];
    
    
    CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/StbImageSharp/ExifLib/ExifReader.cs on lines 343..355

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

    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

            {
                var offset = elementIndex * 4;
                m_ShapeData[offset] = new Vector4(0, 0, sizeModification, sizeModification);
                m_ShapeData[offset + 1] = new Vector4(1, 0, sizeModification, sizeModification);
                m_ShapeData[offset + 2] = new Vector4(1, 1, sizeModification, sizeModification);
    CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/rendering/lines/Runtime/XRMeshChain.cs on lines 282..289

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

    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 int[] ToRationalFraction(byte[] data)
            {
                var numeratorData = new byte[4];
                var denominatorData = new byte[4];
    
    
    CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/StbImageSharp/ExifLib/ExifReader.cs on lines 309..321

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

    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

                if (patch.Type == JTokenType.Object)
                {
                    var patchObj = (JObject)patch;
                    JProperty arrayDiffCanary = patchObj.Property("_t");
    
    
    CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/JsonDotNet/JsonDiffPatch/JsonDiffPatch.cs on lines 87..102

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

    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

                if (patch.Type == JTokenType.Object)
                {
                    var patchObj = (JObject)patch;
                    JProperty arrayDiffCanary = patchObj.Property("_t");
    
    
    CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/JsonDotNet/JsonDiffPatch/JsonDiffPatch.cs on lines 171..186

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

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

            private static Dictionary<SystemLanguage, string> InitLanguageToCodeMapping() {
                var map = new Dictionary<SystemLanguage, string>(); // Serializable subclass of normal Dictionary
                map.Add(SystemLanguage.Afrikaans, "af");
                map.Add(SystemLanguage.Arabic, "ar");
                map.Add(SystemLanguage.Basque, "eu");

      Method diff_lineMode has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private List<Diff> diff_lineMode(string text1, string text2,
                                           DateTime deadline) {
            // Scan the text on a line-by-line basis first.
            Object[] a = diff_linesToChars(text1, text2);
            text1 = (string)a[0];

        Method PersistDirtyPages has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public void PersistDirtyPages()
                {
                    // get header page
                    var header = _pager.GetPage<HeaderPage>(0);
        
        

          Method diff_compute has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private List<Diff> diff_compute(string text1, string text2,
                                              bool checklines, DateTime deadline) {
                List<Diff> diffs = new List<Diff>();
          
                if (text1.Length == 0) {

            Method WriteString has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    private void WriteString(string s)
                    {
                        _writer.Write('\"');
                        int l = s.Length;
                        for (var index = 0; index < l; index++)

              Method stbi__de_iphone has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      private void stbi__de_iphone()
                      {
                          uint i = 0;
                          var pixel_count = (uint)(img_x * img_y);
                          var p = new FakePtr<byte>(_out_);

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

                            var task2 = TaskRunner.instance.RunInBackground(async (cancelRequest) => {
                                Log.d("Task 2 started");
                                await TaskV2.Delay(10);
                                Assert.IsTrue(task1WasStarted);
                                Assert.IsTrue(task1ReachedItsLoopEnd);
                CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/async/BackgroundTaskQueueTests.cs on lines 127..138

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

                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 float Left {
                            get {
                                Vector3[] corners = new Vector3[4];
                                rectTransform.GetLocalCorners(corners);
                                return rectTransform.anchoredPosition.x + corners[0].x;
                CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/VirtualizedScrollRect/BaseCell.cs on lines 84..95

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

                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 float Bottom {
                            get {
                                Vector3[] corners = new Vector3[4];
                                rectTransform.GetLocalCorners(corners);
                                return rectTransform.anchoredPosition.y + corners[3].y;
                CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/VirtualizedScrollRect/BaseCell.cs on lines 71..82

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

                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