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

Выдавать предупреждение, когда в фильтрах используют None #226

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

leshchenko1979
Copy link
Owner

Поправить использование warinings.warn

Fixes #223

@leshchenko1979 leshchenko1979 merged commit 701a49e into master Mar 20, 2024
1 of 9 checks passed
@leshchenko1979 leshchenko1979 deleted the leshchenko1979/issue223 branch March 20, 2024 18:16
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 clarifying the warning message regarding the use of 'null' or 'false' to ensure it's understood they are not string literals.
  • Verify the 'stacklevel' parameter in warnings to ensure it accurately points to the user's code, enhancing the debugging experience.
  • Include specific version or timeline information in deprecation warnings to make them more actionable for developers.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 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 +53 to +59
if "FILTER" in p and None in p["FILTER"].values():
warnings.warn(
"Using None as filter value confuses Bitrix. "
"Try using an empty string, 'null' or 'false'.",
UserWarning,
stacklevel=2,
)
Copy link

Choose a reason for hiding this comment

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

suggestion (code_clarification): Consider refining the warning message for clarity.

The warning message suggests using 'null' or 'false' as alternatives to None, which might be interpreted as string literals rather than the intended JSON values. Clarifying this in the message could prevent confusion.

@@ -176,6 +184,7 @@
f"Number of results returned ({len(self.results)}) "
f"doesn't equal 'total' from the server reply ({self.total})",
RuntimeWarning,
stacklevel=4,
Copy link

Choose a reason for hiding this comment

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

question (code_refinement): Verify the appropriateness of 'stacklevel=4' for the context.

Ensure that 'stacklevel=4' correctly points to the user's code in the stack trace. If the nesting level of calls has changed, this value might need adjustment.

Comment on lines +317 to +322
warnings.warn(
"list_and_get() is deprecated. It's not efficient to use it "
"now that exceeding Bitrix request rate limitations gets users "
"heavily penalised. Use 'get_all()' instead.",
DeprecationWarning,
stacklevel=2,
Copy link

Choose a reason for hiding this comment

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

suggestion (code_clarification): Ensure the deprecation warning is clear and actionable.

The message now provides more context on why 'list_and_get()' is deprecated, which is good. However, consider adding a specific version or date when 'list_and_get()' will be removed to make the deprecation notice more actionable.

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.

Выдавать предупреждение, когда в фильтрах используют None
1 participant