upgrade wakatime-cli to v6.2.1

This commit is contained in:
Alan Hamlett 2017-02-08 19:25:31 -08:00
parent c574234927
commit 305de46e32
2 changed files with 48 additions and 31 deletions

View file

@ -1,7 +1,7 @@
__title__ = 'wakatime' __title__ = 'wakatime'
__description__ = 'Common interface to the WakaTime api.' __description__ = 'Common interface to the WakaTime api.'
__url__ = 'https://github.com/wakatime/wakatime' __url__ = 'https://github.com/wakatime/wakatime'
__version_info__ = ('6', '2', '0') __version_info__ = ('6', '2', '1')
__version__ = '.'.join(__version_info__) __version__ = '.'.join(__version_info__)
__author__ = 'Alan Hamlett' __author__ = 'Alan Hamlett'
__author_email__ = 'alan@wakatime.com' __author_email__ = 'alan@wakatime.com'

View file

@ -238,10 +238,23 @@ def parseArguments():
args.include.append(pattern) args.include.append(pattern)
except TypeError: # pragma: nocover except TypeError: # pragma: nocover
pass pass
if args.hidefilenames:
args.hidefilenames = ['.*']
else:
args.hidefilenames = []
if configs.has_option('settings', 'hidefilenames'):
option = configs.get('settings', 'hidefilenames')
if option.strip().lower() == 'true':
args.hidefilenames = ['.*']
elif option.strip().lower() != 'false':
try:
for pattern in option.split("\n"):
if pattern.strip() != '':
args.hidefilenames.append(pattern)
except TypeError:
pass
if args.offline and configs.has_option('settings', 'offline'): if args.offline and configs.has_option('settings', 'offline'):
args.offline = configs.getboolean('settings', 'offline') args.offline = configs.getboolean('settings', 'offline')
if not args.hidefilenames and configs.has_option('settings', 'hidefilenames'):
args.hidefilenames = configs.getboolean('settings', 'hidefilenames')
if not args.proxy and configs.has_option('settings', 'proxy'): if not args.proxy and configs.has_option('settings', 'proxy'):
args.proxy = configs.get('settings', 'proxy') args.proxy = configs.get('settings', 'proxy')
if not args.verbose and configs.has_option('settings', 'verbose'): if not args.verbose and configs.has_option('settings', 'verbose'):
@ -266,7 +279,6 @@ def parseArguments():
def should_exclude(entity, include, exclude): def should_exclude(entity, include, exclude):
if entity is not None and entity.strip() != '': if entity is not None and entity.strip() != '':
try:
for pattern in include: for pattern in include:
try: try:
compiled = re.compile(pattern, re.IGNORECASE) compiled = re.compile(pattern, re.IGNORECASE)
@ -277,9 +289,6 @@ def should_exclude(entity, include, exclude):
msg=u(ex), msg=u(ex),
pattern=u(pattern), pattern=u(pattern),
)) ))
except TypeError: # pragma: nocover
pass
try:
for pattern in exclude: for pattern in exclude:
try: try:
compiled = re.compile(pattern, re.IGNORECASE) compiled = re.compile(pattern, re.IGNORECASE)
@ -290,8 +299,6 @@ def should_exclude(entity, include, exclude):
msg=u(ex), msg=u(ex),
pattern=u(pattern), pattern=u(pattern),
)) ))
except TypeError: # pragma: nocover
pass
return False return False
@ -336,8 +343,18 @@ def send_heartbeat(project=None, branch=None, hostname=None, stats={}, key=None,
'type': entity_type, 'type': entity_type,
} }
if hidefilenames and entity is not None and entity_type == 'file': if hidefilenames and entity is not None and entity_type == 'file':
for pattern in hidefilenames:
try:
compiled = re.compile(pattern, re.IGNORECASE)
if compiled.search(entity):
extension = u(os.path.splitext(data['entity'])[1]) extension = u(os.path.splitext(data['entity'])[1])
data['entity'] = u('HIDDEN{0}').format(extension) data['entity'] = u('HIDDEN{0}').format(extension)
break
except re.error as ex:
log.warning(u('Regex error ({msg}) for include pattern: {pattern}').format(
msg=u(ex),
pattern=u(pattern),
))
if stats.get('lines'): if stats.get('lines'):
data['lines'] = stats['lines'] data['lines'] = stats['lines']
if stats.get('language'): if stats.get('language'):