Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

src/htdocs/js/chess_play.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1.14

Size

Lines of Code 37
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 22
c 0
b 0
f 0
dl 0
loc 37
rs 10
wmc 8
mnd 1
bc 1
fnc 7
bpm 0.1428
cpm 1.1428
noi 4

2 Functions

Rating   Name   Duplication   Size   Complexity  
A chess_play.js ➔ bindOne 0 5 2
A chess_play.js ➔ submitMove 0 6 2
1
"use strict";
2
3
(function() {
4
5
	/** global availableMoves, submitMoveHREF */
6
7
	function submitMove(data) {
8
		var e = $(this);
9
		data.toX = e.data('x');
10
		data.toY = e.data('y');
11
		ajaxLink(submitMoveHREF, {callback: highlightMoves, params: data});
0 ignored issues
show
Bug introduced by
The variable submitMoveHREF seems to be never declared. If this is a global, consider adding a /** global: submitMoveHREF */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable highlightMoves seems to be never declared. If this is a global, consider adding a /** global: highlightMoves */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
12
	}
13
14
	function bindOne(func, arg) {
15
		return function() {
16
			return func.call(this, arg);
17
		};
18
	}
19
20
	window.highlightMoves = function() {
21
		var highlighted = $('.chessHighlight');
22
		if (highlighted.length === 0) {
23
			var e = $(this);
24
			var x = e.data('x');
25
			var y = e.data('y');
26
			var boundSubmitMove = bindOne(submitMove, {x:x,y:y});
27
			$(availableMoves[y][x]).addClass('chessHighlight').each(function(i, e) {
0 ignored issues
show
Bug introduced by
The variable availableMoves seems to be never declared. If this is a global, consider adding a /** global: availableMoves */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
28
				e.onclick = boundSubmitMove;
29
			});
30
		} else {
31
			highlighted.removeClass('chessHighlight').each(function(i, e){
32
				e.onclick = highlightMoves;
0 ignored issues
show
Bug introduced by
The variable highlightMoves seems to be never declared. If this is a global, consider adding a /** global: highlightMoves */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
33
			});
34
		}
35
	};
36
37
})();
38