Showing 6 of 15 total issues
Function dispatch
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
dispatch(socket) {
socket.on_connect_error( (data) => {
$('#net-status').html('<div class="message alert alert-danger">middleware not available</div>');
});
Function connect
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.connect = function(server, socket_file){
const io = require('socket.io')(server);
let player_id = null;
Function bind_event
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Method around_position
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def around_position x, y
# Array[] handles negative index until -size
if (0...width) === x && (0...height) === y
[x, y]
else
- Read upRead up
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
Open
render(){
let chartPalette = new Rickshaw.Color.Palette( { scheme: this.palette } );
this.chart = new Rickshaw.Graph( {
Method deep_transform_keys
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def deep_transform_keys(&block)
result = {}
each do |key, value|
result[yield(key)] = if value.is_a?(Hash)
value.deep_transform_keys(&block)
- Read upRead up
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"