Skip to content

Sourcery refactored main branch - #1

Open
sourcery-ai[bot] wants to merge 1 commit into
mainfrom
sourcery/main
Open

Sourcery refactored main branch#1
sourcery-ai[bot] wants to merge 1 commit into
mainfrom
sourcery/main

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Jun 5, 2021

Copy link
Copy Markdown

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^

@sourcery-ai
sourcery-ai Bot requested a review from PiyanshK June 5, 2021 22:10
Comment thread src/data.py
Comment on lines -14 to +27
squares = [[first_x, 0], [second_x, 0], [third_x, 0], [fourth_x, 0],
[first_x, first_y], [second_x, first_y], [third_x, first_y], [fourth_x, first_y],
[first_x, second_y], [second_x, second_y], [third_x, second_y], [fourth_x, second_y]]
return squares
return [
[first_x, 0],
[second_x, 0],
[third_x, 0],
[fourth_x, 0],
[first_x, first_y],
[second_x, first_y],
[third_x, first_y],
[fourth_x, first_y],
[first_x, second_y],
[second_x, second_y],
[third_x, second_y],
[fourth_x, second_y],
]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function MemoryGameData.square_start refactored with the following changes:

Comment thread src/data.py
Comment on lines -31 to -37
prompts = {
"Pencil": "Click On the square where you saw the yellow Pencil.",
"Mountain": "Click On the square where you saw the Tall White Mountain.",
"Numbers": "Click On the square where you saw the Numbers surronded by the red circles.",
"Letters": "Click On the square where you saw the the letters in the yellow box."
return {
"Pencil":
"Click On the square where you saw the yellow Pencil.",
"Mountain":
"Click On the square where you saw the Tall White Mountain.",
"Numbers":
"Click On the square where you saw the Numbers surronded by the red circles.",
"Letters":
"Click On the square where you saw the the letters in the yellow box.",
}
return prompts

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function MemoryGameData.prompts refactored with the following changes:

Comment thread src/game.py
Comment on lines -67 to +68

prompt = self.prompts[random_image_choice]

return prompt

return self.prompts[random_image_choice]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Game.draw_random_image refactored with the following changes:

Comment thread src/game.py
Comment on lines -76 to -77
amount_of_guesses = 1

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Game.drawscreen refactored with the following changes:

@sourcery-ai

sourcery-ai Bot commented Jun 5, 2021

Copy link
Copy Markdown
Author

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 11.61 🙂 10.16 🙂 -1.45 👍
Method Length 76.10 🙂 75.20 🙂 -0.90 👍
Working memory 13.23 😞 13.21 😞 -0.02 👍
Quality 51.21% 🙂 52.06% 🙂 0.85% 👍
Other metrics Before After Change
Lines 158 168 10
Changed files Quality Before Quality After Quality Change
src/data.py 72.57% 🙂 73.10% 🙂 0.53% 👍
src/game.py 45.34% 😞 46.62% 😞 1.28% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
src/game.py Game.drawscreen 24 😞 233 ⛔ 18 ⛔ 24.79% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/data.py MemoryGameData.fullsquares 1 ⭐ 70 🙂 16 ⛔ 63.36% 🙂 Extract out complex expressions
src/game.py Game.draw_random_image 1 ⭐ 120 😞 10 😞 65.38% 🙂 Try splitting into smaller methods. Extract out complex expressions
src/game.py Game.drawlines 2 ⭐ 93 🙂 10 😞 67.98% 🙂 Extract out complex expressions
src/data.py MemoryGameData.images 0 ⭐ 47 ⭐ 11 😞 75.07% ⭐ 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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

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