Skip to content

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Mar 13, 2023

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

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from sturdy-robot March 13, 2023 12:00
Comment on lines -38 to +55

window.fill('white')

for joystick in joysticks:
controller = Controller.from_joystick(joystick)
js = [joystick.get_guid(), joystick.get_name()]
for button in range(joystick.get_numbuttons()):
btn_message = 'Button ' + str(button) + ': ' + str(controller.get_button(button))
btn_message = f'Button {str(button)}: {str(controller.get_button(button))}'
js.append(btn_message)
for axis in range(joystick.get_numaxes()):
axis_message = 'Axis ' + str(axis) + ': ' + str(controller.get_axis(axis))
axis_message = f'Axis {str(axis)}: {str(controller.get_axis(axis))}'
js.append(axis_message)
for hat in range(joystick.get_numhats()):
hat_message = 'Hat ' + str(hat) + ': ' + str(joystick.get_hat(hat))
hat_message = f'Hat {str(hat)}: {str(joystick.get_hat(hat))}'
js.append(hat_message)

debug_messages.append(js)

Copy link
Author

Choose a reason for hiding this comment

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

Lines 38-55 refactored with the following changes:

Comment on lines -40 to +46
btn_message = 'Button ' + str(button) + ': ' + str(joystick.get_button(button))
btn_message = f'Button {str(button)}: {str(joystick.get_button(button))}'
js.append(btn_message)
for axis in range(joystick.get_numaxes()):
axis_message = 'Axis ' + str(axis) + ': ' + str(joystick.get_axis(axis))
axis_message = f'Axis {str(axis)}: {str(joystick.get_axis(axis))}'
js.append(axis_message)
for hat in range(joystick.get_numhats()):
hat_message = 'Hat ' + str(hat) + ': ' + str(joystick.get_hat(hat))
hat_message = f'Hat {str(hat)}: {str(joystick.get_hat(hat))}'
Copy link
Author

Choose a reason for hiding this comment

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

Lines 40-46 refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Mar 13, 2023

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 21.77 😞 21.77 😞 0.00
Method Length 94.00 🙂 94.00 🙂 0.00
Working memory 9.85 🙂 9.85 🙂 0.00
Quality 45.92% 😞 45.92% 😞 0.00%
Other metrics Before After Change
Lines 113 113 0
Changed files Quality Before Quality After Quality Change
main.py 45.88% 😞 45.88% 😞 0.00%
main_test_.py 45.96% 😞 45.96% 😞 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants