def ValidateAndLog(self, log):
    self._CheckTimeField(log)

    # User checks.
    if self.user in USER_WHITELIST:
      return
    elif len(self.user) > 31:
      log.LineError(log.MSG_INVALID_USER,
                    'Username too long "%s"' % self.user)
    elif self.user.startswith('-'):
      log.LineError(log.MSG_INVALID_USER, 'Invalid username "%s"' % self.user)
    elif re.search(r'[\s!"#$%&\'()*+,/:;<=>?@[\\\]^`{|}~]', self.user):
      log.LineError(log.MSG_INVALID_USER, 'Invalid username "%s"' % self.user)
    else:
      try:
        pwd.getpwnam(self.user)
      except KeyError:
        log.LineWarn(log.MSG_USER_NOT_FOUND,
                     'User "%s" not found.' % self.user)

    # Command checks.
    if self.command.startswith('%') or re.search(r'[^\\]%', self.command):
      log.LineWarn(log.MSG_BARE_PERCENT, 'A bare % is a line break in'
                   ' crontab and is commonly not intended.')
Validates an @ time spec line and logs any errors and warnings.
dataset/ETHPy150Open lyda/chkcrontab/chkcrontab_lib.py/CronLineTimeAction.ValidateAndLog