Aragas/Bannerlord.MBOptionScreen

View on GitHub
src/MCM.UI/Utils/InquiryDataUtils.cs

Summary

Maintainability
C
1 day
Test Coverage

Method CreateMulti has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        public static MultiSelectionInquiryData? CreateMulti(string titleText, string descriptionText, List<InquiryElement> inquiryElements, bool isExitShown, int minSelectableOptionCount, int maxSelectableOptionCount, string affirmativeText, string negativeText, Action<List<InquiryElement>> affirmativeAction, Action<List<InquiryElement>> negativeAction)
Severity: Major
Found in src/MCM.UI/Utils/InquiryDataUtils.cs - About 1 hr to fix

    Method CreateMultiTranslatable has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            public static MultiSelectionInquiryData? CreateMultiTranslatable(string titleText, string descriptionText, List<InquiryElement> inquiryElements, bool isExitShown, int minSelectableOptionCount, int maxSelectableOptionCount, string affirmativeText, string negativeText, Action<List<InquiryElement>> affirmativeAction, Action<List<InquiryElement>> negativeAction) =>
    Severity: Major
    Found in src/MCM.UI/Utils/InquiryDataUtils.cs - About 1 hr to fix

      Method CreateText has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              public static TextInquiryData? CreateText(string titleText, string text, bool isAffirmativeOptionShown, bool isNegativeOptionShown, string affirmativeText, string negativeText, Action<string> affirmativeAction, Action negativeAction)
      Severity: Major
      Found in src/MCM.UI/Utils/InquiryDataUtils.cs - About 1 hr to fix

        Method CreateTranslatable has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                public static InquiryData? CreateTranslatable(string titleText, string text, bool isAffirmativeOptionShown, bool isNegativeOptionShown, string affirmativeText, string negativeText, Action affirmativeAction, Action negativeAction) =>
        Severity: Major
        Found in src/MCM.UI/Utils/InquiryDataUtils.cs - About 1 hr to fix

          Method Create has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  public static InquiryData? Create(string titleText, string text, bool isAffirmativeOptionShown, bool isNegativeOptionShown, string affirmativeText, string negativeText, Action affirmativeAction, Action negativeAction)
          Severity: Major
          Found in src/MCM.UI/Utils/InquiryDataUtils.cs - About 1 hr to fix

            Method CreateTextTranslatable has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    public static TextInquiryData? CreateTextTranslatable(string titleText, string text, bool isAffirmativeOptionShown, bool isNegativeOptionShown, string affirmativeText, string negativeText, Action<string> affirmativeAction, Action negativeAction) =>
            Severity: Major
            Found in src/MCM.UI/Utils/InquiryDataUtils.cs - About 1 hr to fix

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

                      public static InquiryData? CreateTranslatable(string titleText, string text, bool isAffirmativeOptionShown, bool isNegativeOptionShown, string affirmativeText, string negativeText, Action affirmativeAction, Action negativeAction) =>
                          Create(new TextObject(titleText).ToString(), new TextObject(text).ToString(), isAffirmativeOptionShown, isNegativeOptionShown, new TextObject(affirmativeText).ToString(), new TextObject(negativeText).ToString(), affirmativeAction, negativeAction);
              Severity: Minor
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 1 other location - About 55 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 73..74

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

              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 TextInquiryData? CreateTextTranslatable(string titleText, string text, bool isAffirmativeOptionShown, bool isNegativeOptionShown, string affirmativeText, string negativeText, Action<string> affirmativeAction, Action negativeAction) =>
                          CreateText(new TextObject(titleText).ToString(), new TextObject(text).ToString(), isAffirmativeOptionShown, isNegativeOptionShown, new TextObject(affirmativeText).ToString(), new TextObject(negativeText).ToString(), affirmativeAction, negativeAction);
              Severity: Minor
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 1 other location - About 55 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 61..62

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

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

                      private static readonly V1Delegate? V1 =
                          AccessTools2.GetConstructorDelegate<V1Delegate>(typeof(InquiryData), typeof(V1Delegate).GetMethod("Invoke").GetParameters().Select(x => x.ParameterType).ToArray());
              Severity: Major
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 5 other locations - About 40 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 23..24
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 30..31
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 36..37
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 41..42
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 46..47

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

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

                      private static readonly V1TextDelegate? V1Text =
                          AccessTools2.GetConstructorDelegate<V1TextDelegate>(typeof(TextInquiryData), typeof(V1TextDelegate).GetMethod("Invoke").GetParameters().Select(x => x.ParameterType).ToArray());
              Severity: Major
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 5 other locations - About 40 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 17..18
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 23..24
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 36..37
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 41..42
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 46..47

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

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

                      private static readonly V3MultiDelegate? V3Multi =
                          AccessTools2.GetConstructorDelegate<V3MultiDelegate>(typeof(MultiSelectionInquiryData), typeof(V3MultiDelegate).GetMethod("Invoke").GetParameters().Select(x => x.ParameterType).ToArray());
              Severity: Major
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 5 other locations - About 40 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 17..18
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 23..24
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 30..31
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 36..37
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 41..42

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

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

                      private static readonly V1MultiDelegate? V1Multi =
                          AccessTools2.GetConstructorDelegate<V1MultiDelegate>(typeof(MultiSelectionInquiryData), typeof(V1MultiDelegate).GetMethod("Invoke").GetParameters().Select(x => x.ParameterType).ToArray());
              Severity: Major
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 5 other locations - About 40 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 17..18
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 23..24
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 30..31
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 41..42
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 46..47

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

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

                      private static readonly V2Delegate? V2 =
                          AccessTools2.GetConstructorDelegate<V2Delegate>(typeof(InquiryData), typeof(V2Delegate).GetMethod("Invoke").GetParameters().Select(x => x.ParameterType).ToArray());
              Severity: Major
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 5 other locations - About 40 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 17..18
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 30..31
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 36..37
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 41..42
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 46..47

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

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

                      private static readonly V2MultiDelegate? V2Multi =
                          AccessTools2.GetConstructorDelegate<V2MultiDelegate>(typeof(MultiSelectionInquiryData), typeof(V2MultiDelegate).GetMethod("Invoke").GetParameters().Select(x => x.ParameterType).ToArray());
              Severity: Major
              Found in src/MCM.UI/Utils/InquiryDataUtils.cs and 5 other locations - About 40 mins to fix
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 17..18
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 23..24
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 30..31
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 36..37
              src/MCM.UI/Utils/InquiryDataUtils.cs on lines 46..47

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

              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

              There are no issues that match your filters.

              Category
              Status