a-luna / vigorish

MLB data web scraper, Python CLI application
https://aaronluna.dev/projects/vigorish
MIT License
2 stars 2 forks source link

update type hints to new format (project-wide) #863

Closed a-luna closed 2 years ago

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.02%.

Quality metrics Before After Change
Complexity 3.18 ⭐ 3.07 ⭐ -0.11 👍
Method Length 34.78 ⭐ 34.69 ⭐ -0.09 👍
Working memory 7.40 🙂 7.42 🙂 0.02 👎
Quality 78.31% 78.33% 0.02% 👍
Other metrics Before After Change
Lines 9034 9012 -22
Changed files Quality Before Quality After Quality Change
src/vigorish/app.py 88.79% ⭐ 88.79% ⭐ 0.00%
src/vigorish/enums.py 93.59% ⭐ 93.59% ⭐ 0.00%
src/vigorish/types.py 92.54% ⭐ 88.17% ⭐ -4.37% 👎
src/vigorish/cli/vig.py 62.36% 🙂 63.06% 🙂 0.70% 👍
src/vigorish/cli/components/prompts.py 59.78% 🙂 59.78% 🙂 0.00%
src/vigorish/cli/components/viewers/page_viewer.py 79.76% ⭐ 79.81% ⭐ 0.05% 👍
src/vigorish/cli/components/viewers/table_viewer.py 74.72% 🙂 74.76% 🙂 0.04% 👍
src/vigorish/config/config_setting.py 87.19% ⭐ 86.91% ⭐ -0.28% 👎
src/vigorish/data/game_data.py 73.98% 🙂 73.95% 🙂 -0.03% 👎
src/vigorish/data/player_data.py 92.09% ⭐ 92.12% ⭐ 0.03% 👍
src/vigorish/data/scraped_data.py 87.90% ⭐ 87.93% ⭐ 0.03% 👍
src/vigorish/data/team_data.py 96.97% ⭐ 96.97% ⭐ 0.00%
src/vigorish/data/metrics/bat_stats/bat_stats_metrics.py 85.04% ⭐ 85.04% ⭐ 0.00%
src/vigorish/data/metrics/bat_stats/bat_stats_metrics_factory.py 88.06% ⭐ 88.06% ⭐ 0.00%
src/vigorish/data/metrics/bat_stats/player_bat_stat_metrics.py 83.92% ⭐ 83.92% ⭐ 0.00%
src/vigorish/data/metrics/bat_stats/team_bat_stat_metrics.py 76.41% ⭐ 76.41% ⭐ 0.00%
src/vigorish/data/metrics/pitch_stats/pitch_stats_metrics.py 88.32% ⭐ 88.32% ⭐ 0.00%
src/vigorish/data/metrics/pitch_stats/pitch_stats_metrics_factory.py 89.23% ⭐ 89.23% ⭐ 0.00%
src/vigorish/data/metrics/pitch_stats/player_pitch_stat_metrics.py 82.90% ⭐ 82.90% ⭐ 0.00%
src/vigorish/data/metrics/pitch_stats/team_pitch_stat_metrics.py 82.98% ⭐ 82.98% ⭐ 0.00%
src/vigorish/data/metrics/pitchfx/pitchfx_batting_metrics.py 50.61% 🙂 50.61% 🙂 0.00%
src/vigorish/data/metrics/pitchfx/pitchfx_metrics.py 89.18% ⭐ 89.19% ⭐ 0.01% 👍
src/vigorish/data/metrics/pitchfx/pitchfx_metrics_factory.py 73.92% 🙂 73.49% 🙂 -0.43% 👎
src/vigorish/data/metrics/pitchfx/pitchfx_metrics_set.py 81.69% ⭐ 81.79% ⭐ 0.10% 👍
src/vigorish/data/metrics/pitchfx/pitchfx_pitching_metrics.py 75.10% ⭐ 75.10% ⭐ 0.00%
src/vigorish/models/season.py 85.45% ⭐ 85.17% ⭐ -0.28% 👎
src/vigorish/models/status_date.py 88.24% ⭐ 88.25% ⭐ 0.01% 👍
src/vigorish/patch/base.py 94.69% ⭐ 94.69% ⭐ 0.00%
src/vigorish/patch/brooks_pitchfx.py 76.01% ⭐ 76.01% ⭐ 0.00%
src/vigorish/scrape/url_details.py 95.43% ⭐ 95.43% ⭐ 0.00%
src/vigorish/scrape/bbref_boxscores/models/bat_stats.py 84.47% ⭐ 84.47% ⭐ 0.00%
src/vigorish/scrape/bbref_boxscores/models/boxscore.py 90.71% ⭐ 90.71% ⭐ 0.00%
src/vigorish/scrape/bbref_boxscores/models/boxscore_team_data.py 94.50% ⭐ 94.50% ⭐ 0.00%
src/vigorish/scrape/bbref_boxscores/models/half_inning.py 90.90% ⭐ 90.90% ⭐ 0.00%
src/vigorish/scrape/bbref_games_for_date/models/games_for_date.py 96.14% ⭐ 96.14% ⭐ 0.00%
src/vigorish/scrape/brooks_games_for_date/models/game_info.py 94.61% ⭐ 94.61% ⭐ 0.00%
src/vigorish/scrape/brooks_games_for_date/models/games_for_date.py 96.71% ⭐ 96.71% ⭐ 0.00%
src/vigorish/scrape/brooks_pitch_logs/models/pitch_log.py 86.11% ⭐ 86.11% ⭐ 0.00%
src/vigorish/scrape/brooks_pitch_logs/models/pitch_logs_for_game.py 95.26% ⭐ 95.26% ⭐ 0.00%
src/vigorish/scrape/brooks_pitchfx/models/pitchfx_log.py 88.52% ⭐ 88.52% ⭐ 0.00%
src/vigorish/tasks/calculate_avg_pitch_times.py 54.06% 🙂 58.92% 🙂 4.86% 👍
src/vigorish/tasks/combine_scraped_data.py 63.68% 🙂 63.68% 🙂 0.00%
src/vigorish/util/dataclass_helpers.py 76.80% ⭐ 76.80% ⭐ 0.00%
src/vigorish/util/list_helpers.py 72.17% 🙂 72.17% 🙂 0.00%
src/vigorish/util/result.py 88.73% ⭐ 88.83% ⭐ 0.10% 👍
src/vigorish/util/sys_helpers.py 77.24% ⭐ 77.26% ⭐ 0.02% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
src/vigorish/tasks/combine_scraped_data.py CombineScrapedDataTask.combine_pbp_events_with_pfx_data 24 😞 394 ⛔ 24 ⛔ 16.41% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/vigorish/tasks/combine_scraped_data.py CombineScrapedDataTask.describe_at_bat 33 ⛔ 259 ⛔ 19 ⛔ 17.98% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/vigorish/models/status_date.py DateScrapeStatus.scrape_status_description 36 ⛔ 55 ⭐ 25 ⛔ 34.77% 😞 Refactor to reduce nesting. Extract out complex expressions
src/vigorish/tasks/calculate_avg_pitch_times.py CalculateAvgPitchTimesTask.calc_pitch_metrics_for_at_bat 21 😞 135 😞 15 😞 38.10% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/vigorish/tasks/combine_scraped_data.py CombineScrapedDataTask.save_invalid_pitchfx 10 🙂 204 😞 17 ⛔ 38.41% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!