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

Bandit, release v1, use ifs over assert in src #67

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

ddmee
Copy link
Owner

@ddmee ddmee commented Oct 15, 2022

Fix for this issue #48

Also use bandit in pre-commit.

@ddmee ddmee linked an issue Oct 15, 2022 that may be closed by this pull request
@sonarcloud
Copy link

sonarcloud bot commented Oct 15, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link

@tucked tucked left a comment

Choose a reason for hiding this comment

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

Excellent! 👍

@@ -4,7 +4,7 @@

"""

__version__ = "0.5.0"
__version__ = "1.0.0"
Copy link

@tucked tucked Oct 17, 2022

Choose a reason for hiding this comment

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

Down with ZeroVer! 💯

(Nothing to do here, just pleased with this 😋)

(timeout is not None or max_tries is not None) and poll_forever
), "You cannot specify both the option to poll_forever and max_tries/timeout."
if not ((timeout is not None or max_tries is not None) or poll_forever):
raise AssertionError(
Copy link

Choose a reason for hiding this comment

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

Since we're including this in a major release, I don't think it would be unreasonable to break compatibility by switching to a ValueError.

(FWIW, I don't actually need/rely on this at all. It's just more correct IMO.)

Alternatively, a compromise solution could be to create a custom exception for a while that inherits from both:

class ValueAssertionError(ValueError, AssertionError):
    """Backwards-compatible ValueError (catching AssertionError is deprecated!)"""

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.

Don't use assert for validation
2 participants