BUTR/Bannerlord.BLSE

View on GitHub

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

    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

      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

              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

                              Method Enable has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static void Enable()
                                  {
                                      ProgramPatch.Enable(_launcherHarmony);
                                      UserDataManagerPatch.Enable(_launcherHarmony);
                                      LauncherVMPatch.Enable(_launcherHarmony);
                              Severity: Major
                              Found in src/Bannerlord.LauncherEx/Manager.cs - About 2 hrs to fix

                                Method ShowDialog has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public override bool ShowDialog()
                                    {
                                        FileNames = null;
                                
                                        var file = Marshal.AllocHGlobal(MAX_FILE_LENGTH * Marshal.SystemDefaultCharSize);
                                Severity: Major
                                Found in src/Bannerlord.LauncherEx/Helpers/Input/OpenSaveDialogs.cs - About 2 hrs to fix

                                  Method ValidateSave has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private void ValidateSave()
                                      {
                                          var changeset = _saveMetadata.GetChangeSet();
                                          var modules = _saveMetadata.GetModules().Select(x =>
                                          {
                                  Severity: Major
                                  Found in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherSaveVM.cs - About 2 hrs to fix

                                    Method SplitCommandLine has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
                                    Open

                                        public static IEnumerable<string> SplitCommandLine(string commandLine)
                                        {
                                            var startTokenIndex = 0;
                                    
                                            var pos = 0;
                                    Severity: Minor
                                    Found in src/Bannerlord.BLSE/Utils/CommandLineSplitter.cs - About 2 hrs 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 SaveLauncherOptions has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private void SaveLauncherOptions()
                                        {
                                            if (_launcherExData is null)
                                                return;
                                    
                                    
                                    Severity: Major
                                    Found in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs - About 2 hrs to fix

                                      Method ReadLine16bpp has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              private void ReadLine16bpp(SimpleBinaryStream input, PipelineWriter output, ushort[] buffer)
                                              {
                                                  var normalized = true;
                                                  switch (format)
                                                  {
                                      Severity: Major
                                      Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language