Skip to content

Commit

Permalink
Fixing profile validation tool when an empty profile is found
Browse files Browse the repository at this point in the history
  • Loading branch information
carlio committed Aug 2, 2016
1 parent d07f6d4 commit c2cf4ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions prospector/tools/profile_validator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from prospector.tools import pyflakes


PROFILE_IS_EMPTY = 'profile-is-empty'
CONFIG_SETTING_SHOULD_BE_LIST = 'should-be-list'
CONFIG_UNKNOWN_SETTING = 'unknown-setting'
CONFIG_SETTING_MUST_BE_INTEGER = 'should-be-int'
Expand Down Expand Up @@ -68,6 +69,11 @@ def add_message(code, message, setting):
message = Message('profile-validator', code, location, message)
messages.append(message)

if parsed is None:
# this happens if a completely empty profile is found
add_message(PROFILE_IS_EMPTY, "%s is a completely empty profile" % relative_filepath)
return messages

for setting in ('doc-warnings', 'test-warnings', 'autodetect'):
if not isinstance(parsed.get(setting, False), bool):
add_message(CONFIG_SETTING_MUST_BE_BOOL, '"%s" should be true or false' % setting, setting)
Expand Down

0 comments on commit c2cf4ce

Please sign in to comment.