JeffDeCola/control-fpga-via-raspi-and-webserver

View on GitHub

Showing 18 of 219 total issues

File opcode.js has 1413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* opcode.js */

console.log("STARTING opcode.js JAVASCRIPT");

var compute_go_state = "ready";
Severity: Major
Found in section-4-web-server/control-an-fpga/js/opcode.js - About 3 days to fix

    Function main has 184 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func main() {
    
        fmt.Println("Working on browser")
    
        // INIT HOST MACHINE (i.e. Raspberry Pi)
    Severity: Major
    Found in section-3-backend-server/main.go - About 6 hrs to fix

      Method data_pins.write_data_in has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring.
      Open

      func (d data_pins) write_data_in(d7 int, d6 int, d5 int, d4 int, d3 int, d2 int, d1 int, d0 int) {
      
          if d7 == 1 {
              err := d.data_7.Out(gpio.High)
              if err != nil {
      Severity: Minor
      Found in section-3-backend-server/main.go - About 4 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

      Function main has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
      Open

      func main() {
      
          fmt.Println("Working on browser")
      
          // INIT HOST MACHINE (i.e. Raspberry Pi)
      Severity: Minor
      Found in section-3-backend-server/main.go - About 3 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 try-it.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <!-- try-it -->
      
      <link rel="stylesheet" type="text/css" href="css/try-it.css">
      <link rel="stylesheet" type="text/css" href="css/browser_body.css">
      <script type="text/javascript" src="js/opcode.js"></script>
      Severity: Minor
      Found in section-4-web-server/control-an-fpga/try-it/try-it.php - About 3 hrs to fix

        File main.go has 525 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // my-go-examples toggle-led-with-button-raspberry-pi-gpio-periph
        
        package main
        
        import (
        Severity: Minor
        Found in section-3-backend-server/main.go - About 2 hrs to fix

          Method data_pins.write_data_in has 88 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (d data_pins) write_data_in(d7 int, d6 int, d5 int, d4 int, d3 int, d2 int, d1 int, d0 int) {
          
              if d7 == 1 {
                  err := d.data_7.Out(gpio.High)
                  if err != nil {
          Severity: Major
          Found in section-3-backend-server/main.go - About 2 hrs to fix

            Method data_a_pins.write_data_in_a has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring.
            Open

            func (d data_a_pins) write_data_in_a(d7 int, d3 int, d2 int, d1 int, d0 int) {
            
                if d7 == 1 {
                    err := d.data_7.Out(gpio.High)
                    if err != nil {
            Severity: Minor
            Found in section-3-backend-server/main.go - About 1 hr 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

            Function compute has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function compute() {
                
                console.log("STEP 4 - SEND OPCODE, DATA_IN_A, DATA_IN_B AND GO TO WEB SERVER");
                document.getElementById("data_out_7").innerHTML=" ";
                document.getElementById("data_out_6").innerHTML="W";
            Severity: Minor
            Found in section-4-web-server/control-an-fpga/js/opcode.js - About 1 hr to fix

              Function send_data_to_web_server has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function send_data_to_web_server(opcode, data_in_a, data_in_b, go) {
              
                  // CREATE A NEW REQUEST
                  postRequest = new XMLHttpRequest();
                      if (!postRequest) {
              Severity: Minor
              Found in section-4-web-server/control-an-fpga/js/ajax_xhr_call_post.js - About 1 hr to fix

                Method data_a_pins.write_data_in_a has 55 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (d data_a_pins) write_data_in_a(d7 int, d3 int, d2 int, d1 int, d0 int) {
                
                    if d7 == 1 {
                        err := d.data_7.Out(gpio.High)
                        if err != nil {
                Severity: Minor
                Found in section-3-backend-server/main.go - About 1 hr to fix

                  Function show_data_out has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function show_data_out(data) {
                  
                      console.log("SHOW DATA_OUT FROM FPGA");
                      console.log("data = " + data.data_out);
                      document.getElementById("data_out").classList.remove("pulse"); // PULSE DATA_OUT OFF
                  Severity: Minor
                  Found in section-4-web-server/control-an-fpga/js/opcode.js - About 1 hr to fix

                    Function server_error has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function server_error() {
                    
                        console.log("SERVER ERROR");
                        document.getElementById("data_out").classList.remove("pulse"); // PULSE DATA_OUT OFF
                        document.getElementById("html_interface_arrow_right").classList.remove("pulse"); // PULSE ARROW RIGHT OFF
                    Severity: Minor
                    Found in section-4-web-server/control-an-fpga/js/opcode.js - About 1 hr to fix

                      Method data_pins.write_data_in has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func (d data_pins) write_data_in(d7 int, d6 int, d5 int, d4 int, d3 int, d2 int, d1 int, d0 int) {
                      Severity: Major
                      Found in section-3-backend-server/main.go - About 1 hr to fix

                        Function send_data_to_web_server has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function send_data_to_web_server(opcode, data_in_a, data_in_b, go) {
                        
                            // CREATE A NEW REQUEST
                            postRequest = new XMLHttpRequest();
                                if (!postRequest) {
                        Severity: Minor
                        Found in section-4-web-server/control-an-fpga/js/ajax_xhr_call_post.js - About 55 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 opcode_pins.write_opcode has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (o opcode_pins) write_opcode(o3 int, o2 int, o1 int, o0 int) {
                        
                            if o3 == 1 {
                                err := o.opcode_3.Out(gpio.High)
                                if err != nil {
                        Severity: Minor
                        Found in section-3-backend-server/main.go - About 55 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

                        Function UserControl has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func UserControl(opcode opcode_pins, data_in_a data_a_pins, data_in_b data_pins, GO_BAR_PIN gpio.PinIO, RESET_PIN gpio.PinIO, JAM_PIN gpio.PinIO, data_out data_pins) {
                        Severity: Major
                        Found in section-3-backend-server/main.go - About 50 mins to fix

                          Method data_a_pins.write_data_in_a has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          func (d data_a_pins) write_data_in_a(d7 int, d3 int, d2 int, d1 int, d0 int) {
                          Severity: Minor
                          Found in section-3-backend-server/main.go - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language