grrrisu/Simulator

View on GitHub

Showing 6 of 15 total issues

Function dispatch has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  dispatch(socket) {
    socket.on_connect_error( (data) => {
      $('#net-status').html('<div class="message alert alert-danger">middleware not available</div>');
    });

Severity: Minor
Found in examples/node/monitor/game.js - About 1 hr to fix

    Function connect has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.connect = function(server, socket_file){
    
      const io = require('socket.io')(server);
    
      let player_id = null;
    Severity: Minor
    Found in node/lib/web_socket.js - About 1 hr to fix

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

        bind_event(socket) {
          $('#button-reverse').on('click', function(e){
            e.preventDefault();
            let action = {"scope": "example", "action": "reverse", "args": "hello world"}
            socket.send_message(action);
      Severity: Minor
      Found in examples/node/monitor/monitor_controller.js - About 1 hr to fix

        Method around_position has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def around_position x, y
                # Array[] handles negative index until -size
                if (0...width) === x && (0...height) === y
                  [x, y]
                else
        Severity: Minor
        Found in lib/sim/matrix/globe.rb - 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 render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render(){
        
            let chartPalette = new Rickshaw.Color.Palette( { scheme: this.palette } );
        
            this.chart = new Rickshaw.Graph( {
        Severity: Minor
        Found in examples/node/monitor/monitor_chart.js - About 1 hr to fix

          Method deep_transform_keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def deep_transform_keys(&block)
              result = {}
              each do |key, value|
                result[yield(key)] =  if value.is_a?(Hash)
                                        value.deep_transform_keys(&block)
          Severity: Minor
          Found in lib/ext/hash.rb - 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

          Severity
          Category
          Status
          Source
          Language