Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_mock_status(self)
# TODO: make things more organic/specific/less tabular:
#
# current git branch: xxx (implies type yyy)
# changelog: xxx
# so the next release would be: a.b.c (or: 'so the release we're
# cutting/expecting is a.b.c')
# version file:
# git tag: (maybe including
# latest that is found? that's extra logic...)
# etc...
parts = dict(
changelog=Changelog.NEEDS_RELEASE.value,
version=VersionFile.NEEDS_BUMP.value,
tag=Tag.NEEDS_CUTTING.value,
)
for part in parts:
parts[part] = re.escape(parts[part])
parts["header_footer"] = r"-+ +-+"
# NOTE: forces impl to follow specific order, which is good
regex = r"""
{header_footer}
Changelog +{changelog}
Version +{version}
Tag +{tag}
{header_footer}
""".format(
**parts
).strip()
output = sys.stdout.getvalue()
def changelog_release_version_update_tag_update(self):
_expect_actions(
self,
Changelog.NEEDS_RELEASE,
VersionFile.NEEDS_BUMP,
Tag.NEEDS_CUTTING,
)
actions = Lexicon()
# Changelog: needs new release entry if there are any unreleased issues for
# current branch's line.
# TODO: annotate with number of released issues [of each type?] - so not
# just "up to date!" but "all set (will release 3 features & 5 bugs)"
actions.changelog = Changelog.OKAY
if release_type in (Release.BUGFIX, Release.FEATURE) and issues:
actions.changelog = Changelog.NEEDS_RELEASE
# Version file: simply whether version file equals the target version.
# TODO: corner case of 'version file is >1 release in the future', but
# that's still wrong, just would be a different 'bad' status output.
actions.version = VersionFile.OKAY
if state.current_version != state.expected_version:
actions.version = VersionFile.NEEDS_BUMP
# Git tag: similar to version file, except the check is existence of tag
# instead of comparison to file contents. We even reuse the
# 'expected_version' variable wholesale.
actions.tag = Tag.OKAY
if state.expected_version not in state.tags:
actions.tag = Tag.NEEDS_CUTTING
#
# Return
#
return actions, state