djbrown/hbscorez

View on GitHub

Showing 105 of 113 total issues

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

Severity: Major
Found in src/leagues/urls.py and 1 other location - About 5 hrs to fix
src/teams/urls.py on lines 0..16

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

Severity: Major
Found in src/teams/urls.py and 1 other location - About 5 hrs to fix
src/leagues/urls.py on lines 0..17

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

$leagues.change((e) => {
const leagueId = e.target.value;
clearTeams();
$.get(`/api/leagues/${leagueId}/teams/`, (response) => {
response.teams.sort((a, b) => a.name.localeCompare(b.name)).forEach((team) => {
Severity: Major
Found in src/users/static/users/scripts/link.js and 1 other location - About 5 hrs to fix
src/users/static/users/scripts/link.js on lines 22..30

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

$associations.change((e) => {
const associationId = e.target.value;
clearDistricts();
$.get(`/api/associations/${associationId}/districts/`, (response) => {
response.districts.sort((a, b) => a.name.localeCompare(b.name)).forEach((district) => {
Severity: Major
Found in src/users/static/users/scripts/link.js and 1 other location - About 5 hrs to fix
src/users/static/users/scripts/link.js on lines 52..60

Cyclomatic complexity is too high in function scrape_league. (17)
Open

@transaction.atomic
def scrape_league(league_link, district, season, options): # pylint: disable=too-many-branches
abbreviation = league_link.text
bhv_id = parsing.parse_league_bhv_id(league_link)
 
 

Cyclomatic complexity is too high in function import_score. (13)
Open

def import_score(table_row, game: Game, team: Team):
row_data = [cell["text"] for cell in table_row]
 
player_number: str = row_data[0]
player_name: str = row_data[1].split("(", 1)[0].strip()

Cyclomatic complexity is too high in method import_game. (11)
Open

def import_game(self, game: Game):
if self.options["games"] and game.number not in self.options["games"]:
LOGGER.debug("SKIPPING Game (options): %s - %s", game.report_number, game)
return
 
 

Cyclomatic complexity is too high in method leg. (11)
Open

def leg(self) -> Leg:
other_games = self.other_games()
if (
not other_games
or len(other_games) > 2
Severity: Minor
Found in src/games/models.py by radon

Cyclomatic complexity is too high in method is_youth. (11)
Open

@staticmethod
def is_youth(abbreviation: str, name: str) -> bool:
youth_name_indicators_direct = [
"Jugend",
"Jgd",
Severity: Minor
Found in src/leagues/models.py by radon

Cyclomatic complexity is too high in method outcome_for. (11)
Open

def outcome_for(self, team) -> TeamOutcome:
if self.outcome() == GameOutcome.OPEN:
return TeamOutcome.OPEN
if self.outcome() == GameOutcome.TIE:
return TeamOutcome.TIE
Severity: Minor
Found in src/games/models.py by radon

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

Severity: Major
Found in src/districts/admin.py and 1 other location - About 2 hrs to fix
src/clubs/admin.py on lines 0..11

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

Severity: Major
Found in src/clubs/admin.py and 1 other location - About 2 hrs to fix
src/districts/admin.py on lines 0..11

Cyclomatic complexity is too high in function scrape_game. (10)
Open

def scrape_game(
game_row,
league: League,
whitelist: list[int] | None = None,
processed_sports_halls: set[int] | None = None,
Severity: Minor
Found in src/base/logic.py by radon

Cyclomatic complexity is too high in function import_leagues. (9)
Open

def import_leagues(options):
associations_filters = {}
if options["associations"]:
associations_filters["bhv_id__in"] = options["associations"]
associations = Association.objects.filter(**associations_filters)

Cyclomatic complexity is too high in function scrape_district. (8)
Open

def scrape_district(bhv_id, name, association: Association, options):
if options["districts"] and bhv_id not in options["districts"]:
LOGGER.debug("SKIPPING District (options): %s %s", bhv_id, name)
return
 
 

Cyclomatic complexity is too high in function _create_event. (8)
Open

def _create_event(team: Team, game: Game) -> Result[Event, ErrCode]:
if not game.opening_whistle:
return Result.from_failure(ErrCode.MISSING_OPENING_WHISTLE)
 
venue = "Heimspiel" if game.home_team == team else "Auswärtsspiel"
Severity: Minor
Found in src/teams/views.py by radon

Cyclomatic complexity is too high in method outcome. (8)
Open

def outcome(self) -> GameOutcome:
if self.home_goals is None and self.guest_goals is None:
return GameOutcome.OPEN
home_goals: int = Maybe.from_optional(self.home_goals).unwrap()
guest_goals: int = Maybe.from_optional(self.guest_goals).unwrap()
Severity: Minor
Found in src/games/models.py by radon

Cyclomatic complexity is too high in function scrape_association. (8)
Open

def scrape_association(url: str, options):
html = http.get_text(url)
dom = parsing.html_dom(html)
 
name = parsing.parse_association_name(dom)

File logic.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import collections
import logging
import operator
from typing import Any
 
 
Severity: Minor
Found in src/base/logic.py - About 2 hrs to fix

    Cyclomatic complexity is too high in method import_league. (7)
    Open

    def import_league(self, league):
    if self.options["leagues"] and league.bhv_id not in self.options["leagues"]:
    LOGGER.debug("SKIPPING League: %s (options)", league)
    return
     
     
    Severity
    Category
    Status
    Source
    Language