muneebalam/scrapenhl2

View on GitHub

Showing 724 of 747 total issues

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

def get_toicomp_file(season, force_create=False):
    """
    If you want to rewrite the TOI60 file, too, then run get_player_toion_toioff_file with force_create=True before
    running this method.
    :param season: int, the season
Severity: Major
Found in scrapenhl2/manipulate/manipulate.py and 2 other locations - About 4 hrs to fix
scrapenhl2/manipulate/manipulate.py on lines 31..44
scrapenhl2/manipulate/manipulate.py on lines 514..527

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

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 scrape_game_pbp_from_html(season, game, force_overwrite=True):
    """
    This method scrapes the html pbp for the given game. Use for live games.

    :param season: int, the season
Severity: Major
Found in scrapenhl2/scrape/scrape_pbp.py and 1 other location - About 4 hrs to fix
scrapenhl2/scrape/scrape_pbp.py on lines 39..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 76.

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 scrape_game_pbp(season, game, force_overwrite=False):
    """
    This method scrapes the pbp for the given game.

    :param season: int, the season
Severity: Major
Found in scrapenhl2/scrape/scrape_pbp.py and 1 other location - About 4 hrs to fix
scrapenhl2/scrape/scrape_pbp.py on lines 14..36

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

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

    if len(homegoals) > 0:  # errors if len is 0
        homegoals.loc[:, 'HomeScore'] = 1
        homegoals.loc[:, 'HomeScore'] = homegoals.HomeScore.cumsum()
        pbpdf = pbpdf.merge(homegoals, how='left', on=['Event', 'Period', 'MinSec', 'Team'])
Severity: Major
Found in scrapenhl2/scrape/parse_pbp.py and 1 other location - About 4 hrs to fix
scrapenhl2/scrape/parse_pbp.py on lines 169..172

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

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

    if len(roadgoals) > 0:
        roadgoals.loc[:, 'RoadScore'] = 1
        roadgoals.loc[:, 'RoadScore'] = roadgoals.RoadScore.cumsum()
        pbpdf = pbpdf.merge(roadgoals, how='left', on=['Event', 'Period', 'MinSec', 'Team'])
Severity: Major
Found in scrapenhl2/scrape/parse_pbp.py and 1 other location - About 4 hrs to fix
scrapenhl2/scrape/parse_pbp.py on lines 164..167

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

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

                then: function( onFulfilled, onRejected, onProgress ) {
                    var maxDepth = 0;
                    function resolve( depth, deferred, handler, special ) {
                        return function() {
                            var that = this,
Severity: Major
Found in docs/build/html/_static/jquery-3.1.0.js - About 4 hrs to fix

    Function then has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    then: function( onFulfilled, onRejected, onProgress ) {
                        var maxDepth = 0;
                        function resolve( depth, deferred, handler, special ) {
                            return function() {
                                var that = this,
    Severity: Major
    Found in docs/build/_static/jquery-3.1.0.js - About 4 hrs to fix

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

          playersonice = helpers.melt_helper(fives[cols_to_keep],
                                             id_vars='Time', var_name='P', value_name='PlayerID') \
              .drop('P', axis=1) \
              .merge(pos, how='left', left_on='PlayerID', right_on='ID') \
              .query('Pos != "D"') \
      Severity: Major
      Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 3 hrs to fix
      scrapenhl2/manipulate/manipulate.py on lines 1291..1296

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

      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

          playersonice = helpers.melt_helper(fives[cols_to_keep],
                                             id_vars='Time', var_name='P', value_name='PlayerID') \
              .drop('P', axis=1) \
              .merge(pos, how='left', left_on='PlayerID', right_on='ID') \
              .query('Pos == "D"') \
      Severity: Major
      Found in scrapenhl2/manipulate/manipulate.py and 1 other location - About 3 hrs to fix
      scrapenhl2/manipulate/manipulate.py on lines 1260..1265

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

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

      function Animation( elem, properties, options ) {
          var result,
              stopped,
              index = 0,
              length = Animation.prefilters.length,
      Severity: Major
      Found in docs/build/html/_static/jquery-3.1.0.js - About 3 hrs to fix

        Function Animation has 92 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Animation( elem, properties, options ) {
            var result,
                stopped,
                index = 0,
                length = Animation.prefilters.length,
        Severity: Major
        Found in docs/build/_static/jquery-3.1.0.js - About 3 hrs to fix

          Function _finish_toidf_manipulations has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          def _finish_toidf_manipulations(df, season, game):
              """
              Takes dataframe of shifts (one row per shift) and makes into a matrix of players on ice for each second.
          
              :param df: dataframe
          Severity: Minor
          Found in scrapenhl2/scrape/parse_toi.py - About 3 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 game_timeline has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          def game_timeline(season, game, save_file=None):
              """
              Creates a shot attempt timeline as seen on @muneebalamcu
          
              :param season: int, the season
          Severity: Minor
          Found in scrapenhl2/plot/game_timeline.py - About 3 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 trigger has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              trigger: function( event, data, elem, onlyHandlers ) {
          
                  var i, cur, tmp, bubbleType, ontype, handle, special,
                      eventPath = [ elem || document ],
                      type = hasOwn.call( event, "type" ) ? event.type : event,
          Severity: Major
          Found in docs/build/html/_static/jquery-3.1.0.js - About 3 hrs to fix

            Function trigger has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                trigger: function( event, data, elem, onlyHandlers ) {
            
                    var i, cur, tmp, bubbleType, ontype, handle, special,
                        eventPath = [ elem || document ],
                        type = hasOwn.call( event, "type" ) ? event.type : event,
            Severity: Major
            Found in docs/build/_static/jquery-3.1.0.js - About 3 hrs to fix

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

                               '{0:s} {1:d} at {2:s} {3:d}{4:s} ({5:s})'.format(
                                   team_info.team_as_str(schedules.get_road_team(season, game), abbreviation=False),
                                   schedules.get_road_score(season, game),
                                   team_info.team_as_str(schedules.get_home_team(season, game), abbreviation=False),
                                   schedules.get_home_score(season, game),
              Severity: Major
              Found in scrapenhl2/plot/game_timeline.py and 1 other location - About 3 hrs to fix
              scrapenhl2/plot/game_h2h.py on lines 256..261

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

              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

                  titletext.append('{0:s} {1:d} at {2:s} {3:d}{4:s} ({5:s})'.format(
                      team_info.team_as_str(schedules.get_road_team(season, game), abbreviation=False),
                      schedules.get_road_score(season, game),
                      team_info.team_as_str(schedules.get_home_team(season, game), abbreviation=False),
                      schedules.get_home_score(season, game),
              Severity: Major
              Found in scrapenhl2/plot/game_h2h.py and 1 other location - About 3 hrs to fix
              scrapenhl2/plot/game_timeline.py on lines 206..211

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

              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

                  starttimes = [1200 * (p - 1) + 60 * int(m) + int(s) + 1 for p, m, s in zip(periods, startmin, startsec)]
              Severity: Major
              Found in scrapenhl2/scrape/parse_toi.py and 1 other location - About 3 hrs to fix
              scrapenhl2/scrape/parse_toi.py on lines 208..208

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

              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

                      starttimes = [1200 * (p - 1) + 60 * int(m) + int(s) + 1 for p, m, s in zip(periods, startmin, startsec)]
              Severity: Major
              Found in scrapenhl2/scrape/parse_toi.py and 1 other location - About 3 hrs to fix
              scrapenhl2/scrape/parse_toi.py on lines 264..264

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

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

              """
              This module contains general helper methods. None of these methods have dependencies on other scrapenhl2 modules.
              """
              
              import functools
              Severity: Minor
              Found in scrapenhl2/scrape/general_helpers.py - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language