diff --git a/prospector/tools/mypy/__init__.py b/prospector/tools/mypy/__init__.py index 520c56d0..6ec64edf 100644 --- a/prospector/tools/mypy/__init__.py +++ b/prospector/tools/mypy/__init__.py @@ -29,6 +29,8 @@ def __init__(self, *args, **kwargs): def configure(self, prospector_config, _): options = prospector_config.tool_options('mypy') + + strict = options.get('strict', False) follow_imports = options.get('follow-imports', 'normal') ignore_missing_imports = options.get('ignore-missing-imports', False) @@ -39,6 +41,9 @@ def configure(self, prospector_config, _): strict_optional = options.get('strict-optional', False) self.options.append('--follow-imports=%s' % follow_imports) + + if strict: + self.options.append('--strict') if ignore_missing_imports: self.options.append('--ignore-missing-imports') @@ -71,21 +76,21 @@ def run(self, found_files): for message in report.splitlines(): iter_message = iter(message.split(':')) - (path, line, char, err_type), err_msg = islice(iter_message, 4), list(message) + (path, line, char, err_type, err_msg) = islice(iter_message, 5) location = Location( path=path, module=None, function=None, line=line, - character=char, + character=int(char), absolute_path=True ) message = Message( source='mypy', - code=err_type, + code=err_type.lstrip(" "), location=location, - message=''.join(err_msg).strip() + message=err_msg.lstrip(" ") ) messages.append(message) - return messages \ No newline at end of file + return messages