archanox/RGBDS2CIL

View on GitHub

Showing 278 of 278 total issues

Method ParseLine has a Cognitive Complexity of 194 (exceeds 20 allowed). Consider refactoring.
Open

        private static IEnumerable<IAsmLine> ParseLine(string fileLine, string fileName, int line)
        {
            var parsedLines = new List<IAsmLine>();

            var comment = GetComment(fileLine);
Severity: Minor
Found in RGBDS2CIL/Parser.cs - About 3 days 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 ParseLine has 259 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        private static IEnumerable<IAsmLine> ParseLine(string fileLine, string fileName, int line)
        {
            var parsedLines = new List<IAsmLine>();

            var comment = GetComment(fileLine);
Severity: Major
Found in RGBDS2CIL/Parser.cs - About 1 day to fix

    File Parser.cs has 373 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    using System;
    using System.Collections.Generic;
    using System.Collections.Immutable;
    using System.Diagnostics;
    using System.IO;
    Severity: Minor
    Found in RGBDS2CIL/Parser.cs - About 4 hrs to fix

      Method GenerateCil has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public static void GenerateCil()
              {
                  var aName = new AssemblyName("DynamicAssemblyExample");
                  var ab =
                      AssemblyBuilder.DefineDynamicAssembly(
      Severity: Major
      Found in RGBDS2CIL/CIL.cs - About 3 hrs to fix

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

        using System.Linq;
        
        namespace RGBDS2CIL
        {
            public class OrLine : CodeLine
        Severity: Major
        Found in RGBDS2CIL/Lines/OrLine.cs and 2 other locations - About 2 hrs to fix
        RGBDS2CIL/Lines/AndLine.cs on lines 1..25
        RGBDS2CIL/Lines/BitLine.cs on lines 1..25

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

        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

        using System.Linq;
        
        namespace RGBDS2CIL
        {
            public class AndLine : CodeLine
        Severity: Major
        Found in RGBDS2CIL/Lines/AndLine.cs and 2 other locations - About 2 hrs to fix
        RGBDS2CIL/Lines/BitLine.cs on lines 1..25
        RGBDS2CIL/Lines/OrLine.cs on lines 1..25

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

        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

        using System.Linq;
        
        namespace RGBDS2CIL
        {
            public class BitLine : CodeLine
        Severity: Major
        Found in RGBDS2CIL/Lines/BitLine.cs and 2 other locations - About 2 hrs to fix
        RGBDS2CIL/Lines/AndLine.cs on lines 1..25
        RGBDS2CIL/Lines/OrLine.cs on lines 1..25

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

        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

                    if (lastRepeatLine != null)
                    {
                        var repeatContents = parsedLines
                            .SkipWhile(x => x.LineId != lastRepeatLine.LineId)
                            .Skip(1)
        Severity: Major
        Found in RGBDS2CIL/Restructure.cs and 1 other location - About 2 hrs to fix
        RGBDS2CIL/Restructure.cs on lines 47..63

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

        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

                    if (lastIfLine != null)
                    {
                        var ifContents = parsedLines
                            .SkipWhile(x => x.LineId != lastIfLine.LineId)
                            .Skip(1)
        Severity: Major
        Found in RGBDS2CIL/Restructure.cs and 1 other location - About 2 hrs to fix
        RGBDS2CIL/Restructure.cs on lines 69..85

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        using System;
        using System.Text;
        
        namespace RGBDS2CIL
        {
        Severity: Major
        Found in RGBDS2CIL/Lines/IncrementLine.cs and 1 other location - About 1 hr to fix
        RGBDS2CIL/Lines/DecrementLine.cs on lines 1..20

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        using System;
        using System.Text;
        
        namespace RGBDS2CIL
        {
        Severity: Major
        Found in RGBDS2CIL/Lines/DecrementLine.cs and 1 other location - About 1 hr to fix
        RGBDS2CIL/Lines/IncrementLine.cs on lines 1..21

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                public DeclareSpaceLine(CodeLine codeLine) : base(codeLine.Code, codeLine, codeLine.Strings)
                {
                    var parameters = codeLine.Code["DS".Length..].Split(',');
        
                    if (parameters.Length == 1)
        Severity: Major
        Found in RGBDS2CIL/Lines/DeclareSpaceLine.cs and 1 other location - About 1 hr to fix
        RGBDS2CIL/Lines/RelativeJumpLine.cs on lines 11..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 137.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                public RelativeJumpLine(CodeLine codeLine) : base(codeLine.Code, codeLine, codeLine.Strings)
                {
                    var parameters = codeLine.Code["JR".Length..].Split(',');
        
                    if (parameters.Length == 1)
        Severity: Major
        Found in RGBDS2CIL/Lines/RelativeJumpLine.cs and 1 other location - About 1 hr to fix
        RGBDS2CIL/Lines/DeclareSpaceLine.cs on lines 10..23

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

        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

                        {
                            var labelName = codeLine.Code.Split()[0].ToUpper();
                            var labels = Labels
                                .Where(x => string.Equals(x.LabelName, labelName, StringComparison.OrdinalIgnoreCase))
                                .ToImmutableArray();
        Severity: Major
        Found in RGBDS2CIL/Parser.cs and 1 other location - About 1 hr to fix
        RGBDS2CIL/Parser.cs on lines 349..362

        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

                        {
                            var constantName = codeLine.Code.Split()[0].Trim();
        
                            var constants = Constants
                                .Where(x => string.Equals(x.ConstantName, constantName, StringComparison.OrdinalIgnoreCase))
        Severity: Major
        Found in RGBDS2CIL/Parser.cs and 1 other location - About 1 hr to fix
        RGBDS2CIL/Parser.cs on lines 332..347

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

                public new void OutputLine(StringBuilder sb, int tabCount)
                {
                    //TODO: support for loops
                    //FOR n, 1, NUM_SPRITESTATEDATA_STRUCTS
                    //FOR n, (NUM_TM_HM + 7) / 8
        Severity: Minor
        Found in RGBDS2CIL/Lines/RepeatLine.cs - About 1 hr to fix

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

          using System.Text;
          
          namespace RGBDS2CIL
          {
              public class EndRepeatLine : CodeLine, IAsmLine
          Severity: Major
          Found in RGBDS2CIL/Lines/EndRepeatLine.cs and 2 other locations - About 1 hr to fix
          RGBDS2CIL/Lines/EndConditionLine.cs on lines 1..16
          RGBDS2CIL/Lines/EndMacroLine.cs on lines 1..16

          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

          using System;
          
          namespace RGBDS2CIL
          {
              public class RotateLeftLine : CodeLine
          Severity: Major
          Found in RGBDS2CIL/Lines/RotateLeftLine.cs and 1 other location - About 1 hr to fix
          RGBDS2CIL/Lines/SwapLine.cs on lines 1..14

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

          using System.Text;
          
          namespace RGBDS2CIL
          {
              public class EndConditionLine : CodeLine, IAsmLine
          Severity: Major
          Found in RGBDS2CIL/Lines/EndConditionLine.cs and 2 other locations - About 1 hr to fix
          RGBDS2CIL/Lines/EndMacroLine.cs on lines 1..16
          RGBDS2CIL/Lines/EndRepeatLine.cs on lines 1..16

          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

          using System;
          
          namespace RGBDS2CIL
          {
              public class SwapLine : CodeLine
          Severity: Major
          Found in RGBDS2CIL/Lines/SwapLine.cs and 1 other location - About 1 hr to fix
          RGBDS2CIL/Lines/RotateLeftLine.cs on lines 1..14

          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

          Severity
          Category
          Status
          Source
          Language