def is_valid_description(entry): """ If the entry starts with a valid jira ticket :param entry: :return: """ try: description = entry['description'] except KeyError: return error(entry, 'Missing description') if re.match(r'[A-Z]+-[\d]+', description): return success(entry) return error(entry, 'Invalid description')
def has_significant_duration(entry): """ If a duration is too small, then jira doesn't like it. Plus, there's no reason to log it... :param entry: :return: """ duration = entry['duration'] if duration < 60 * 5: return error(entry, 'Duration is too small: %s seconds' % duration) return success(entry)
def is_not_currently_logging(entry): if entry['duration'] < 0: return error(entry, 'Currently logging') return success(entry)
def is_not_already_logged(entry): if JIGGLD_TAG in entry.get('tags', []): return error(entry, 'Already logged') return success(entry)