BUTR/Bannerlord.BLSE

View on GitHub

Showing 240 of 240 total issues

Method ExecuteUpdateCheck has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    [BUTRDataSourceMethod]
    public void ExecuteUpdateCheck()
    {
        try
        {
Severity: Minor
Found in src/Bannerlord.LauncherEx/Mixins/LauncherModsVMMixin.cs - About 1 hr to fix

    Method ReadMetadata has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public override void ReadMetadata(BinaryReader stream, int totalSize)
        {
            var pos = stream.BaseStream.Position;
            var version = stream.ReadUInt32();
            stream.ReadGuid();
    Severity: Minor
    Found in src/Bannerlord.LauncherEx/TPac/Texture.cs - About 1 hr to fix

      Method RefreshState has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected override void RefreshState()
          {
              base.RefreshState();
              if (!OverrideDefaultStateSwitchingEnabled)
              {
      Severity: Minor
      Found in src/Bannerlord.LauncherEx/Widgets/LauncherToggleButtonWidget.cs - About 1 hr to fix

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

                        case TextureFormat.R32G32B32A32F:
                            for (int i = 0, j = 0; i < width; i++, j = i * 4)
                            {
                                buffer[j] = input.ReadSingle();
                                buffer[j + 1] = input.ReadSingle();
        Severity: Major
        Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 3 other locations - About 1 hr to fix
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 416..425
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 495..504
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 542..551

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

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

                        case TextureFormat.R16G16B16A16_UINT:
                            for (int i = 0, j = 0; i < width; i++, j = i * 4)
                            {
                                buffer[j] = input.ReadUInt16();
                                buffer[j + 1] = input.ReadUInt16();
        Severity: Major
        Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 3 other locations - About 1 hr to fix
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 416..425
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 542..551
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 676..685

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

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

                        case TextureFormat.R32G32B32A32_UINT:
                            for (int i = 0, j = 0; i < width; i++, j = i * 4)
                            {
                                buffer[j] = input.ReadUInt32();
                                buffer[j + 1] = input.ReadUInt32();
        Severity: Major
        Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 3 other locations - About 1 hr to fix
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 416..425
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 495..504
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 676..685

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

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

                        case TextureFormat.R8G8B8A8_UNORM:
                            for (int i = 0, j = 0; i < width; i++, j = i * 4)
                            {
                                buffer[j] = input.ReadByte();
                                buffer[j + 1] = input.ReadByte();
        Severity: Major
        Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 3 other locations - About 1 hr to fix
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 495..504
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 542..551
        src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 676..685

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

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

            private static unsafe void InnerSet(string text)
            {
                PInvoke.EmptyClipboard();
                var hGlobal = (HGLOBAL) IntPtr.Zero;
                try
        Severity: Minor
        Found in src/Bannerlord.LauncherEx/Helpers/Input/WindowsClipboard.cs - About 1 hr to fix

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

                          case TextureFormat.R8G8B8:
                              for (int i = 0, j = 0; i < width; i++, j = i * 4)
                              {
                                  buffer[j] = input.ReadByte();
                                  buffer[j + 1] = input.ReadByte();
          Severity: Major
          Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 2 other locations - About 1 hr to fix
          src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 485..494
          src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 532..541

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

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

                          case TextureFormat.R16G16B16:
                              for (int i = 0, j = 0; i < width; i++, j = i * 4)
                              {
                                  buffer[j] = input.ReadUInt16();
                                  buffer[j + 1] = input.ReadUInt16();
          Severity: Major
          Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 2 other locations - About 1 hr to fix
          src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 375..384
          src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 532..541

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

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

                          case TextureFormat.R32G32B32_UINT:
                              for (int i = 0, j = 0; i < width; i++, j = i * 4)
                              {
                                  buffer[j] = input.ReadUInt32();
                                  buffer[j + 1] = input.ReadUInt32();
          Severity: Major
          Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 2 other locations - About 1 hr to fix
          src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 375..384
          src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 485..494

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

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

              [BUTRDataSourceMethod(OverrideName = "ExecuteStartGame")]
              public void ExecuteStartGameOverride(int mode)
              {
                  if (ViewModel is null || ExecuteStartGame is null) return;
          
          
          Severity: Minor
          Found in src/Bannerlord.LauncherEx/Mixins/LauncherVMMixin.cs - About 1 hr to fix

            Method OnInitialStatePrefix has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static bool OnInitialStatePrefix(MBSubModuleBase __instance)
                {
                    static void FailedToLoad(string message)
                    {
                        try

              Method OnAssemblyResolve has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static Assembly? OnAssemblyResolve(object? sender, ResolveEventArgs args)
                  {
                      if (args.Name is null) return null;
              
                      var name = new AssemblyName(args.Name);

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

                    public static void RegisterType(Type typeClass)
                    {
                        var field = typeClass.GetField("TYPE_GUID", BindingFlags.Static | BindingFlags.Public) ?? throw new ArgumentException("Cannot find public static field \"TYPE_GUID\" from class " + typeClass.FullName);
                        if (field.FieldType != typeof(Guid)) throw new ArgumentException("\"TYPE_GUID\" must be Guid");
                        var guid = (Guid) field.GetValue(null);
                Severity: Major
                Found in src/Bannerlord.LauncherEx/TPac/TypedAssetFactory.cs and 1 other location - About 1 hr to fix
                src/Bannerlord.LauncherEx/TPac/TypedDataFactory.cs on lines 18..24

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

                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

                    public static void RegisterType(Type typeClass)
                    {
                        var field = typeClass.GetField("TYPE_GUID", BindingFlags.Static | BindingFlags.Public) ?? throw new ArgumentException("Cannot find public static field \"TYPE_GUID\" from class " + typeClass.FullName);
                        if (field.FieldType != typeof(Guid)) throw new ArgumentException("\"TYPE_GUID\" must be Guid");
                        var guid = (Guid) field.GetValue(null);
                Severity: Major
                Found in src/Bannerlord.LauncherEx/TPac/TypedDataFactory.cs and 1 other location - About 1 hr to fix
                src/Bannerlord.LauncherEx/TPac/TypedAssetFactory.cs on lines 17..23

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

                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

                        SettingProperties.Add(new SettingsPropertyVM(new SettingsPropertyDefinition
                        {
                            DisplayName = new BUTRTextObject("{=1zt99vTt}Enable DPI Scaling").ToString(),
                            HintText = $"{new BUTRTextObject("{=44qrhQ6g}Requires restart!")} {new BUTRTextObject("{=JusnHy6S}Enables Windows DPI Scaling to remove blurriness of UI elements")}",
                            SettingType = SettingType.Bool,
                src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 91..97

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

                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

                        SettingProperties.Add(new SettingsPropertyVM(new SettingsPropertyDefinition
                        {
                            DisplayName = new BUTRTextObject("{=vUAqDj9H}Compact Module List").ToString(),
                            HintText = $"{new BUTRTextObject("{=44qrhQ6g}Requires restart!")} {new BUTRTextObject("{=Qn1aPNQM}Makes the Mods tab content smaller")}",
                            SettingType = SettingType.Bool,
                src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 126..132

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

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

                    public override object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParameters) => null;
                Severity: Major
                Found in src/Bannerlord.BLSE/Utils/TypeWrapper.cs - About 1 hr to fix

                  Method InvokeMember has 11 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public override object? InvokeMember(string name, BindingFlags invokeAttr, Binder? binder, object? target, object?[]? args, ParameterModifier[]? modifiers, CultureInfo? culture, string[]? namedParameters) => null;
                  Severity: Major
                  Found in src/Bannerlord.LauncherEx/Helpers/TypeWrapper.cs - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language