Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Sourcery refactored master branch #60

Merged
merged 1 commit into from
Aug 31, 2022
Merged

Sourcery refactored master branch #60

merged 1 commit into from
Aug 31, 2022

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Aug 31, 2022

Branch master refactored by Sourcery.

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

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 master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

match = next(
if match := next(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BassBoostConverter.convert refactored with the following changes:

Comment on lines -171 to -174
player = self.cog.lavalink.get_player(self.guild_id)
if not player:
if player := self.cog.lavalink.get_player(self.guild_id):
return player.history.raw_queue if self.history else player.queue.raw_queue
else:
return []
return player.history.raw_queue if self.history else player.queue.raw_queue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function QueueSource.entries refactored with the following changes:

Comment on lines -199 to -220
player = self.cog.lavalink.get_player(menu.ctx.guild.id)
if not player:
if player := self.cog.lavalink.get_player(menu.ctx.guild.id):
return (
await player.get_queue_page(
page_index=menu.current_page,
per_page=self.per_page,
total_pages=self.get_max_pages(),
embed=True,
messageable=menu.ctx,
history=self.history,
)
if player.current and (player.history.size() if self.history else True)
else await self.cog.lavalink.construct_embed(
description="There's nothing in recently played."
if self.history
else "There's nothing currently being played.",
messageable=menu.ctx,
)
)
else:
return await self.cog.lavalink.construct_embed(
description="No active player found in server.", messageable=menu.ctx
)
return (
await player.get_queue_page(
page_index=menu.current_page,
per_page=self.per_page,
total_pages=self.get_max_pages(),
embed=True,
messageable=menu.ctx,
history=self.history,
)
if player.current and (player.history.size() if self.history else True)
else await self.cog.lavalink.construct_embed(
description="There's nothing in recently played."
if self.history
else "There's nothing currently being played.",
messageable=menu.ctx,
)
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function QueueSource.format_page refactored with the following changes:

Comment on lines -245 to -263
player = self.cog.lavalink.get_player(menu.ctx.guild.id)
if not player:
if player := self.cog.lavalink.get_player(menu.ctx.guild.id):
return (
await player.get_queue_page(
page_index=menu.current_page,
per_page=self.per_page,
total_pages=self.get_max_pages(),
embed=True,
messageable=menu.ctx,
)
if player.current
else await self.cog.lavalink.construct_embed(
description="There's nothing currently being played.",
messageable=menu.ctx,
)
)
else:
return await self.cog.lavalink.construct_embed(
description="No active player found in server.", messageable=menu.ctx
)
return (
await player.get_queue_page(
page_index=menu.current_page,
per_page=self.per_page,
total_pages=self.get_max_pages(),
embed=True,
messageable=menu.ctx,
)
if player.current
else await self.cog.lavalink.construct_embed(
description="There's nothing currently being played.",
messageable=menu.ctx,
)
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function QueuePickerSource.format_page refactored with the following changes:

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Aug 31, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.65 ⭐ 2.95 ⭐ 0.30 👎
Method Length 63.75 🙂 63.42 🙂 -0.33 👍
Working memory 6.43 🙂 6.53 🙂 0.10 👎
Quality 77.64% 77.21% -0.43% 👎
Other metrics Before After Change
Lines 301 301 0
Changed files Quality Before Quality After Quality Change
pylavcogs_shared/converters/equalizer.py 81.97% ⭐ 81.85% ⭐ -0.12% 👎
pylavcogs_shared/ui/sources/queue.py 77.03% ⭐ 76.58% ⭐ -0.45% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
pylavcogs_shared/ui/sources/queue.py EffectsPickerSource.get_page 10 🙂 293 ⛔ 12 😞 40.11% 😞 Try splitting into smaller methods. Extract out complex expressions
pylavcogs_shared/ui/sources/queue.py QueueSource.format_page 11 🙂 120 😞 11 😞 53.87% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

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!

@Drapersniper Drapersniper merged commit a421879 into master Aug 31, 2022
@Drapersniper Drapersniper deleted the sourcery/master branch August 31, 2022 11:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant