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

Предупреждать, если get_all используется с методом, не кончающимся на *.list #225

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

leshchenko1979
Copy link
Owner

No description provided.

@leshchenko1979 leshchenko1979 merged commit e441def into master Mar 20, 2024
9 checks passed
@leshchenko1979 leshchenko1979 deleted the leshchenko1979/issue224 branch March 20, 2024 18:02
Copy link

@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 @leshchenko1979 - I've reviewed your changes and they look great!

General suggestions:

  • Consider raising an exception instead of logging a warning to enforce correct usage patterns more strictly.
  • The implementation of the warning is a good step towards improving code maintainability and guiding developers. However, evaluating the impact of this change on existing codebases and ensuring it aligns with overall error handling strategies could be beneficial.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Docstrings: 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 +108 to +112
if not self.st_method.endswith(".list"):
logger.logger.warning(
"get_all() should be used only with methods that end with '.list'. "
"Use get_by_ID() or call() instead."
)
Copy link

Choose a reason for hiding this comment

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

suggestion (code_refinement): Consider raising an exception for unsupported methods.

Logging a warning is helpful, but in cases where the method is used incorrectly, raising an exception might prevent further execution with an unsupported method, enforcing correct usage patterns more strictly.

@@ -105,6 +105,12 @@
"https://github.com/leshchenko1979/fast_bitrix24/issues/199",
)
def check_special_limitations(self):
if not self.st_method.endswith(".list"):
Copy link

Choose a reason for hiding this comment

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

issue (complexity): Consider the addition of a warning for non '.list' method usage with get_all() as a beneficial enhancement.

The addition of a warning for methods not ending in ".list" is a thoughtful way to guide correct usage of get_all(). This change introduces minimal complexity, focusing on enhancing maintainability by alerting developers to potential misuse. It's a straightforward and effective update that doesn't significantly increase cognitive load or code complexity. Good job on keeping the implementation simple and focused on improving developer experience.

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