muneebalam/scrapenhl2

View on GitHub

Showing 724 of 747 total issues

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

def _get_point_sizes_for_fline_scatter(df):
    """
    A helper method that scales scatterpoint sizes corresponding to TOI column. The largest point gets a size of 200;
    others get smaller linearly.

Severity: Major
Found in scrapenhl2/plot/forward_trios.py and 1 other location - About 2 hrs to fix
scrapenhl2/plot/defense_pairs.py on lines 100..112

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

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 _get_point_sizes_for_dpair_scatter(df):
    """
    A helper method that scales scatterpoint sizes corresponding to TOI column. The largest point gets a size of 200;
    others get smaller linearly.

Severity: Major
Found in scrapenhl2/plot/defense_pairs.py and 1 other location - About 2 hrs to fix
scrapenhl2/plot/forward_trios.py on lines 122..134

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

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 read_final_games has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def read_final_games(games, season):
    """

    :param games:
    :param season:
Severity: Minor
Found in scrapenhl2/scrape/autoupdate.py - About 2 hrs 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

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

def live_timeline(team1, team2, update=True, save_file=None):
    """
    A convenience method that updates data then displays timeline for most recent game between specified tams.

    :param team1: str or int, team
Severity: Major
Found in scrapenhl2/plot/game_timeline.py and 1 other location - About 2 hrs to fix
scrapenhl2/plot/game_h2h.py on lines 14..30

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

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 add_onice_players_to_df has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def add_onice_players_to_df(df, focus_team, season, gamecol, player_output='ids'):
    """
    Uses the _Secs column in df, the season, and the gamecol to join onto on-ice players.

    :param df: dataframe
Severity: Minor
Found in scrapenhl2/manipulate/add_onice_players.py - About 2 hrs 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 _create_pbp_df_json has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def _create_pbp_df_json(pbp, gameinfo):
    """
    Creates a pandas dataframe from the pbp, making use of gameinfo (from schedule file) as well

    :param pbp: dict, from pbp json
Severity: Minor
Found in scrapenhl2/scrape/parse_pbp.py - About 2 hrs 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

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

def live_h2h(team1, team2, update=True, save_file=None):
    """
    A convenience method that updates data then displays h2h for most recent game between specified tams.

    :param team1: str or int, team
Severity: Major
Found in scrapenhl2/plot/game_h2h.py and 1 other location - About 2 hrs to fix
scrapenhl2/plot/game_timeline.py on lines 13..29

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

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 game_h2h.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
This module contains methods for creating a game H2H chart.
"""

import matplotlib.pyplot as plt
Severity: Minor
Found in scrapenhl2/plot/game_h2h.py - About 2 hrs to fix

    File game_timeline.py has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    This module has methods for creating a game corsi timeline.
    """
    
    import matplotlib.pyplot as plt
    Severity: Minor
    Found in scrapenhl2/plot/game_timeline.py - About 2 hrs to fix

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

      var Scorer = {
        // Implement the following function to further tweak the score for each result
        // The function takes a result array [filename, title, anchor, descr, score]
        // and returns the new score.
        /*
      Severity: Major
      Found in docs/build/html/_static/searchtools.js and 1 other location - About 2 hrs to fix
      docs/build/_static/searchtools.js on lines 201..226

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

      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

      var Scorer = {
        // Implement the following function to further tweak the score for each result
        // The function takes a result array [filename, title, anchor, descr, score]
        // and returns the new score.
        /*
      Severity: Major
      Found in docs/build/_static/searchtools.js and 1 other location - About 2 hrs to fix
      docs/build/html/_static/searchtools.js on lines 201..226

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

      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 gamebot.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from twython import Twython
      from twython import TwythonStreamer
      import re
      import time
      import os
      Severity: Minor
      Found in scrapenhl2/twitterbot/gamebot.py - About 2 hrs to fix

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

            df.loc[:, metrics['FOFF']] = df[metrics['TeamF']] - df[metrics['FON']]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 2 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1112..1112

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

        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

            road = helpers.melt_helper(fives[['Time', 'R1', 'R2', 'R3', 'R4', 'R5']],
        Severity: Major
        Found in scrapenhl2/scrape/parse_toi.py and 1 other location - About 2 hrs to fix
        scrapenhl2/scrape/parse_toi.py on lines 547..547

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

        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

            home = helpers.melt_helper(fives[['Time', 'H1', 'H2', 'H3', 'H4', 'H5']],
        Severity: Major
        Found in scrapenhl2/scrape/parse_toi.py and 1 other location - About 2 hrs to fix
        scrapenhl2/scrape/parse_toi.py on lines 551..551

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

        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

            df.loc[:, metrics['AOFF']] = df[metrics['TeamA']] - df[metrics['AON']]
        Severity: Major
        Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 2 hrs to fix
        scrapenhl2/manipulate/manipulate.py on lines 1111..1111

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

        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 eq has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function eq(a, b, stack) {
            // Identical objects are equal. `0 === -0`, but they aren't identical.
            // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
            if (a === b) return a !== 0 || 1 / a == 1 / b;
            // A strict comparison is necessary because `null == undefined`.
        Severity: Major
        Found in docs/build/html/_static/underscore-1.3.1.js - About 2 hrs to fix

          Function init has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              init = jQuery.fn.init = function( selector, context, root ) {
                  var match, elem;
          
                  // HANDLE: $(""), $(null), $(undefined), $(false)
                  if ( !selector ) {
          Severity: Major
          Found in docs/build/html/_static/jquery-3.1.0.js - About 2 hrs to fix

            Function displayNextItem has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function displayNextItem() {
                  // results left, load the summary and display it
                  if (results.length) {
                    var item = results.pop();
                    var listItem = $('<li style="display:none"></li>');
            Severity: Major
            Found in docs/build/html/_static/searchtools.js - About 2 hrs to fix

              Function eq has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function eq(a, b, stack) {
                  // Identical objects are equal. `0 === -0`, but they aren't identical.
                  // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
                  if (a === b) return a !== 0 || 1 / a == 1 / b;
                  // A strict comparison is necessary because `null == undefined`.
              Severity: Major
              Found in docs/build/_static/underscore-1.3.1.js - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language