-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Conversation
thumbnail_format = '100x100' | ||
picture = obj.get_default_picture() | ||
|
||
if picture: | ||
thumbnail_format = '100x100' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function ArtworkAdmin.thumbnail
refactored with the following changes:
- Move assignments closer to their usage (
move-assign
)
obj = Category(slug=slug, title=title) | ||
|
||
return obj | ||
return Category(slug=slug, title=title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function PortfolioTestBase.create_category
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
obj = Collection(slug=slug, title=title) | ||
|
||
return obj | ||
return Collection(slug=slug, title=title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function PortfolioTestBase.create_collection
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
obj = Artwork(collection=collection) | ||
|
||
return obj | ||
return Artwork(collection=collection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function PortfolioTestBase.create_artwork
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
obj = Picture(artwork=artwork, title=title) | ||
return obj | ||
return Picture(artwork=artwork, title=title) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function PortfolioTestBase.create_picture
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
if not expected_admin or not expected_inline: | ||
if not (expected_admin and expected_inline): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function EditorTestBase.test_admin
refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan
)
if next: | ||
default_ordering = 'ASC' | ||
else: | ||
default_ordering = 'DESC' | ||
|
||
default_ordering = 'ASC' if next else 'DESC' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function get_next_or_previous
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
) - Simplify logical expression using De Morgan identities (
de-morgan
)
object_list = models.Category.objects.all()[offset:offset+limit] | ||
return object_list | ||
return models.Category.objects.all()[offset:offset+limit] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function categories
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
object_list = models.Collection.objects.all()[offset:offset+limit] | ||
return object_list No newline at end of file | ||
return models.Collection.objects.all()[offset:offset+limit] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function collections
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
Sourcery Code Quality Report (beta)✅ Merging this PR will increase code quality in the affected files by 0.01 out of 10.
Here are some functions in these files that still need a tune-up:
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! |
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: