[go: nahoru, domu]

Skip to content

Commit

Permalink
Enforce curly braces for control statements
Browse files Browse the repository at this point in the history
  • Loading branch information
CendioOssman committed Sep 6, 2018
1 parent 4a16dc5 commit 426a8c9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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 }],
Expand Down
12 changes: 8 additions & 4 deletions app/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions core/input/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion core/rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
20 changes: 13 additions & 7 deletions core/util/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,38 +187,44 @@ 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?
// (i.e. are we over the target, or a child of the target without a
// 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() {
Expand Down
3 changes: 2 additions & 1 deletion tests/karma-test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion tests/playback-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 426a8c9

Please sign in to comment.