uccser/cs-field-guide

View on GitHub

Showing 873 of 873 total issues

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

function init() {
  Key = "";
  Message = "";

  $('#rsa-encryption-components-box').val("");
csfieldguide/static/interactives/rsa-decryption/js/rsa-decryption.js on lines 91..116

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 266.

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

function init() {
  Key = "";
  Message = "";

  $('#rsa-decryption-components-box').val("");
csfieldguide/static/interactives/rsa-encryption/js/rsa-encryption.js on lines 91..116

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 266.

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

File scene-editor.js has 620 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** Parts of this file are heavily adapted from https://github.com/mrdoob/three.js/blob/dev/examples/webgl_materials_envmaps.html */

global.THREE = require('three');
const { create, all } = require('mathjs');
const mathjs = create(all, {});
Severity: Major
Found in csfieldguide/static/interactives/scene-editor/js/scene-editor.js - About 1 day to fix

File game.js has 619 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Packet Attack
 * 
 * Main Gameplay Classes
 */
Severity: Major
Found in csfieldguide/static/interactives/packet-attack/js/game.js - About 1 day to fix

File Scroller.js has 608 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Scroller
 * http://github.com/zynga/scroller
 *
 * Copyright 2011, Zynga Inc.

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

def selection_sort_count(sample_list):
    """
    Perform min selection sort on values in sample_list.

    Returns the number of comparisons required.
Severity: Major
Found in csfieldguide/static/files/selection-quicksort-python3.py and 1 other location - About 1 day to fix
csfieldguide/static/files/selection-quicksort-python2.py on lines 33..49

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 137.

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

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

def selection_sort_count(sample_list):
    """
    Perform min selection sort on values in sample_list.

    Returns the number of comparisons required.
Severity: Major
Found in csfieldguide/static/files/selection-quicksort-python2.py and 1 other location - About 1 day to fix
csfieldguide/static/files/selection-quicksort-python3.py on lines 33..49

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 137.

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

    $('iframe[src*="youtube"]', this).each(function () {
        var player = $(this).data('youtube-player');
        if (player === undefined) {
            // If iframe has no ID
            if (!this.id) {
Severity: Major
Found in csfieldguide/static/js/website.js and 1 other location - About 1 day to fix
csfieldguide/static/js/website.js on lines 109..130

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 213.

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

    $('iframe[src*="vimeo"]', this).each(function () {
        var player = $(this).data('vimeo-player');
        if (player === undefined) {
            // If iframe has no ID
            if (!this.id) {
Severity: Major
Found in csfieldguide/static/js/website.js and 1 other location - About 1 day to fix
csfieldguide/static/js/website.js on lines 83..104

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 213.

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

Function assemble has 218 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function assemble() {
    LABELS = [];
    LABELADDRS = [];
    var targetIndex;

Severity: Major
Found in csfieldguide/static/interactives/mips-assembler/js/mips-assembler.js - About 1 day to fix

Function highlightCodedCharacters has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

function highlightCodedCharacters() {
    // clear the existing references
    for (var i = 0; i < message_characters.length; i++) {
        message_characters[i].CodeIndex = false;
        var character_element = document.querySelectorAll('[data-character-index="' + i.toString() + '"]')[0];

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File cfg-parsing-challenge.js has 519 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var urlParameters = require('../../../js/third-party/url-parameters.js');

/**
* Productions in the default grammar.
* A number or a string that begins and ends with an inverted comma (') is

File shannon-experiment.js has 517 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const Chart = require('chart.js');
Chart.defaults.font.size = 14;
Chart.defaults.font.family = '"Noto Sans", sans-serif';

// This is not a constant as we remove sentences once they are completed.

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

def test_selection_sort(n, show_list):
    """Measure the performance of selection sort on a random list."""
    sample_list = list(range(n))  # create a sorted list of n keys
    shuffle(sample_list)  # shuffle them
    print("\nSelection sorting", n, "keys")
Severity: Major
Found in csfieldguide/static/files/selection-quicksort-python3.py and 1 other location - About 1 day to fix
csfieldguide/static/files/selection-quicksort-python3.py on lines 131..149

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 125.

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

def test_quick_sort(n, show_list):
    """Create a random list and measure the performance of quicksort on it."""
    sample_list = list(range(n))  # create a sorted list of n keys
    # commenting out the line below overflows the recursion limit
    # when the list is large
Severity: Major
Found in csfieldguide/static/files/selection-quicksort-python3.py and 1 other location - About 1 day to fix
csfieldguide/static/files/selection-quicksort-python3.py on lines 112..128

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 125.

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

File matrix-simplifier.js has 510 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const dragula = require('dragula');
const mathjs_import = require('mathjs');
const sprintf = require('sprintf-js').sprintf;
const vsprintf = require('sprintf-js').vsprintf;

File jpeg-compression.js has 508 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const Interact = require('interactjs');
var urlParameters = require('../../../js/third-party/url-parameters.js');
require('./../../../js/third-party/jquery.stepper');
const dct = require('dct');

File training-ground.js has 498 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * trAIning ground
 * 
 * Creates and executes the game
 */

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

Severity: Major
Found in csfieldguide/utils/errors/CouldNotFindImageError.py and 1 other location - About 7 hrs to fix
csfieldguide/utils/errors/CouldNotFindMarkdownFileError.py on lines 0..26

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 119.

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

Severity: Major
Found in csfieldguide/utils/errors/CouldNotFindMarkdownFileError.py and 1 other location - About 7 hrs to fix
csfieldguide/utils/errors/CouldNotFindImageError.py on lines 0..26

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 119.

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

Severity
Category
Status
Source
Language