crcastle/collaborative-code-conference

View on GitHub
src/client/coding.js

Summary

Maintainability
B
6 hrs
Test Coverage

Do not use 'new' for side effects.
Open

new bsn.Popover(createGistButton, {trigger: 'click'});  //handle 'create' not implemented yet
Severity: Minor
Found in src/client/coding.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: figure out how to not duplicate code: languages are named here plus
Severity: Minor
Found in src/client/coding.js by fixme

FIXME found
Open

// FIXME: figure out how to makes the themes configurable
Severity: Minor
Found in src/client/coding.js by fixme

FIXME found
Open

// FIXME: figure out how to makes the languages configurable
Severity: Minor
Found in src/client/coding.js by fixme

FIXME found
Open

// FIXME: figure out how to not duplicate code listing themes here and select menu options below
Severity: Minor
Found in src/client/coding.js by fixme

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  anchor.addEventListener('click', function(e) {
    e.preventDefault();
    cm.setOption('mode', mime);
    document.querySelector('#language-button-text').innerHTML = 'Language: ' + name;
    cm.focus();
Severity: Major
Found in src/client/coding.js and 1 other location - About 1 hr to fix
src/client/coding.js on lines 104..109

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  anchor.addEventListener('click', function(e) {
    e.preventDefault();
    cm.setOption('theme', classPrefix);
    document.querySelector('#theme-button-text').innerHTML = 'Theme: ' + name;
    cm.focus();
Severity: Major
Found in src/client/coding.js and 1 other location - About 1 hr to fix
src/client/coding.js on lines 63..68

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

for (var j = 0; j < themes.length; j++) {
  themeSelector.appendChild(themeListItem(themes[j].name, themes[j].classPrefix));
}
Severity: Major
Found in src/client/coding.js and 1 other location - About 1 hr to fix
src/client/coding.js on lines 90..92

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

for (var i = 0; i < languages.length; i++) {
  modeSelector.appendChild(languageListItem(languages[i].name, languages[i].mime));
}
Severity: Major
Found in src/client/coding.js and 1 other location - About 1 hr to fix
src/client/coding.js on lines 125..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 59.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status