BUTR/Bannerlord.BLSE

View on GitHub
src/Bannerlord.LauncherEx/TPac/TextureUtils.cs

Summary

Maintainability
F
1 wk
Test Coverage

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

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

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

                              public static void ReadBC3AlphaBlock(long block, byte[][] cache, int posX, GetPixelMask writeMask)
                              {
                                  writeMask(out var maskR, out var maskG, out var maskB, out var maskA,
                                      out var addR, out var addG, out var addB, out var addA);
                                  var alpha0 = (int) (block & 0xFF);
                      Severity: Minor
                      Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

                        Method ReadBlock has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                protected override void ReadBlock(SimpleBinaryStream stream, byte[][] cache, int blockX)
                                {
                                    var posX = blockX * 4;
                        
                                    var baseColor = new RGB565[4];
                        Severity: Minor
                        Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 1 hr to fix

                          Method DecodeTextureDataToWriter has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

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

                            Method Read has a Cognitive Complexity of 22 (exceeds 20 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 35 mins 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 ReadLine8bpp has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
                            Open

                                    private void ReadLine8bpp(SimpleBinaryStream input, PipelineWriter output, byte[] buffer)
                                    {
                                        var normalized = true;
                                        switch (format)
                                        {
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs - About 25 mins 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

                            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

                            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

                            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

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

                                            case TextureFormat.R16G16_UNORM:
                                                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 366..374
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 523..531
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 552..560

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

                            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.R24G8_TYPELESS:
                                                for (int i = 0, j = 0; i < width; i++, j = i * 4)
                                                {
                                                    buffer[j] = input.ReadUInt24();
                                                    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 366..374
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 466..474
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 523..531

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

                            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.R8G8_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 466..474
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 523..531
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 552..560

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

                            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.R32G32_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 366..374
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 466..474
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 552..560

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

                            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.R8_UINT:
                                                for (int i = 0, j = 0; i < width; i++, j = i * 4)
                                                {
                                                    buffer[j] = input.ReadByte();
                                                    buffer[j + 3] = byte.MaxValue;
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 55 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 447..455

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

                            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:
                                                for (int i = 0, j = 0; i < width; i++, j = i * 4)
                                                {
                                                    buffer[j] = input.ReadUInt16();
                                                    buffer[j + 3] = ushort.MaxValue;
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 55 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 357..365

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

                            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

                                            buffer[i] = (int) ((rgba32[num + 2] >> 24) | (rgba32[num + 1] >> 24 << 8) | (rgba32[num] >> 24 << 16) | (rgba32[num + 3] >> 24 << 24));
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 45 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 1108..1108

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

                            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

                                            buffer[i] = (rgba16[num + 2] >> 8) | (rgba16[num + 1] >> 8 << 8) | (rgba16[num] >> 8 << 16) | (rgba16[num + 3] >> 8 << 24);
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 45 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 1119..1119

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

                            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

                                        var numMSB = (uint) (data[pointer + 4] | data[pointer + 5] << 8 | data[pointer + 6] << 16 | data[pointer + 7] << 24);
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 45 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 217..217

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

                            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

                                        var numMSB = (uint) (data[pointer + 4] | data[pointer + 5] << 8 | data[pointer + 6] << 16 | data[pointer + 7] << 24);
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 45 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 225..225

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

                            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

                                        var numLSB = (uint) (data[pointer] | data[pointer + 1] << 8 | data[pointer + 2] << 16 | data[pointer + 3] << 24);
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 40 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 216..216

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

                            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

                                        var numLSB = (uint) (data[pointer] | data[pointer + 1] << 8 | data[pointer + 2] << 16 | data[pointer + 3] << 24);
                            Severity: Minor
                            Found in src/Bannerlord.LauncherEx/TPac/TextureUtils.cs and 1 other location - About 40 mins to fix
                            src/Bannerlord.LauncherEx/TPac/TextureUtils.cs on lines 224..224

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

                            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

                            There are no issues that match your filters.

                            Category
                            Status