support bool or list for hide_project_names config

This commit is contained in:
Alan Hamlett 2018-07-18 09:28:23 -07:00
parent 71d5eef12a
commit ae2ac14a9f
13 changed files with 78 additions and 44 deletions

View file

@ -1,6 +1,6 @@
[settings]
debug = false
api_key = 033c47c9-0441-4eb5-8b3f-b51f27b31049
hide_filenames =
hide_file_names =
missingfile
python\.py$

View file

@ -1,4 +1,4 @@
[settings]
debug = false
api_key = 033c47c9-0441-4eb5-8b3f-b51f27b31049
hide_filenames = invalid(regex
hide_file_names = invalid(regex

View file

@ -12,4 +12,4 @@ include =
\(invalid regex)
includeme
offline = true
hide_filenames = true
hide_file_names = true

View file

@ -3,7 +3,7 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
[--entity-type ENTITY_TYPE] [--category CATEGORY]
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
[--hostname HOSTNAME] [--disable-offline] [--hide-filenames]
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
[--hide-project-names] [--exclude EXCLUDE]
[--exclude-unknown-project] [--include INCLUDE]
[--include-only-with-project-file] [--extra-heartbeats]

View file

@ -3,7 +3,7 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
[--entity-type ENTITY_TYPE] [--category CATEGORY]
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
[--hostname HOSTNAME] [--disable-offline] [--hide-filenames]
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
[--hide-project-names] [--exclude EXCLUDE]
[--exclude-unknown-project] [--include INCLUDE]
[--include-only-with-project-file] [--extra-heartbeats]

View file

@ -3,7 +3,7 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
[--entity-type ENTITY_TYPE] [--category CATEGORY]
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
[--hostname HOSTNAME] [--disable-offline] [--hide-filenames]
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
[--hide-project-names] [--exclude EXCLUDE]
[--exclude-unknown-project] [--include INCLUDE]
[--include-only-with-project-file] [--extra-heartbeats]

View file

@ -3,7 +3,7 @@ usage: wakatime [-h] [--entity FILE] [--key KEY] [--write] [--plugin PLUGIN]
[--entity-type ENTITY_TYPE] [--category CATEGORY]
[--proxy PROXY] [--no-ssl-verify] [--project PROJECT]
[--alternate-project ALTERNATE_PROJECT] [--language LANGUAGE]
[--hostname HOSTNAME] [--disable-offline] [--hide-filenames]
[--hostname HOSTNAME] [--disable-offline] [--hide-file-names]
[--hide-project-names] [--exclude EXCLUDE]
[--exclude-unknown-project] [--include INCLUDE]
[--include-only-with-project-file] [--extra-heartbeats]
@ -49,7 +49,7 @@ optional arguments:
--hostname HOSTNAME Hostname of current machine.
--disable-offline Disables offline time logging instead of queuing
logged time.
--hide-filenames Obfuscate filenames. Will not send file names to api.
--hide-file-names Obfuscate filenames. Will not send file names to api.
--hide-project-names Obfuscate project names. When a project folder is
detected instead of using the folder name as the
project, a .wakatime-project file is created with a

View file

@ -414,7 +414,7 @@ class ConfigsTestCase(TestCase):
self.assertSessionCacheSaved()
@log_capture()
def test_does_not_hide_filenames_from_invalid_regex(self, logs):
def test_does_not_hide_file_names_from_invalid_regex(self, logs):
logging.disable(logging.NOTSET)
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = CustomResponse()
@ -434,9 +434,9 @@ class ConfigsTestCase(TestCase):
self.assertNothingPrinted()
actual = self.getLogOutput(logs)
expected = u('WakaTime WARNING Regex error (unbalanced parenthesis) for include pattern: invalid(regex')
expected = u('WakaTime WARNING Regex error (unbalanced parenthesis) for hide_file_names pattern: invalid(regex')
if self.isPy35OrNewer:
expected = 'WakaTime WARNING Regex error (missing ), unterminated subpattern at position 7) for include pattern: invalid(regex'
expected = 'WakaTime WARNING Regex error (missing ), unterminated subpattern at position 7) for hide_file_names pattern: invalid(regex'
self.assertEquals(expected, actual)
heartbeat = {

View file

@ -17,7 +17,8 @@ class HeartbeatTestCase(TestCase):
class Args(object):
exclude = []
hide_filenames = ['.*']
hide_file_names = ['.*']
hide_project_names = []
include = []
plugin = None
include_only_with_project_file = None
@ -50,7 +51,8 @@ class HeartbeatTestCase(TestCase):
class Args(object):
exclude = []
hide_filenames = []
hide_file_names = []
hide_project_names = []
include = []
plugin = None
include_only_with_project_file = None
@ -74,7 +76,8 @@ class HeartbeatTestCase(TestCase):
logging.disable(logging.NOTSET)
class Args(object):
hide_filenames = ['.*']
hide_file_names = ['.*']
hide_project_names = []
plugin = None
branch = 'abc123'
@ -95,7 +98,8 @@ class HeartbeatTestCase(TestCase):
logging.disable(logging.NOTSET)
class Args(object):
hide_filenames = ['.*']
hide_file_names = ['.*']
hide_project_names = []
plugin = None
branch = 'abc123'