Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Allow running codacy from python using the -m flag #40

Merged
merged 2 commits into from
Mar 24, 2018
Merged

Allow running codacy from python using the -m flag #40

merged 2 commits into from
Mar 24, 2018

Conversation

althonos
Copy link

Hi there,

I just added a __main__.py file to allow running the program from Python directly instead of using an entry point (python -m codacy). The main perk is that it is not needed for python-codacy-coverage to be in $PATH anymore to be able to report coverage, but only for codacy to be in $PYTHONPATH. This makes it easier for some CI environments.

I also added a prog parameter to runner.run so that the program name can be changed: this way, instead of having python -m codacy -h display this:

usage: __main__.py [-h] [-r REPORT] [-c COMMIT] [-t TOKEN] [-d DIRECTORY] [-v]

it show this:

usage: codacy [-h] [-r REPORT] [-c COMMIT] [-t TOKEN] [-d DIRECTORY] [-v]

while python-codacy-coverage -h will show:

usage: python-codacy-coverage [-h] [-r REPORT] [-c COMMIT] [-t TOKEN] [-d DIRECTORY] [-v]

@@ -0,0 +1,8 @@
#/usr/bin/env python

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you missed a bang here.
Can you change to #!/usr/bin/env python

@althonos
Copy link
Author

@rtfpessoa: Fixed, thanks.

@rtfpessoa rtfpessoa merged commit 6e008cb into archived-codacy:master Mar 24, 2018
@rtfpessoa
Copy link

@althonos released as version 1.3.11

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants