crcastle/collaborative-code-conference

View on GitHub
src/client/webrtc.js

Summary

Maintainability
A
1 hr
Test Coverage

Function clientConnected has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function clientConnected() {
  // document.getElementById('invite-controls').style.display = 'block';
  console.log("Connected to Twilio. Listening for incoming Invites as '", conversationsClient.identity, "'");

  conversationsClient.on('invite', function (invite) {
Severity: Minor
Found in src/client/webrtc.js - About 1 hr to fix

Unexpected alert.
Open

          alert('Only two participants supported at this time.');
Severity: Minor
Found in src/client/webrtc.js by eslint

Disallow Use of Alert (no-alert)

JavaScript's alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert is often used while debugging code, which should be removed before deployment to production.

alert("here!");

Rule Details

This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert, prompt, and confirm function calls which are not shadowed.

Examples of incorrect code for this rule:

/*eslint no-alert: "error"*/

alert("here!");

confirm("Are you sure?");

prompt("What's your name?", "John Doe");

Examples of correct code for this rule:

/*eslint no-alert: "error"*/

customAlert("Something happened!");

customConfirm("Are you sure?");

customPrompt("Who are you?");

function foo() {
    var alert = myCustomLib.customAlert;
    alert();
}

Related Rules

Do not use 'new' for side effects.
Open

    new bsn.Button(document.querySelector('#connect-dropdown'), 'loading');
Severity: Minor
Found in src/client/webrtc.js by eslint

Disallow new For Side Effects (no-new)

The goal of using new with a constructor is typically to create an object of a particular type and store that object in a variable, such as:

var person = new Person();

It's less common to use new and not store the result, such as:

new Person();

In this case, the created object is thrown away because its reference isn't stored anywhere, and in many cases, this means that the constructor should be replaced with a function that doesn't require new to be used.

Rule Details

This rule is aimed at maintaining consistency and convention by disallowing constructor calls using the new keyword that do not assign the resulting object to a variable.

Examples of incorrect code for this rule:

/*eslint no-new: "error"*/

new Thing();

Examples of correct code for this rule:

/*eslint no-new: "error"*/

var thing = new Thing();

Thing();

Source: http://eslint.org/docs/rules/

Do not use 'new' for side effects.
Open

    new bsn.Button(connectButton, 'reset');
Severity: Minor
Found in src/client/webrtc.js by eslint

Disallow new For Side Effects (no-new)

The goal of using new with a constructor is typically to create an object of a particular type and store that object in a variable, such as:

var person = new Person();

It's less common to use new and not store the result, such as:

new Person();

In this case, the created object is thrown away because its reference isn't stored anywhere, and in many cases, this means that the constructor should be replaced with a function that doesn't require new to be used.

Rule Details

This rule is aimed at maintaining consistency and convention by disallowing constructor calls using the new keyword that do not assign the resulting object to a variable.

Examples of incorrect code for this rule:

/*eslint no-new: "error"*/

new Thing();

Examples of correct code for this rule:

/*eslint no-new: "error"*/

var thing = new Thing();

Thing();

Source: http://eslint.org/docs/rules/

Unexpected alert.
Open

  alert('Your browser does not support WebRTC, which is required for video and audio.\n\n'
Severity: Minor
Found in src/client/webrtc.js by eslint

Disallow Use of Alert (no-alert)

JavaScript's alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert is often used while debugging code, which should be removed before deployment to production.

alert("here!");

Rule Details

This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert, prompt, and confirm function calls which are not shadowed.

Examples of incorrect code for this rule:

/*eslint no-alert: "error"*/

alert("here!");

confirm("Are you sure?");

prompt("What's your name?", "John Doe");

Examples of correct code for this rule:

/*eslint no-alert: "error"*/

customAlert("Something happened!");

customConfirm("Are you sure?");

customPrompt("Who are you?");

function foo() {
    var alert = myCustomLib.customAlert;
    alert();
}

Related Rules

Unexpected confirm.
Open

      accept = window.confirm('Accept video/audio connection from ' + invite.from + '?');
Severity: Minor
Found in src/client/webrtc.js by eslint

Disallow Use of Alert (no-alert)

JavaScript's alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation. Furthermore, alert is often used while debugging code, which should be removed before deployment to production.

alert("here!");

Rule Details

This rule is aimed at catching debugging code that should be removed and popup UI elements that should be replaced with less obtrusive, custom UIs. As such, it will warn when it encounters alert, prompt, and confirm function calls which are not shadowed.

Examples of incorrect code for this rule:

/*eslint no-alert: "error"*/

alert("here!");

confirm("Are you sure?");

prompt("What's your name?", "John Doe");

Examples of correct code for this rule:

/*eslint no-alert: "error"*/

customAlert("Something happened!");

customConfirm("Are you sure?");

customPrompt("Who are you?");

function foo() {
    var alert = myCustomLib.customAlert;
    alert();
}

Related Rules

Do not use 'new' for side effects.
Open

    new bsn.Button(document.querySelector('#connect'), 'loading');
Severity: Minor
Found in src/client/webrtc.js by eslint

Disallow new For Side Effects (no-new)

The goal of using new with a constructor is typically to create an object of a particular type and store that object in a variable, such as:

var person = new Person();

It's less common to use new and not store the result, such as:

new Person();

In this case, the created object is thrown away because its reference isn't stored anywhere, and in many cases, this means that the constructor should be replaced with a function that doesn't require new to be used.

Rule Details

This rule is aimed at maintaining consistency and convention by disallowing constructor calls using the new keyword that do not assign the resulting object to a variable.

Examples of incorrect code for this rule:

/*eslint no-new: "error"*/

new Thing();

Examples of correct code for this rule:

/*eslint no-new: "error"*/

var thing = new Thing();

Thing();

Source: http://eslint.org/docs/rules/

FIXME found
Open

            // FIXME: show error to user, un-disable button, and change identity back to docName
Severity: Minor
Found in src/client/webrtc.js by fixme

TODO found
Open

    connectButton.setAttribute('disabled', 'disabled'); //TODO: change this to 'Disconnect'
Severity: Minor
Found in src/client/webrtc.js by fixme

TODO found
Open

    var username = 'the-other-user'; //TODO: prompt user for their name
Severity: Minor
Found in src/client/webrtc.js by fixme

TODO found
Open

      // TODO: change button text to 'Stop My Camera'
Severity: Minor
Found in src/client/webrtc.js by fixme

TODO found
Open

    connectButton.setAttribute('disabled', 'disabled'); //TODO: change this to 'Disconnect'
Severity: Minor
Found in src/client/webrtc.js by fixme

There are no issues that match your filters.

Category
Status