BUTR/Bannerlord.BLSE

View on GitHub

Showing 240 of 240 total issues

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

    public static bool Enable(Harmony harmony)
    {
        _harmony = harmony;

        var res1 = harmony.TryPatch(
src/Bannerlord.LauncherEx/ResourceManagers/FontFactoryManager.cs on lines 19..34

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

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 NETFrameworkLoader.Hosting.cs has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#endif
Severity: Minor
Found in src/Bannerlord.BLSE.Loaders.Standalone/NETFrameworkLoader.Hosting.cs - About 2 hrs to fix

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

        internal static bool Enable(Harmony harmony)
        {
            var res1 = harmony.TryPatch(
                AccessTools2.Method(typeof(SpriteData), "GetSprite"),
                prefix: AccessTools2.DeclaredMethod(typeof(SpriteDataManager), nameof(GetSpritePrefix)));
    src/Bannerlord.LauncherEx/Patches/UserDataManagerPatch.cs on lines 21..34
    src/Bannerlord.LauncherEx/ResourceManagers/GraphicsContextManager.cs on lines 53..66

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

    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

        public static bool Enable(Harmony harmony)
        {
            var res1 = harmony.TryPatch(
                AccessTools2.DeclaredMethod(typeof(UserDataManager), "LoadUserData"),
                prefix: AccessTools2.DeclaredMethod(typeof(UserDataManagerPatch), nameof(LoadUserDataPrefix)));
    Severity: Major
    Found in src/Bannerlord.LauncherEx/Patches/UserDataManagerPatch.cs and 2 other locations - About 2 hrs to fix
    src/Bannerlord.LauncherEx/ResourceManagers/GraphicsContextManager.cs on lines 53..66
    src/Bannerlord.LauncherEx/ResourceManagers/SpriteDataManager.cs on lines 207..220

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

    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

        internal static bool Enable(Harmony harmony)
        {
            var res1 = harmony.TryPatch(
                AccessTools2.DeclaredMethod(typeof(GraphicsContext), "GetTexture"),
                prefix: AccessTools2.DeclaredMethod(typeof(GraphicsContextManager), nameof(GetTexturePrefix)));
    src/Bannerlord.LauncherEx/Patches/UserDataManagerPatch.cs on lines 21..34
    src/Bannerlord.LauncherEx/ResourceManagers/SpriteDataManager.cs on lines 207..220

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

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

        public void SendDialog(DialogType type, string title, string message, IReadOnlyList<DialogFileFilter> filters, Action<string> onResult)
        {
            switch (type)
            {
                case DialogType.Warning:
    Severity: Minor
    Found in src/Bannerlord.LauncherEx/Adapters/DialogProviderImpl.cs - About 2 hrs to fix

      Method ReadData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public override void ReadData(BinaryReader stream, IDictionary<object, object> userdata, int totalSize)
          {
              int array = 1, mipmap = 1;
              if (userdata.TryGetValue(KEY_ARRAY, out var arrayObj))
              {
      Severity: Minor
      Found in src/Bannerlord.LauncherEx/TPac/TexturePixelData.cs - About 1 hr to fix

        Method GetArrays has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                protected override DrawObject2D GetArrays(SpriteDrawData spriteDrawData)
                {
                    if (CachedDrawObject is not null && CachedDrawData == spriteDrawData)
                        return CachedDrawObject;
        
        
        Severity: Minor
        Found in src/Bannerlord.LauncherEx/ResourceManagers/SpriteDataManager.cs - About 1 hr to fix

          Method ReadLine32bpp has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private void ReadLine32bpp(SimpleBinaryStream input, PipelineWriter output, uint[] buffer)
                  {
                      var normalized = false;
                      switch (format)
                      {
          Severity: Minor
          Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

            Method BC3GradientInterpolate has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public static int BC3GradientInterpolate(int index, int alpha0, int alpha1, bool isFirstGreater)
                    {
                        if (isFirstGreater)
                        {
                            switch (index)
            Severity: Minor
            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

              Method TryLoadLoadOrderFromSaveFile has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static void TryLoadLoadOrderFromSaveFile(ref string[] args)
                  {
                      // If _MODULES_ arg is missing but a save file to load is specified, use the load order from the save file
                      var hasModules = false;
                      var saveFile = string.Empty;
              Severity: Minor
              Found in src/Bannerlord.BLSE.Shared/Standalone.cs - About 1 hr to fix

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

                internal sealed class UILauncherPrefabExtension1 : PrefabExtensionInsertAsSiblingPatch
                {
                    public static string Movie => "UILauncher";
                    public static string XPath => "descendant::TextWidget[@Text='@VersionText']";
                
                
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Minor.cs on lines 35..51

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

                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

                internal sealed class UILauncherPrefabExtension2 : PrefabExtensionInsertAsSiblingPatch
                {
                    public static string Movie => "UILauncher";
                    public static string XPath => "descendant::TextWidget[@Text='@BLSEVersionText']";
                
                
                src/Bannerlord.LauncherEx/PrefabExtensions/UILauncherPrefabExtension.Minor.cs on lines 15..31

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

                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

                                case TextureFormat.R11G11B10F:
                                case TextureFormat.R16F:
                                case TextureFormat.R16G16F:
                                case TextureFormat.R16G16B16A16F:
                                case TextureFormat.R32F:
                Severity: Major
                Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 1 hr to fix
                src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 272..288

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

                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

                                case TextureFormat.R16_UINT:
                                case TextureFormat.R16_UNORM:
                                case TextureFormat.D16_UNORM:
                                case TextureFormat.L16_UNORM:
                                case TextureFormat.R16G16_UNORM:
                Severity: Major
                Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 1 hr to fix
                src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 317..333

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

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

                    private static Assembly? ResolveHarmonyAssembly(AssemblyName assemblyName)
                    {
                        foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                        {
                            if (assembly.FullName == assemblyName.FullName)
                Severity: Minor
                Found in src/Bannerlord.BLSE.Shared/ModuleInitializer.cs - About 1 hr to fix

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

                          public override void Read(PipelineWriter output)
                          {
                              var blockWidth = Math.Max((width + 3) / 4, 1);
                              var blockHeight = Math.Max((height + 3) / 4, 1);
                              var cache0 = new byte[4][];
                  Severity: Minor
                  Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

                    Method Start has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public void Start()
                        {
                            _isActive = true;
                    
                            switch (ThreadConfig)
                    Severity: Minor
                    Found in src/Bannerlord.BLSE.Shared/NoExceptions/WindowsFrameworkEx.cs - About 1 hr to fix

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

                      using System.Diagnostics;
                      using System.IO;
                      
                      using Windows.Win32;
                      
                      
                      Severity: Major
                      Found in src/Bannerlord.BLSE.Shared/Utils/SpecialKILoader.cs and 1 other location - About 1 hr to fix
                      src/Bannerlord.BLSE.Shared/Utils/ReShadeLoader.cs on lines 1..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 130.

                      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.Diagnostics;
                      using System.IO;
                      
                      using Windows.Win32;
                      
                      
                      Severity: Major
                      Found in src/Bannerlord.BLSE.Shared/Utils/ReShadeLoader.cs and 1 other location - About 1 hr to fix
                      src/Bannerlord.BLSE.Shared/Utils/SpecialKILoader.cs on lines 1..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 130.

                      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