Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Mar 18, 2022

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 ghodsizadeh March 18, 2022 15:41
# create random data with name , age , income and IQ

names = ['name'+str(i) for i in range(100)]
names = [f'name{str(i)}' for i in range(100)]
Copy link
Author

Choose a reason for hiding this comment

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

Lines 7-7 refactored with the following changes:

hs = HandleStock(id=id)
res = hs.get_analysis()
return res
return hs.get_analysis()
Copy link
Author

Choose a reason for hiding this comment

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

Function get_stock_detail refactored with the following changes:

Comment on lines -45 to +44
elif stock_industry in [1, 2, 3, 4]:
elif stock_industry in {1, 2, 3, 4}:
Copy link
Author

Choose a reason for hiding this comment

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

Function get_stock_with_query_params refactored with the following changes:

Comment on lines -31 to +36
response = {'max_price ': float(max_price), 'min_price': float(min_price), "last_10_day":last_10_days_price, 'start_date': float(start_date)}
return response
return {
'max_price ': float(max_price),
'min_price': float(min_price),
"last_10_day": last_10_days_price,
'start_date': float(start_date),
}
Copy link
Author

Choose a reason for hiding this comment

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

Function HandleStock.get_analysis refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Mar 18, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.31 ⭐ 0.32 ⭐ 0.01 👎
Method Length 33.31 ⭐ 32.92 ⭐ -0.39 👍
Working memory 5.25 ⭐ 5.24 ⭐ -0.01 👍
Quality 86.63% 86.65% 0.02% 👍
Other metrics Before After Change
Lines 105 108 3
Changed files Quality Before Quality After Quality Change
copilot/sample.py 72.38% 🙂 72.26% 🙂 -0.12% 👎
fastapi_regression/main.py 95.44% ⭐ 95.39% ⭐ -0.05% 👎
fastapi_regression/stock.py 86.86% ⭐ 87.38% ⭐ 0.52% 👍

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.

1 participant