CORE-POS/IS4C

View on GitHub
pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs

Summary

Maintainability
F
3 days
Test Coverage

Method Read has a Cognitive Complexity of 51 (exceeds 20 allowed). Consider refactoring.
Open

    override public void Read()
    {
        showPaymentScreen();
        System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();

Severity: Minor
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File RBA_Stub.cs has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;
using System.IO.Ports;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
Severity: Minor
Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 4 hrs to fix

    Method getEmailSync has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
    Open

        public string getEmailSync()
        {
            string ret = "";
            try {
                initPort();
    Severity: Minor
    Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method Choice has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private bool Choice(string str)
        {
            bool ret = false;
            if (str.Substring(1,4) == "24.0") {
                switch (str.Substring(5,1)) {
    Severity: Major
    Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 2 hrs to fix

      Class RBA_Stub has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class RBA_Stub : SPH_IngenicoRBA_Common 
      {
          new private SerialPort sp = null;
      
          private RbaButtons emv_buttons = RbaButtons.Credit;
      Severity: Minor
      Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 2 hrs to fix

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

            override public void Read()
            {
                showPaymentScreen();
                System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
        
        
        Severity: Minor
        Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 1 hr to fix

          Method getEmailSync has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public string getEmailSync()
              {
                  string ret = "";
                  try {
                      initPort();
          Severity: Minor
          Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs - About 1 hr to fix

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

                private byte[] GetLRC(byte[] b)
                {
                    byte[] ret = new byte[b.Length+1];
                    ret[0] = b[0]; // STX
                    byte lrc = 0;
            Severity: Major
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs and 2 other locations - About 2 hrs to fix
            pos/is4c-nf/scale-drivers/drivers/NewMagellan/RbaVolume.cs on lines 16..28
            pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_IngenicoRBA_RS232.cs on lines 130..142

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

            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

                    if (this.verbose_mode > 1) {
                        System.Console.WriteLine("Sent:");
                        foreach (byte a in b) {
                            if (a < 10) {
                                System.Console.Write("0{0} ",a);
            Severity: Major
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs and 1 other location - About 1 hr to fix
            pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_IngenicoRBA_RS232.cs on lines 92..102

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

            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

                {
                    sp = new SerialPort();
                    sp.PortName = this.port;
                    sp.BaudRate = 19200;
                    sp.DataBits = 8;
            Severity: Major
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs and 1 other location - About 1 hr to fix
            pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_SMA_Scale.cs on lines 17..27

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

            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 "C":
                                // ebt cash
                                ret = true;
                                if (allowDebitCB) {
                                    ret = false;
            Severity: Minor
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs and 1 other location - About 40 mins to fix
            pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs on lines 418..429

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

            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 "A":
                                // debit
                                ret = true;
                                if (allowDebitCB) {
                                    ret = false;
            Severity: Minor
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs and 1 other location - About 40 mins to fix
            pos/is4c-nf/scale-drivers/drivers/NewMagellan/RBA_Stub.cs on lines 435..446

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

            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