cs-util-com/cscore

View on GitHub

Showing 1,140 of 1,140 total issues

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

        {
            var offset = elementIndex * 4;
            m_Verts[offset] = position;
            m_Verts[offset + 1] = position;
            m_Verts[offset + 2] = position;
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/rendering/lines/Runtime/XRMeshChain.cs on lines 247..258

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

        {
            var offset = elementIndex * 4;
            m_Verts[offset] = startPoint;
            m_Verts[offset + 1] = startPoint;
            m_Verts[offset + 2] = endPoint;
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/rendering/lines/Runtime/XRMeshChain.cs on lines 227..238

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

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

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

            var task2 = queue.Run(async (cancelRequest) => {
                Log.d("Task 2 started");
                await TaskV2.Delay(10);
                Assert.IsTrue(task1WasStarted);
                Assert.IsTrue(task1ReachedItsLoopEnd);
CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/async/TaskRunnerTests.cs on lines 90..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 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 Right {
            get {
                Vector3[] corners = new Vector3[4];
                rectTransform.GetLocalCorners(corners);
                return rectTransform.anchoredPosition.x + corners[2].x;
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/Components/VirtualizedScrollRect/BaseCell.cs on lines 58..69

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

Method Deserialize has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

        internal object Deserialize(Type type, BsonValue value)
        {
            Func<BsonValue, object> custom;

            // null value - null returns

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

        public RestRequest WithFormContent(Dictionary<string, object> formData) {

            // For pure string based key value pairs send "application/x-www-form-urlencoded" content:
            if (formData.All(entry => entry.Value is string)) {
                if (httpContent == null) {

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

            {
                var toggle = links.Get<Toggle>("Toggle 1");
                toggle.isOn = false;
                var counter = 0;
                toggle.SetOnValueChangedAction((isNowChecked) => {
CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/ui/LinkingTests/LinkingTests.cs on lines 58..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 135.

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 input = links.Get<InputField>("Input Field 1");
                input.text = "";
                var counter = 0;
                input.SetOnValueChangedAction((newValue) => {
CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/ui/LinkingTests/LinkingTests.cs on lines 44..57

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

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

            var task = queue.Run(async (cancel) => {
                cancel.ThrowIfCancellationRequested();
                // Test that its not be possible to create a GO in a background thread:
                AssertV2.Throws<Exception>(() => { go = new GameObject(name: "A"); });
                // Test that on MainThread the gameobject can be created:
CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/async/TaskRunnerTests.cs on lines 110..120

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

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 static void AssertToHsvAndBack(Color original) {
            var hsv = original.ToHsv();
            Color converted = ColorUtil.HsvToColor(hsv);
            Assert.AreEqual(original.r, converted.r);
            Assert.AreEqual(original.g, converted.g);
CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/extensions/ColorTests.cs on lines 41..48

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

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 static void AssertToHsvAndBack32(Color32 original32) {
            var hsv = original32.ToHsv();
            Color32 converted32 = ColorUtil.HsvToColor32(hsv);
            Assert.AreEqual(original32.r, converted32.r);
            Assert.AreEqual(original32.g, converted32.g);
CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/extensions/ColorTests.cs on lines 32..39

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

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

            var task = TaskRunner.instance.RunInBackground(async (cancel) => {
                cancel.ThrowIfCancellationRequested();
                // Test that its not be possible to create a GO in a background thread:
                AssertV2.Throws<Exception>(() => { go = new GameObject(name: "A"); });
                // Test that on MainThread the gameobject can be created:
CsCore/UnityTests/Assets/Plugins/CsCoreUnityTests/async/BackgroundTaskQueueTests.cs on lines 151..161

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

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

        public static bool TryGetAudioTypeFor(string fileExtension, out AudioType audioType) {
            switch (fileExtension) {
                case "mp3":
                    audioType = AudioType.MPEG;
                    return true;

    Method AddToFreeList has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private void AddToFreeList(BasePage page, BasePage startPage, ref uint fieldPageID)
            {
                var free = page.FreeBytes;
                var nextPageID = fieldPageID;
                BasePage next = null;

      Method InsertDocument has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              private void InsertDocument(CollectionPage col, BsonDocument doc, BsonAutoId autoId)
              {
                  // collection Sequence was created after release current datafile version. 
                  // In this case, Sequence will be 0 but already has documents. Let's fix this
                  // ** this code can be removed when datafile change from 7 (HeaderPage.FILE_VERSION) **

        Method patch_addPadding has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public string patch_addPadding(List<Patch> patches) {
              short paddingLength = this.Patch_Margin;
              string nullPadding = string.Empty;
              for (short x = 1; x <= paddingLength; x++) {
                nullPadding += (char)x;

          Method InnerTryEnter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      private bool InnerTryEnter(bool synchronous = false)
                      {
                          bool result = false;
                          try
                          {

            Method OnLoad has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        public Task OnLoad(DataStore<MyModel> store) {
                            var map = targetView.GetLinkMap();
            
                            listUi = map.Get<UserListController>("ListUi");
                            filterInput = map.Get<InputField>("FilterInput");

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

                                  if (typeof(T) == typeof(int)) {
                                      int sum = 0;
                                      for (int k = 0; k < a.Width; k++) {
                                          result.data[i * result.Width + j] = (T)(object)(((int)(object)a.data[i * a.Width + k] * (int)(object)b.data[k * b.Width + j]));
                                      }
              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
              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

              Severity
              Category
              Status
              Source
              Language