Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #625

Merged
merged 5 commits into from
Sep 16, 2024
Merged

Develop #625

merged 5 commits into from
Sep 16, 2024

Conversation

alimaktabi
Copy link
Collaborator

@alimaktabi alimaktabi commented Sep 16, 2024

Summary by Sourcery

Simplify constraint verification classes by removing unnecessary constructor methods and correct a typo in a class name within the Twitter constraints module.

Enhancements:

  • Remove redundant constructor methods from multiple constraint verification classes across various modules, simplifying the class definitions.
  • Correct a typo in the class name from 'IsFollowinTwitterUser' to 'IsFollowingTwitterUser' in the Twitter constraints module.

Copy link
Contributor

sourcery-ai bot commented Sep 16, 2024

Reviewer's Guide by Sourcery

This pull request primarily focuses on refactoring constraint verification classes across multiple files in the core/constraints directory. The main changes involve removing redundant init methods and fixing a typo in a class name.

File-Level Changes

Change Details Files
Removed redundant init methods from constraint verification classes
  • Deleted init methods that only called super().init(user_profile)
  • Removed unnecessary inheritance of user_profile parameter
core/constraints/farcaster.py
core/constraints/lens.py
core/constraints/twitter.py
core/constraints/general.py
core/constraints/arbitrum.py
core/constraints/gitcoin_passport.py
core/constraints/optimism.py
core/constraints/ens.py
core/constraints/octant.py
Fixed typo in class name and corresponding references
  • Renamed 'IsFollowinTwitterUser' to 'IsFollowingTwitterUser'
  • Updated reference in core/models.py to use the corrected class name
core/constraints/twitter.py
core/models.py
Modified init method in HasMuonNode class
  • Added optional 'obj' parameter to init method
  • Updated super().init() call to include the new 'obj' parameter
core/constraints/muon_node.py

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @alimaktabi - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider explaining why the HasMuonNode class retains a custom __init__ method while it was removed from other classes. If possible, align it with the pattern used in other classes for consistency.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines -15 to -16
def __init__(self, user_profile) -> None:
super().__init__(user_profile)
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Removal of redundant init methods improves code clarity

This change removes redundant init methods across multiple classes. It's a good optimization that reduces code duplication and improves maintainability. Ensure that this pattern is applied consistently across all relevant classes.

class BridgeEthToArb(ConstraintVerification):
    app_name = ConstraintApp.ARBITRUM.value

    def is_observed(self, *args, **kwargs) -> bool:

@@ -146,7 +146,7 @@ class Type(models.TextChoices):
HasGitcoinPassportProfile,
IsFollowingFarcasterChannel,
BridgeEthToArb,
IsFollowinTwitterUser,
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (typo): Fixed typo in class name IsFollowingTwitterUser

Good catch on fixing the typo in the class name. This improves code consistency and readability.

@PooyaFekri PooyaFekri merged commit efd06a0 into main Sep 16, 2024
2 checks passed
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.

2 participants