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

        public static IDictionary<T, V> ExceptKeys<T, V>(this IDictionary<T, V> self, IDictionary<T, V> otherDict) {
            return self.Keys.Except(otherDict.Keys).ToDictionary(k => k, k => self[k]);
        }
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/datastructures/collections/IDictionaryExtensions.cs on lines 47..49

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

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 IDictionary<T, V> IntersectKeys<T, V>(this IDictionary<T, V> self, IDictionary<T, V> otherDict) {
            return self.Keys.Intersect(otherDict.Keys).ToDictionary(k => k, k => self[k]);
        }
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/datastructures/collections/IDictionaryExtensions.cs on lines 43..45

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

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

                    foreach (var pos in node.Next.Where(x => !x.IsEmpty && x.PageID != uint.MaxValue))
                    {
                        if (!indexPages.ContainsKey(pos.PageID)) indexPages.Add(pos.PageID, false);
                    }
CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Recovery/Recovery.cs on lines 181..184

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

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

            EventBus.instance.Subscribe(self, EventConsts.catPresenter + EventConsts.DONE,
                (string name, object presenter, object model) => {
                    self.TrackEvent(EventConsts.catPresenter, EventConsts.DONE + name, presenter, model);
                });
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/logging/analytics/IAppFlowExtensions.cs on lines 62..65

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

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

                    foreach (var pos in node.Prev.Where(x => !x.IsEmpty && x.PageID != uint.MaxValue))
                    {
                        if (!indexPages.ContainsKey(pos.PageID)) indexPages.Add(pos.PageID, false);
                    }
CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/UltraLiteDB/Recovery/Recovery.cs on lines 186..189

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

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 OnSubstateChangedForUnity<T, S>(SubState<T, S> subState, S newVal, UnityEngine.Object context) {
            if (context.IsDestroyed()) {
                subState.DisposeV2();
                return;
            }
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensionsForReduxStore.cs on lines 207..215

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

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 async Task ShowIn(ViewStack viewStack) {
            var model = new MyModel() { degreeInCelsius = 0 };
            var presenter = new MyPresenter();
            presenter.targetView = viewStack.ShowView("7GUIs_Task2_TemperatureConverter");
            await presenter.LoadModelIntoView(model);
CsCore/UnityTests/Assets/Plugins/CsCoreUnityDemoScenes/Ui24_7GUIsBechnmark/Task1_Counter.cs on lines 10..15

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

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 async Task ShowIn(ViewStack viewStack) {
            var model = new MyModel() { counter = 0 };
            var presenter = new MyPresenter();
            presenter.targetView = viewStack.ShowView("7GUIs_Task1_Counter");
            await presenter.LoadModelIntoView(model);
CsCore/UnityTests/Assets/Plugins/CsCoreUnityDemoScenes/Ui24_7GUIsBechnmark/Task2_TemperatureConverter.cs on lines 10..15

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

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

            EventBus.instance.Subscribe(self, EventConsts.catPresenter + EventConsts.START,
                (string name, object presenter, object model) => {
                    self.TrackEvent(EventConsts.catPresenter, EventConsts.START + name, presenter, model);
                });
CsCore/PlainNetClassLib/src/Plugins/CsCore/com/csutil/logging/analytics/IAppFlowExtensions.cs on lines 66..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 76.

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 OnSubstateChangedForUnity<V>(SubListeners<V> onStateChanged, V newVal, UnityEngine.Object context) {
            if (context.IsDestroyed()) {
                onStateChanged.UnregisterFromParent();
                return;
            }
CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensionsForReduxStore.cs on lines 114..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 76.

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 AddRect has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

            ref VertexHelper vh,
            Vector2 center,
            float width,
            float height,
            Color32 color,

    Method AddOnClickAction has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
    Open

            public static Task<T> AddOnClickAction<T>(this Button self, Func<GameObject, T> onClickFunc) {
                onClickFunc.ThrowErrorIfNull("Passed onClickFunc was null");
                var tcs = new TaskCompletionSource<T>();
                StackTrace originTrace = null; // new StackTrace();
                Task alreadyRunningTask = null;
    Severity: Minor
    Found in CsCore/CsCoreUnity/Plugins/CsCoreUnity/com/csutil/ui/UiExtensions.cs - About 45 mins to fix

    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 GetSubStateForUnity has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            public static SubState<T, Sub> GetSubStateForUnity<T, Sub>(this IDataStore<T> store, UnityEngine.Object context, Func<T, Sub> getSubState, Action<Sub> onChanged, bool eventsAlwaysInMainThread = true, bool triggerInstantToInit = true) {

      Method GetSubStateForUnity has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              public static SubState<T, SubSub> GetSubStateForUnity<T, Sub, SubSub>(this SubState<T, Sub> parentSubState, UnityEngine.Object context, Func<Sub, SubSub> getSubState,
                  Action<SubSub> onChanged, bool eventsAlwaysInMainThread = true, bool triggerInstantToInit = true) {

        Method LogMethodDone has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                public override void LogMethodDone(Stopwatch timing, object[] args, int maxAllowedTimeInMs, string sourceMemberName, string sourceFilePath, int sourceLineNumber) {

          Method AddRect has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                      ref VertexHelper vh,
                      Vector2 center,
                      float width,
                      float height,
                      Color32 color,

            Method SubscribeToStateChanges has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    public static void SubscribeToStateChanges<T, V>(this UnityEngine.Object self, IDataStore<T> store, Func<T, V> getSubState, Action<V> updateUi, bool triggerOnSubscribe = true, bool eventsAlwaysInMainThread = true) {

              Method LogMethodDone has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      public override void LogMethodDone(System.Diagnostics.Stopwatch timing, object[] args, int maxAllowedTimeInMs,
                                                              string sourceMemberName, string sourceFilePath, int sourceLineNumber) {

                Avoid deeply nested control flow statements.
                Open

                                            if (bestLocation <= expectedLocation)
                                            {
                                                break;
                                            }
                Severity: Major
                Found in CsCore/PlainNetClassLib/src/Plugins/CsCore/libs/FuzzySearchFuze/Bitap.cs - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                  if (commonlength != 0) {
                                    if ((pointer - count_delete - count_insert) > 0 &&
                                      diffs[pointer - count_delete - count_insert - 1].operation
                                          == Operation.EQUAL) {
                                      diffs[pointer - count_delete - count_insert - 1].text
                    Severity
                    Category
                    Status
                    Source
                    Language