Skip to content

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

Open
ddmee wants to merge 2 commits intomasterfrom
bandit
Open

Bandit, release v1, use ifs over assert in src#67
ddmee wants to merge 2 commits intomasterfrom
bandit

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
@sonarqubecloud
Copy link

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! 👍

"""

__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