uccser/cs-field-guide

View on GitHub

Showing 873 of 873 total issues

Function handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def handle(self, *args, **options):
        """Automatically called when the command is given."""
        # Wipe all search indexes
        SearchItem.objects.all().delete()

Severity: Minor
Found in csfieldguide/search/management/commands/rebuild_search_indexes.py - About 25 mins to fix

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

Function selection_sort_count has a Cognitive Complexity of 6 (exceeds 5 allowed). 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: Minor
Found in csfieldguide/static/files/selection-quicksort-python2.py - About 25 mins to fix

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

Function autoTab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function autoTab(event) {
    // get current input box
    var current_placeholder_element = event.srcElement;

    // if reached maximum number of characters that are allowed in the input box
Severity: Minor
Found in csfieldguide/static/interactives/lzw-compression/js/lzw-compression.js - About 25 mins to fix

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

Function updateBrailleCharacter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function updateBrailleCharacter() {
    var character_label = $('#braille-character');
    var character_note = $('#braille-character-note');
    braille_character_index = mod(braille_character_index, braille_character_data.length);
    var data = braille_character_data[braille_character_index];
Severity: Minor
Found in csfieldguide/static/interactives/braille-alphabet/js/braille-alphabet.js - About 25 mins to fix

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

Function thumbnail_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def thumbnail_json(request, **kwargs):
    """Provide JSON data for creating thumbnails.

    Args:
        request: The HTTP request.
Severity: Minor
Found in csfieldguide/interactives/views.py - About 25 mins to fix

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

Function getParameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function getParameters() {
  var chanceOfAiStart = whoStartsRange.noUiSlider.get();
  if (chanceOfAiStart == TXT_AI_ALWAYS) {
    chanceOfPlayerStart = 0;
  } else if (chanceOfAiStart == TXT_PLAYER_ALWAYS) {
Severity: Minor
Found in csfieldguide/static/interactives/training-ground/js/training-ground.js - About 25 mins to fix

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

Function get_markdown_translations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_markdown_translations(self, filename, required=True, **kwargs):
        """Get dictionary of translations of the requested markdown file.

        Args:
            filename: (str) path to yaml file from the working directory of the loader
Severity: Minor
Found in csfieldguide/utils/TranslatableModelLoader.py - About 25 mins to fix

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

Function load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def load(self):
        """Store the headings for a chapter section.

        The function iterates through the headings for each language, and
        for each heading, it creates an heading object in the database.

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

Function traverse_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def traverse_node(node, title_slugs, md_file_path):
    """Check all heading slugs are unique in tree.

    Args:
        node (NamedTuple): Node of heading tree.
Severity: Minor
Found in csfieldguide/utils/check_heading_tree.py - About 25 mins to fix

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

Function modInverse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function modInverse(a, m) {
  // validate inputs
  [a, m] = [Number(a), Number(m)]
  if (Number.isNaN(a) || Number.isNaN(m)) {
    return NaN // invalid input
Severity: Minor
Found in csfieldguide/static/interactives/rsa-encryption/js/rsa-encryption.js - About 25 mins to fix

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

Function selection_sort_count has a Cognitive Complexity of 6 (exceeds 5 allowed). 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: Minor
Found in csfieldguide/static/files/selection-quicksort-python3.py - About 25 mins to fix

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

Function interpretKeyPkcs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function interpretKeyPkcs() {
  var pastedContent = $('#rsa-encryption-key').val().trim();
  if (pastedContent.startsWith("e:")) {
    // Likely pasted a PUBLIC Components key
    $('#rsa-encryption-key-format').val('components');
Severity: Minor
Found in csfieldguide/static/interactives/rsa-encryption/js/rsa-encryption.js - About 25 mins to fix

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

Function applyMove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function applyMove(player, numChosen) {
  if (player == PLAYERS.AI) {
    if (!isSimulation) {
      sticksGrid.removeSticks(numChosen);
    }
Severity: Minor
Found in csfieldguide/static/interactives/training-ground/js/training-ground.js - About 25 mins to fix

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

Severity
Category
Status
Source
Language