mirror of
https://github.com/evroon/bracket.git
synced 2026-04-19 14:57:06 -04:00
Add vulture check (#296)
This commit is contained in:
4
.github/workflows/backend.yml
vendored
4
.github/workflows/backend.yml
vendored
@@ -57,3 +57,7 @@ jobs:
|
||||
- name: Run ruff
|
||||
run: pipenv run ruff check .
|
||||
working-directory: backend
|
||||
|
||||
- name: Run vulture
|
||||
run: ! pipenv run vulture |grep "unused function\|unused class\|unused method"
|
||||
working-directory: backend
|
||||
|
||||
@@ -39,6 +39,7 @@ pytest-asyncio = ">=0.20.3"
|
||||
pytest-cov = ">=4.0.0"
|
||||
pytest-xdist = ">=3.2.1"
|
||||
ruff = ">=0.0.292"
|
||||
vulture = ">=2.10"
|
||||
|
||||
[requires]
|
||||
python_version = "3.10"
|
||||
|
||||
@@ -14,14 +14,6 @@ class Environment(EnumAutoStr):
|
||||
DEMO = auto()
|
||||
CI = auto()
|
||||
|
||||
def get_env_filepath(self) -> str:
|
||||
return {
|
||||
Environment.PRODUCTION: 'prod.env',
|
||||
Environment.DEVELOPMENT: 'dev.env',
|
||||
Environment.CI: 'ci.env',
|
||||
Environment.DEMO: 'demo.env',
|
||||
}[self]
|
||||
|
||||
def get_log_level(self) -> int:
|
||||
return {
|
||||
Environment.CI: logging.WARNING,
|
||||
|
||||
@@ -6,7 +6,7 @@ from bracket.sql.rounds import get_rounds_for_stage
|
||||
from bracket.sql.teams import get_teams_with_members
|
||||
|
||||
|
||||
async def get_possible_upcoming_matches_for_teams(
|
||||
async def todo_get_possible_upcoming_matches_for_teams(
|
||||
tournament_id: int, stage_id: int, filter_: MatchFilter
|
||||
) -> list[SuggestedMatch]:
|
||||
suggestions: list[SuggestedMatch] = []
|
||||
|
||||
@@ -10,10 +10,6 @@ class Court(BaseModelORM):
|
||||
tournament_id: int
|
||||
|
||||
|
||||
class CourtInDB(Court):
|
||||
id: int
|
||||
|
||||
|
||||
class CourtBody(BaseModelORM):
|
||||
name: str
|
||||
|
||||
|
||||
@@ -20,11 +20,6 @@ class Match(BaseModelORM):
|
||||
court_id: int | None
|
||||
|
||||
|
||||
class UpcomingMatch(BaseModel):
|
||||
team1_id: int
|
||||
team2_id: int
|
||||
|
||||
|
||||
class MatchWithDetails(Match):
|
||||
team1: FullTeamWithPlayers
|
||||
team2: FullTeamWithPlayers
|
||||
@@ -57,12 +52,6 @@ class MatchCreateBody(BaseModelORM):
|
||||
court_id: int | None
|
||||
|
||||
|
||||
class MatchToInsert(MatchCreateBody):
|
||||
created: datetime_utc
|
||||
team1_score: int = 0
|
||||
team2_score: int = 0
|
||||
|
||||
|
||||
class MatchFilter(BaseModel):
|
||||
elo_diff_threshold: int
|
||||
only_behind_schedule: bool
|
||||
|
||||
@@ -21,10 +21,6 @@ class Player(BaseModelORM):
|
||||
return self.id if self.id is not None else int(self.created.timestamp())
|
||||
|
||||
|
||||
class PlayerInDB(Player):
|
||||
id: int
|
||||
|
||||
|
||||
class PlayerBody(BaseModelORM):
|
||||
name: str
|
||||
active: bool
|
||||
|
||||
@@ -33,10 +33,3 @@ class StageActivateBody(BaseModelORM):
|
||||
|
||||
class StageCreateBody(BaseModelORM):
|
||||
type: StageType
|
||||
|
||||
|
||||
class StageToInsert(BaseModelORM):
|
||||
created: datetime_utc
|
||||
tournament_id: int
|
||||
type: StageType
|
||||
is_active: bool = False
|
||||
|
||||
@@ -48,10 +48,6 @@ class SinglePlayerResponse(DataResponse[Player]):
|
||||
pass
|
||||
|
||||
|
||||
class RoundsResponse(DataResponse[list[Round]]):
|
||||
pass
|
||||
|
||||
|
||||
class RoundsWithMatchesResponse(DataResponse[list[StageWithRounds]]):
|
||||
pass
|
||||
|
||||
@@ -64,10 +60,6 @@ class SingleMatchResponse(DataResponse[Match]):
|
||||
pass
|
||||
|
||||
|
||||
class TeamsResponse(DataResponse[list[Team]]):
|
||||
pass
|
||||
|
||||
|
||||
class TeamsWithPlayersResponse(DataResponse[list[FullTeamWithPlayers]]):
|
||||
pass
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ async def sql_delete_club(club_id: int) -> None:
|
||||
await database.execute(query=query, values={'club_id': club_id})
|
||||
|
||||
|
||||
async def sql_remove_user_from_club(club_id: int, user_id: int) -> None:
|
||||
async def todo_sql_remove_user_from_club(club_id: int, user_id: int) -> None:
|
||||
query = '''
|
||||
DELETE FROM users_x_clubs
|
||||
WHERE club_id = :club_id
|
||||
@@ -66,7 +66,7 @@ async def get_clubs_for_user_id(user_id: int) -> list[Club]:
|
||||
return [Club.parse_obj(result._mapping) for result in results]
|
||||
|
||||
|
||||
async def get_club_for_user_id(club_id: int, user_id: int) -> Club | None:
|
||||
async def todo_get_club_for_user_id(club_id: int, user_id: int) -> Club | None:
|
||||
query = '''
|
||||
SELECT clubs.* FROM clubs
|
||||
JOIN users_x_clubs uxc on clubs.id = uxc.club_id
|
||||
|
||||
@@ -115,4 +115,17 @@ respect-gitignore = false
|
||||
show-fixes = true
|
||||
show-source = true
|
||||
target-version = "py311"
|
||||
exclude = [".mypy_cache", ".pytest_cache", "__pycache__"]
|
||||
exclude = [".mypy_cache", ".pytest_cache", "__pycache__"]
|
||||
|
||||
[tool.vulture]
|
||||
min_confidence = 0
|
||||
paths = ["."]
|
||||
ignore_decorators = ["@pytest.*", "@*router*", "@app.*", "@*validator*"]
|
||||
ignore_names = [
|
||||
"todo*",
|
||||
"RestartableUvicornWorker",
|
||||
"_generate_next_value_",
|
||||
"downgrade",
|
||||
"upgrade"
|
||||
]
|
||||
sort_by_size = true
|
||||
|
||||
Reference in New Issue
Block a user