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

Already on GitHub? Sign in to your account

Missing dependency injection in StyleGuide #79

Closed
myint opened this Issue Jun 14, 2012 · 4 comments

Comments

Projects
None yet
2 participants
Member

myint commented Jun 14, 2012

StyleGuide seems to be currently hard coded to pass in "arglist=None" to process_options(). This results in StyleGuide indirectly reading from sys.argv.

Contributor

florentx commented Jun 14, 2012

Hello,

I want to understant the use case behind.
Currently, the sys.argv is never read, unless the flag parse_argv=True is passed to the constructor.
The StyleGuide instance can be built with dict-like arguments.

Florent

Member

myint commented Jun 14, 2012

The use case involves passing options to pep8.

I tried using process_options() directly without StyleGuide initially, but that resulted in some error about options.physical_checks being missing. Then I tried monkey patching options.physical_checks and couldn't get it to work properly.

Any suggestions about how to do this properly would be helpful.

Thanks

Contributor

florentx commented Jun 14, 2012

This is how I intend to use it:
https://github.com/florentx/autopep8/commit/cd4197371a11eff87a5d8380e509b2954489eee5

Probably this breaks, since I did not test it.
Let me know if I need to do more or if you can catch on it.

I have committed the BaseReport.result to better support this.

Member

myint commented Jun 15, 2012

Thanks! I needed to make a slight change, but it works now.

@myint myint closed this Jun 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment