BUTR/Bannerlord.BLSE

View on GitHub

Showing 240 of 240 total issues

File TextureUtils.cs has 1003 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;

Severity: Major
Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 2 days to fix

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

    using System;
    using System.Globalization;
    using System.Reflection;
    
    namespace Bannerlord.LauncherEx.Helpers;
    Severity: Major
    Found in src/Bannerlord.LauncherEx/Helpers/TypeWrapper.cs and 1 other location - About 1 day to fix
    src/Bannerlord.BLSE/Utils/TypeWrapper.cs on lines 1..50

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

    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

    using System;
    using System.Globalization;
    using System.Reflection;
    
    namespace Bannerlord.BLSE.Utils;
    Severity: Major
    Found in src/Bannerlord.BLSE/Utils/TypeWrapper.cs and 1 other location - About 1 day to fix
    src/Bannerlord.LauncherEx/Helpers/TypeWrapper.cs on lines 1..50

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

    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

    File Half.cs has 516 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Diagnostics;
    using System.Globalization;
    
    namespace SystemHalf
    Severity: Major
    Found in src/Bannerlord.LauncherEx/TPac/Half.cs - About 1 day to fix

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

      using Windows.Win32;
      using Windows.Win32.Foundation;
      using Windows.Win32.UI.WindowsAndMessaging;
      
      namespace Bannerlord.LauncherEx.Helpers.Input;
      Severity: Major
      Found in src/Bannerlord.LauncherEx/Helpers/Input/MessageBoxDialog.cs and 1 other location - About 1 day to fix
      src/Bannerlord.BLSE.Shared/Utils/MessageBoxDialog.cs on lines 1..191

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

      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

      using Windows.Win32;
      using Windows.Win32.Foundation;
      using Windows.Win32.UI.WindowsAndMessaging;
      
      namespace Bannerlord.BLSE.Shared.Utils;
      Severity: Major
      Found in src/Bannerlord.BLSE.Shared/Utils/MessageBoxDialog.cs and 1 other location - About 1 day to fix
      src/Bannerlord.LauncherEx/Helpers/Input/MessageBoxDialog.cs on lines 1..191

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

      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

      File LauncherVMMixin.cs has 446 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      using Bannerlord.LauncherEx.Extensions;
      using Bannerlord.LauncherEx.Helpers;
      using Bannerlord.LauncherEx.ViewModels;
      using Bannerlord.LauncherManager.Localization;
      using Bannerlord.LauncherManager.Models;
      Severity: Minor
      Found in src/Bannerlord.LauncherEx/Mixins/LauncherVMMixin.cs - About 6 hrs to fix

        File OpenSaveDialogs.cs has 407 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        using System;
        using System.Collections.Generic;
        using System.Diagnostics;
        using System.IO;
        using System.Linq;
        Severity: Minor
        Found in src/Bannerlord.LauncherEx/Helpers/Input/OpenSaveDialogs.cs - About 5 hrs to fix

          File BUTRLauncherOptionsVM.cs has 383 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          using Bannerlord.BUTR.Shared.Extensions;
          using Bannerlord.LauncherEx.Helpers;
          using Bannerlord.LauncherEx.Options;
          using Bannerlord.LauncherManager.Localization;
          
          
          Severity: Minor
          Found in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs - About 5 hrs to fix

            Method RefreshLauncherOptions has 116 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void RefreshLauncherOptions()
                {
                    _launcherExData = new LauncherExData(
                        LauncherSettings.AutomaticallyCheckForUpdates,
                        LauncherSettings.FixCommonIssues,
            Severity: Major
            Found in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs - About 4 hrs to fix

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

                  public static Dictionary<string, string> GetGameOptions(Func<string, byte[]?> readFileContent)
                  {
                      var dict = new Dictionary<string, string>();
                      if (readFileContent(GameConfigPath) is not { } data) return dict;
                      try
              Severity: Major
              Found in src/Bannerlord.LauncherEx/Helpers/ConfigReader.cs and 1 other location - About 3 hrs to fix
              src/Bannerlord.LauncherEx/Helpers/ConfigReader.cs on lines 40..61

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

              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 Dictionary<string, string> GetEngineOptions(Func<string, byte[]?> readFileContent)
                  {
                      var dict = new Dictionary<string, string>();
                      if (readFileContent(EngineConfigPath) is not { } data) return dict;
                      try
              Severity: Major
              Found in src/Bannerlord.LauncherEx/Helpers/ConfigReader.cs and 1 other location - About 3 hrs to fix
              src/Bannerlord.LauncherEx/Helpers/ConfigReader.cs on lines 18..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 267.

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

                      private void ReadLine8bpp(SimpleBinaryStream input, PipelineWriter output, byte[] buffer)
                      {
                          var normalized = true;
                          switch (format)
                          {
              Severity: Major
              Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 3 hrs to fix

                Method Read has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public override void Read(PipelineWriter output)
                        {
                            var stream = new SimpleBinaryStream(dataSource);
                            switch (format)
                            {
                Severity: Major
                Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 3 hrs to fix

                  Method ResolveHarmonyAssembliesFile has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static string? ResolveHarmonyAssembliesFile(AssemblyName assemblyName)
                      {
                          var assemblyNameFull = $"{assemblyName.Name}.dll";
                          var configName = Path.GetFileName(Directory.GetCurrentDirectory());
                  
                  
                  Severity: Major
                  Found in src/Bannerlord.BLSE.Shared/ModuleInitializer.cs - About 3 hrs to fix

                    Method SplitCommandLine has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static IEnumerable<string> SplitCommandLine(string commandLine)
                        {
                            var startTokenIndex = 0;
                    
                            var pos = 0;
                    Severity: Major
                    Found in src/Bannerlord.BLSE/Utils/CommandLineSplitter.cs - About 3 hrs to fix

                      Class TypeWrapper has 27 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      internal class TypeWrapper : Type
                      {
                          public override string Name { get; } = default!;
                          public override Guid GUID { get; } = default!;
                          public override Module Module { get; } = default!;
                      Severity: Minor
                      Found in src/Bannerlord.BLSE/Utils/TypeWrapper.cs - About 3 hrs to fix

                        Class TypeWrapper has 27 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        internal class TypeWrapper : Type
                        {
                            public override string Name { get; } = default!;
                            public override Guid GUID { get; } = default!;
                            public override Module Module { get; } = default!;
                        Severity: Minor
                        Found in src/Bannerlord.LauncherEx/Helpers/TypeWrapper.cs - About 3 hrs to fix

                          Class BUTRInputManager has 26 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          internal class BUTRInputManager : IInputManager, IDisposable
                          {
                              public readonly IInputManager InputManager;
                              public readonly int[] ReleasedChars = new int[10];
                          
                          
                          Severity: Minor
                          Found in src/Bannerlord.LauncherEx/Helpers/Input/BUTRInputManager.cs - About 3 hrs to fix

                            Method ReadLineFloat has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    private void ReadLineFloat(SimpleBinaryStream input, PipelineWriter output, float[] buffer)
                                    {
                                        switch (format)
                                        {
                                            case TextureFormat.R11G11B10F:
                            Severity: Major
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language