diff --git a/prospector/config.py b/prospector/config.py index 6cc5aa26..2d5aefbb 100644 --- a/prospector/config.py +++ b/prospector/config.py @@ -263,7 +263,8 @@ def build_command_line_source(prog=None, description='Performs static analysis o positional = ( ('checkpath', { 'help': 'The path to a Python project to inspect. Defaults to PWD' - ' if not specified.', + ' if not specified. If multiple paths are specified,' + ' they must all be files (no directories).', 'metavar': 'PATH', 'nargs': '*', }), diff --git a/prospector/formatters/text.py b/prospector/formatters/text.py index 65e0c32e..cf5d780d 100644 --- a/prospector/formatters/text.py +++ b/prospector/formatters/text.py @@ -11,6 +11,7 @@ class TextFormatter(Formatter): summary_labels = ( + ('path', 'Path'), ('started', 'Started'), ('completed', 'Finished'), ('time_taken', 'Time Taken', lambda x: '%s seconds' % x), diff --git a/prospector/run.py b/prospector/run.py index 07a456ce..053ee69f 100644 --- a/prospector/run.py +++ b/prospector/run.py @@ -204,6 +204,7 @@ def process_messages(self, messages): def execute(self): summary = { + 'path': self.path, 'started': datetime.now(), 'libraries': self.libraries, 'strictness': self.strictness, @@ -284,10 +285,12 @@ def print_messages(self, write_to=None): self.summary['formatter'] = output_format formatter = FORMATTERS[output_format](self.summary, self.messages) + print_messages = not self.config.summary_only and self.messages + # Produce the output write_to.write(formatter.render( summary=not self.config.messages_only, - messages=not self.config.summary_only, + messages=print_messages, )) write_to.write('\n') @@ -315,10 +318,17 @@ def main(): else: paths = [os.getcwd()] + if len(paths) > 1 and not all([os.path.isfile(path) for path in paths]): + raise ValueError('In multi-path mode, all inputs must be files, ' + 'not directories.') + # Make it so - prospector = Prospector(config, paths[0]) - prospector.execute() - prospector.print_messages() + messages = [] + for path in paths: + prospector = Prospector(config, path) + prospector.execute() + prospector.print_messages() + messages.extend(prospector.get_messages()) if config.zero_exit: # if we ran successfully, and the user wants us to, then we'll @@ -328,7 +338,7 @@ def main(): # otherwise, finding messages is grounds for exiting with an error # code, to make it easier for bash scripts and similar situations # to know if there any errors have been found. - if len(prospector.get_messages()) > 0: + if len(messages) > 0: return 1 return 0