BUTR/Bannerlord.BLSE

View on GitHub

Showing 240 of 240 total issues

Method SaveUserDataPostfix has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    [SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "<Pending>")]
    [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "For Resharper")]
    [SuppressMessage("ReSharper", "InconsistentNaming")]
    [SuppressMessage("ReSharper", "RedundantAssignment")]
    [MethodImpl(MethodImplOptions.NoInlining)]
Severity: Minor
Found in src/Bannerlord.LauncherEx/Patches/UserDataManagerPatch.cs - About 1 hr to fix

    Method ReadLineDepth has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private void ReadLineDepth(SimpleBinaryStream input, PipelineWriter output, float[] depth, byte[] stencil)
            {
                switch (format)
                {
                    case TextureFormat.D24_UNORM_S8_UINT:
    Severity: Minor
    Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

      Method DecodeTextureDataToWriter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static void DecodeTextureDataToWriter(byte[] data, int width, int height, TextureFormat format, PipelineWriter writer, bool silentlyFail = false)
          {
              if (!format.IsSupported())
              {
                  if (!silentlyFail)
      Severity: Minor
      Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

        Method ExecuteImport has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            [BUTRDataSourceMethod]
            public void ExecuteImport()
            {
                if (ViewModel is null || _launcherModsVMMixin is null || UpdateAndSaveUserModsDataMethod is null) return;
        
        
        Severity: Minor
        Found in src/Bannerlord.LauncherEx/Mixins/LauncherVMMixin.cs - About 1 hr to fix

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

              protected override void OnMouseAlternateReleased()
              {
                  if (_clickState != ButtonClickState.HandlingAlternateClick) return;
          
                  _clickState = ButtonClickState.None;
          src/Bannerlord.LauncherEx/Widgets/LauncherToggleButtonWidget.cs on lines 153..172

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

          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

              protected override void OnMouseReleased()
              {
                  if (_clickState != ButtonClickState.HandlingClick) return;
          
                  _clickState = ButtonClickState.None;
          src/Bannerlord.LauncherEx/Widgets/LauncherToggleButtonWidget.cs on lines 192..211

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

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

                  private static ushort[] GenerateBaseTable()
                  {
                      var baseTable = new ushort[512];
                      for (var i = 0; i < 256; ++i)
                      {
          Severity: Minor
          Found in src/Bannerlord.LauncherEx/TPac/Half.cs - About 1 hr to fix

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

                public override bool ShowDialog()
                {
                    var fileName = Marshal.ReAllocCoTaskMem(Marshal.StringToCoTaskMemUni(FileName ?? string.Empty), MAX_FILE_LENGTH);
                    //using var fileName = new SafeCoTaskMemString(FileName ?? string.Empty, MAX_FILE_LENGTH);
                    //using var fileTitle = new SafeCoTaskMemString(MAX_FILE_LENGTH);
            Severity: Minor
            Found in src/Bannerlord.LauncherEx/Helpers/Input/OpenSaveDialogs.cs - About 1 hr to fix

              Method GenerateShiftTable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      private static sbyte[] GenerateShiftTable()
                      {
                          var shiftTable = new sbyte[512];
                          for (var i = 0; i < 256; ++i)
                          {
              Severity: Minor
              Found in src/Bannerlord.LauncherEx/TPac/Half.cs - About 1 hr to fix

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

                internal sealed class UILauncherPrefabExtension7 : PrefabExtensionInsertAsSiblingPatch
                {
                    public static string Movie => "UILauncher";
                    public static string XPath => "descendant::Launcher.Mods";
                
                
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Mods.Saves.cs on lines 29..45
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 152..168
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 169..185

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

                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

                internal sealed class UILauncherPrefabExtension22 : PrefabExtensionInsertAsSiblingPatch
                {
                    public static string Movie => "UILauncher";
                    public static string XPath => "descendant::Launcher.Options[@Id='OptionsLauncherPage']";
                
                
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Mods.Saves.cs on lines 29..45
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 135..151
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 169..185

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

                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

                internal sealed class UILauncherPrefabExtension23 : PrefabExtensionInsertAsSiblingPatch
                {
                    public static string Movie => "UILauncher";
                    public static string XPath => "descendant::Launcher.Options[@Id='OptionsGamePage']";
                
                
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Mods.Saves.cs on lines 29..45
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 135..151
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 152..168

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

                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

                internal sealed class UILauncherPrefabExtension25 : PrefabExtensionInsertAsSiblingPatch
                {
                    public static string Movie => "UILauncher";
                    public static string XPath => "descendant::Launcher.Options[@Id='OptionsGamePage']";
                
                
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 135..151
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 152..168
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Options.cs on lines 169..185

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

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

                    [return: NotNullIfNotNull("value")]
                    private static string? ToSeparateWords(string? value)
                    {
                        if (value == null) return null;
                        if (value.Length <= 1) return value;
                Severity: Minor
                Found in src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs - About 1 hr to fix

                  Method CheckSteam has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static void CheckSteam()
                      {
                          static void Exit()
                          {
                              MessageBoxDialog.Show("""
                  Severity: Minor
                  Found in src/Bannerlord.BLSE.Shared/Utils/UacHelper.cs - About 1 hr to fix

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

                            SettingProperties.Add(new SettingsPropertyVM(new SettingsPropertyDefinition
                            {
                                DisplayName = new BUTRTextObject("{=LXlsSS8t}Fix Common Issues").ToString(),
                                HintText = new BUTRTextObject("{=J9VbkLW4}Fixes issues like 0Harmony.dll being in the /bin folder").ToString(),
                                SettingType = SettingType.Bool,
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 105..111
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 112..118
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 119..125
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 173..179
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 180..186
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 187..193

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

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

                            SettingProperties.Add(new SettingsPropertyVM(new SettingsPropertyDefinition
                            {
                                DisplayName = new BUTRTextObject("{=qKK4Ehyd}Use Vanilla Crash Handler").ToString(),
                                HintText = new BUTRTextObject("{=RTmWsIEA}Disables ButterLib's and BEW's Crash Handlers with the new Watchdog Crash Handler. Do not enable if not sure.").ToString(),
                                SettingType = SettingType.Bool,
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 84..90
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 105..111
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 112..118
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 119..125
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 173..179
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 180..186

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

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

                            SettingProperties.Add(new SettingsPropertyVM(new SettingsPropertyDefinition
                            {
                                DisplayName = new BUTRTextObject("{=1zt99vTt}Big Mode").ToString(),
                                HintText = new BUTRTextObject("{=XUSDSpvf}Makes the launcher bigger in height").ToString(),
                                SettingType = SettingType.Bool,
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 84..90
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 105..111
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 112..118
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 173..179
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 180..186
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 187..193

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

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

                            SettingProperties.Add(new SettingsPropertyVM(new SettingsPropertyDefinition
                            {
                                DisplayName = new BUTRTextObject("{=QzPFvxGy}Disable BLSE Crash Handler When Debugger Is Attached").ToString(),
                                HintText = new BUTRTextObject("{=P5NWQtKr}Stops BLSE Crash Handler when a debugger is attached. Do not disable if not sure.").ToString(),
                                SettingType = SettingType.Bool,
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 84..90
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 105..111
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 112..118
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 119..125
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 180..186
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 187..193

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

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

                            SettingProperties.Add(new SettingsPropertyVM(new SettingsPropertyDefinition
                            {
                                DisplayName = new BUTRTextObject("{=NkCBdPSE}Disable Auto Generated Method Exception Catching").ToString(),
                                HintText = new BUTRTextObject("{=QWGZy8Ym}Disables catching every Native->Managed call. It should catch every exception not catched the standard way. Do not disable if not sure.").ToString(),
                                SettingType = SettingType.Bool,
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 84..90
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 105..111
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 112..118
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 119..125
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 173..179
                    src/Bannerlord.LauncherEx/ViewModels/BUTRLauncherOptionsVM.cs on lines 187..193

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language