summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-09-06 17:22:40 +0200
committerPierre Ossman <ossman@cendio.se>2018-09-06 17:22:40 +0200
commit426a8c927bbea710b0429d75c4f3ab7b278c902d (patch)
tree8ab4754e71ce243f75930a1a172c48a00333315d
parent4a16dc51a8e514cd52aaba54cc6c863bf212e288 (diff)
downloadnovnc-426a8c927bbea710b0429d75c4f3ab7b278c902d.tar.gz
Enforce curly braces for control statements
-rw-r--r--.eslintrc1
-rw-r--r--app/localization.js12
-rw-r--r--core/input/keyboard.js5
-rw-r--r--core/rfb.js4
-rw-r--r--core/util/cursor.js20
-rw-r--r--tests/karma-test-main.js3
-rw-r--r--tests/playback-ui.js3
7 files changed, 32 insertions, 16 deletions
diff --git a/.eslintrc b/.eslintrc
index c28a798..ecf5584 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -31,6 +31,7 @@
"ignoreComments": true }],
"comma-spacing": ["error"],
"comma-style": ["error"],
+ "curly": ["error", "multi-line"],
"func-call-spacing": ["error"],
"func-names": ["error"],
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
diff --git a/app/localization.js b/app/localization.js
index 8f424b3..90a98d4 100644
--- a/app/localization.js
+++ b/app/localization.js
@@ -53,10 +53,12 @@ export class Localizer {
.replace("_", "-")
.split("-");
- if (userLang[0] !== supLang[0])
+ if (userLang[0] !== supLang[0]) {
continue;
- if (userLang[1] !== supLang[1])
+ }
+ if (userLang[1] !== supLang[1]) {
continue;
+ }
this.language = supportedLanguages[j];
return;
@@ -69,10 +71,12 @@ export class Localizer {
.replace("_", "-")
.split("-");
- if (userLang[0] !== supLang[0])
+ if (userLang[0] !== supLang[0]) {
continue;
- if (supLang[1] !== undefined)
+ }
+ if (supLang[1] !== undefined) {
continue;
+ }
this.language = supportedLanguages[j];
return;
diff --git a/core/input/keyboard.js b/core/input/keyboard.js
index f8a6582..55ce917 100644
--- a/core/input/keyboard.js
+++ b/core/input/keyboard.js
@@ -249,10 +249,11 @@ export default class Keyboard {
// Character (A-Z)
let char = String.fromCharCode(e.keyCode);
// A feeble attempt at the correct case
- if (e.shiftKey)
+ if (e.shiftKey) {
char = char.toUpperCase();
- else
+ } else {
char = char.toLowerCase();
+ }
keysym = char.charCodeAt();
} else {
// Unknown, give up
diff --git a/core/rfb.js b/core/rfb.js
index 5049c33..c579389 100644
--- a/core/rfb.js
+++ b/core/rfb.js
@@ -2348,8 +2348,10 @@ RFB.encodingHandlers = {
else if (ctl === 0x0A) cmode = "png";
else if (ctl & 0x04) cmode = "filter";
else if (ctl < 0x04) cmode = "copy";
- else return this._fail("Illegal tight compression received (ctl: " +
+ else {
+ return this._fail("Illegal tight compression received (ctl: " +
ctl + ")");
+ }
if (isTightPNG && (ctl < 0x08)) {
return this._fail("BasicCompression received in TightPNG rect");
diff --git a/core/util/cursor.js b/core/util/cursor.js
index 18aa7be..d36b657 100644
--- a/core/util/cursor.js
+++ b/core/util/cursor.js
@@ -187,13 +187,15 @@ export default class Cursor {
}
_showCursor() {
- if (this._canvas.style.visibility === 'hidden')
+ if (this._canvas.style.visibility === 'hidden') {
this._canvas.style.visibility = '';
+ }
}
_hideCursor() {
- if (this._canvas.style.visibility !== 'hidden')
+ if (this._canvas.style.visibility !== 'hidden') {
this._canvas.style.visibility = 'hidden';
+ }
}
// Should we currently display the cursor?
@@ -201,24 +203,28 @@ export default class Cursor {
// different cursor set)
_shouldShowCursor(target) {
// Easy case
- if (target === this._target)
+ if (target === this._target) {
return true;
+ }
// Other part of the DOM?
- if (!this._target.contains(target))
+ if (!this._target.contains(target)) {
return false;
+ }
// Has the child its own cursor?
// FIXME: How can we tell that a sub element has an
// explicit "cursor: none;"?
- if (window.getComputedStyle(target).cursor !== 'none')
+ if (window.getComputedStyle(target).cursor !== 'none') {
return false;
+ }
return true;
}
_updateVisibility(target) {
- if (this._shouldShowCursor(target))
+ if (this._shouldShowCursor(target)) {
this._showCursor();
- else
+ } else {
this._hideCursor();
+ }
}
_updatePosition() {
diff --git a/tests/karma-test-main.js b/tests/karma-test-main.js
index c1b3ad4..2843666 100644
--- a/tests/karma-test-main.js
+++ b/tests/karma-test-main.js
@@ -35,8 +35,9 @@ document.body.appendChild(script);
function fallback() {
if (!window._noVNC_has_module_support) {
/* eslint-disable no-console */
- if (console)
+ if (console) {
console.log("No module support detected. Loading fallback...");
+ }
/* eslint-enable no-console */
let loader = document.createElement("script");
loader.src = "base/vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
diff --git a/tests/playback-ui.js b/tests/playback-ui.js
index 295f983..012eebc 100644
--- a/tests/playback-ui.js
+++ b/tests/playback-ui.js
@@ -49,8 +49,9 @@ function enableUI() {
frames = VNC_frame_data;
// Only present in older recordings
- if (window.VNC_frame_encoding)
+ if (window.VNC_frame_encoding) {
encoding = VNC_frame_encoding;
+ }
}
class IterationPlayer {