a-luna / vigorish

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

v0.7.0 (Sourcery refactored) #876

Closed sourcery-ai[bot] closed 2 years ago

sourcery-ai[bot] commented 2 years ago

Pull Request #875 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will re-run and update (force-push) this Pull Request with new refactorings as necessary. If Sourcery finds no refactorings at any point, this Pull Request will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the minor-release/v0.7.0 branch, then run:

git fetch origin sourcery/minor-release/v0.7.0
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

sourcery-ai[bot] commented 2 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.06%.

Quality metrics Before After Change
Complexity 5.82 ⭐ 5.80 ⭐ -0.02 👍
Method Length 42.10 ⭐ 42.01 ⭐ -0.09 👍
Working memory 8.47 🙂 8.50 🙂 0.03 👎
Quality 71.03% 🙂 70.97% 🙂 -0.06% 👎
Other metrics Before After Change
Lines 6933 6983 50
Changed files Quality Before Quality After Quality Change
src/vigorish/app.py 89.14% ⭐ 89.14% ⭐ 0.00%
src/vigorish/enums.py 92.99% ⭐ 95.04% ⭐ 2.05% 👍
src/vigorish/cli/vig.py 63.06% 🙂 62.92% 🙂 -0.14% 👎
src/vigorish/cli/components/prompts.py 59.78% 🙂 59.53% 🙂 -0.25% 👎
src/vigorish/cli/components/viewers/page_viewer.py 79.81% ⭐ 79.85% ⭐ 0.04% 👍
src/vigorish/cli/menu_items/admin_tasks/update_player_id_map.py 75.17% ⭐ 74.45% 🙂 -0.72% 👎
src/vigorish/data/game_data.py 73.95% 🙂 73.98% 🙂 0.03% 👍
src/vigorish/data/scraped_data.py 87.93% ⭐ 87.94% ⭐ 0.01% 👍
src/vigorish/data/metrics/pitch_stats/pitch_stats_metrics.py 88.32% ⭐ 88.54% ⭐ 0.22% 👍
src/vigorish/data/metrics/pitchfx/pitchfx_metrics.py 89.19% ⭐ 89.20% ⭐ 0.01% 👍
src/vigorish/models/season.py 85.21% ⭐ 85.33% ⭐ 0.12% 👍
src/vigorish/models/status_date.py 88.25% ⭐ 88.25% ⭐ 0.00%
src/vigorish/patch/base.py 94.69% ⭐ 94.78% ⭐ 0.09% 👍
src/vigorish/scrape/bbref_boxscores/parse_html.py 51.79% 🙂 51.67% 🙂 -0.12% 👎
src/vigorish/scrape/bbref_games_for_date/scrape_task.py 89.83% ⭐ 89.87% ⭐ 0.04% 👍
src/vigorish/tasks/calculate_avg_pitch_times.py 58.92% 🙂 58.94% 🙂 0.02% 👍
src/vigorish/tasks/combine_scraped_data.py 63.68% 🙂 63.64% 🙂 -0.04% 👎
src/vigorish/util/dataclass_helpers.py 76.80% ⭐ 76.82% ⭐ 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/scrape/bbref_boxscores/parse_html.py _parse_substitution_description 50 ⛔ 762 ⛔ 14 😞 12.98% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
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/scrape/bbref_boxscores/parse_html.py _create_innings_list 22 😞 341 ⛔ 18 ⛔ 21.95% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/vigorish/scrape/bbref_boxscores/parse_html.py _parse_game_meta_info 12 🙂 324 ⛔ 19 ⛔ 29.38% 😞 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!