Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying multiple paths as positional arguments #61

Closed
guykisel opened this issue Oct 29, 2014 · 3 comments
Closed

Allow specifying multiple paths as positional arguments #61

guykisel opened this issue Oct 29, 2014 · 3 comments

Comments

@guykisel
Copy link
Contributor

This is related to #56. It would be easier to wrap prospector in other tools (such as a git commit hook) if it could accept more than one path at a time.

I'm interested in implementing this myself and submitting it as a pull request, but I wouldn't mind if someone else with more free time does it instead.

@guykisel
Copy link
Contributor Author

My investigation so far makes me think that the command line config settings already support multiple positional input paths, since prospector is passing nargs: * into setoptconf, which passes it into argparse, which interprets it according to https://docs.python.org/2.7/library/argparse.html#nargs

positional = (
        ('checkpath', {
            'help': 'The path to a Python project to inspect. Defaults to PWD'
                    '  if not specified.',
            'metavar': 'PATH',
            'nargs': '*',
        })

I think the key is that currently prospector only uses the first path in the list of paths:

    # Make it so
    prospector = Prospector(config, paths[0])
    prospector.execute()
    prospector.print_messages()

and Prospector is built around taking in a single path at initialization.

The solution seems to be either:

  1. Rewrite Prospector to allow specifying a list of paths
    or
  2. Iterate over the input paths, creating a new Prospector for each one and aggregating the resulting messages, then print a single summary for all of those messages.

@guykisel
Copy link
Contributor Author

Opened #78 for this issue.

@carlio
Copy link
Contributor

carlio commented Jan 2, 2015

I merged in #78 and you can now run prospector with

prospector file1.py path/to/file2.py ...

It will output all messages together followed by a summary. It's sort of equivalent to saying prospector . then explicitly ignoring any files you don't want checked.

@carlio carlio closed this as completed Jan 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants